reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
## For implicit symbol table sections, `Link` field can also
## be specified in YAML. Here we test the behavior in different cases.

## Check we are able to set Link = 0 for .symtab explicitly.

# RUN: yaml2obj --docnum=1 %s -o %t1
# RUN: llvm-readobj %t1 -S | FileCheck %s --check-prefix=CASE1

# CASE1: Name: .symtab
# CASE1: Link:
# CASE1-SAME: 0

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_DYN
  Machine: EM_X86_64
Sections:
  - Name: .symtab
    Type: SHT_SYMTAB
    Link: 0

## Check that by default .symtab will be linked with .strtab.

# RUN: yaml2obj --docnum=2 %s -o %t2
# RUN: llvm-readobj %t2 -S | FileCheck %s --check-prefix=CASE2

# CASE2:      .symtab
# CASE2:      Link:
# CASE2-SAME: 2
# CASE2:      Index: 2
# CASE2-NEXT: Name: .strtab

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_DYN
  Machine: EM_X86_64
Sections:
  - Name: .symtab
    Type: SHT_SYMTAB

## Even if .strtab is defined in YAML, we can explicitly link .symtab
## to another section.

# RUN: yaml2obj --docnum=3 %s -o %t3
# RUN: llvm-readobj %t3 -S | FileCheck %s --check-prefix=CASE3

# CASE3:      .symtab
# CASE3:      Link:
# CASE3-SAME: 3
# CASE3:      Index: 3
# CASE3-NEXT: Name: .foo

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_DYN
  Machine: EM_X86_64
Sections:
  - Name: .symtab
    Type: SHT_SYMTAB
    Link: 3
  - Name: .strtab
    Type: SHT_STRTAB
  - Name: .foo
    Type: SHT_PROGBITS

## Check we can use a section name as a Link value for .symtab.

# RUN: yaml2obj --docnum=4 %s -o %t4
# RUN: llvm-readobj %t4 -S | FileCheck %s --check-prefix=CASE4

# CASE4:      .symtab
# CASE4:      Link:
# CASE4-SAME: 2
# CASE4:      Index: 2
# CASE4-NEXT: Name: .foo

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_DYN
  Machine: EM_X86_64
Sections:
  - Name: .symtab
    Type: SHT_SYMTAB
    Link: .foo
  - Name: .foo
    Type: SHT_PROGBITS