brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · 47ff0e4 Raw
106 lines · yaml
1## Check the section header properties of ".dynsym",2## ".dynstr", ".symtab", ".strtab", ".shstrtab".3## These sections sections are usually added implicitly,4## but here we add them explicitly in YAML and verify.5## We check their order matches YAML and that file offset is6## ascending. This is a natural default behavior.7 8# RUN: yaml2obj --docnum=1 %s -o %t19# RUN: llvm-readelf -S %t1 | FileCheck %s10 11# CHECK:      Section Headers:12# CHECK-NEXT:  [Nr] Name      Type     Address          Off    Size13# CHECK-NEXT:  [ 0]           NULL     0000000000000000 000000 00000014# CHECK-NEXT:  [ 1] .dynstr   STRTAB   0000000000000100 000040 00000115# CHECK-NEXT:  [ 2] .dynsym   DYNSYM   0000000000000150 000041 00001816# CHECK-NEXT:  [ 3] .symtab   SYMTAB   0000000000000000 000059 00001817# CHECK-NEXT:  [ 4] .strtab   STRTAB   0000000000000000 000071 00000118# CHECK-NEXT:  [ 5] .shstrtab STRTAB   0000000000000000 000072 00003519# CHECK-NEXT:  [ 6] .text.foo PROGBITS 0000000000000200 0000a7 00000020 21--- !ELF22FileHeader:23  Class: ELFCLASS6424  Data:  ELFDATA2LSB25  Type:  ET_DYN26Sections:27  - Name:    .dynstr28    Type:    SHT_STRTAB29    Address: 0x10030  - Name:    .dynsym31    Type:    SHT_DYNSYM32    Address: 0x15033  - Name:    .symtab34    Type:    SHT_SYMTAB35  - Name:    .strtab36    Type:    SHT_STRTAB37  - Name:    .shstrtab38    Type:    SHT_STRTAB39  - Name:    .text.foo40    Type:    SHT_PROGBITS41    Address: 0x20042 43## Check that yaml2obj creates empty .dynstr and .dynsym sections for44## the case when no dynamic symbols were specified and Content wasn't set,45## but the sections were explicitly listed. Check their VAs are correct.46 47# RUN: yaml2obj --docnum=2 %s -o %t248# RUN: llvm-readelf -S %t2 | FileCheck %s --check-prefix=NODYNSYM49 50# NODYNSYM:      Section Headers:51# NODYNSYM-NEXT: [Nr] Name      Type      Address          Off    Size52# NODYNSYM-NEXT: [ 0]           NULL      0000000000000000 000000 00000053# NODYNSYM-NEXT: [ 1] .dynstr   STRTAB    0000000000000100 000040 00000154# NODYNSYM-NEXT: [ 2] .dynsym   DYNSYM    0000000000000150 000041 00001855# NODYNSYM-NEXT: [ 3] .symtab   SYMTAB    0000000000000000 000059 00001856# NODYNSYM-NEXT: [ 4] .strtab   STRTAB    0000000000000000 000071 00000157# NODYNSYM-NEXT: [ 5] .shstrtab STRTAB    0000000000000000 000072 00003558# NODYNSYM-NEXT: [ 6] .text.foo PROGBITS  0000000000000200 0000a7 00000059 60--- !ELF61FileHeader:62  Class: ELFCLASS6463  Data:  ELFDATA2LSB64  Type:  ET_DYN65Sections:66  - Name:    .dynstr67    Type:    SHT_STRTAB68    Address: 0x10069  - Name:    .dynsym70    Type:    SHT_DYNSYM71    Address: 0x15072  - Name:    .symtab73    Type:    SHT_SYMTAB74  - Name:    .strtab75    Type:    SHT_STRTAB76  - Name:    .shstrtab77    Type:    SHT_STRTAB78  - Name:    .text.foo79    Type:    SHT_PROGBITS80    Address: 0x20081 82## Check we don't add a symbol table when no "Symbols" key is specified.83 84# RUN: yaml2obj --docnum=3 %s -o %t385# RUN: llvm-readelf -S %t3 | FileCheck /dev/null --implicit-check-not=.symtab86 87--- !ELF88FileHeader:89  Class: ELFCLASS6490  Data:  ELFDATA2LSB91  Type:  ET_DYN92 93## Check we add a symbol table when "Symbols" key is specified.94 95# RUN: yaml2obj --docnum=4 %s -o %t496# RUN: llvm-readelf -S %t4 | FileCheck %s --check-prefix=SYMTAB97 98# SYMTAB: .symtab99 100--- !ELF101FileHeader:102  Class: ELFCLASS64103  Data:  ELFDATA2LSB104  Type:  ET_DYN105Symbols: []106