brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · 294b91e Raw
81 lines · yaml
1## Check how we produce SHT_DYNSYM sections.2 3## Check we do not crash/assert when .dynsym is specified4## explicitly, but .dynstr is not present.5## Check we set the sh_link field to 0 for the .dynsym section in this case.6 7# RUN: yaml2obj %s -o %t18# RUN: llvm-readelf --section-headers %t1 | FileCheck %s9 10# CHECK:      Section Headers:11# CHECK-NEXT:  [Nr] Name    Type   Address          Off    Size   ES Flg Lk12# CHECK-NEXT:  [ 0]         NULL   0000000000000000 000000 000000 00 0   013# CHECK-NEXT:  [ 1] .dynsym DYNSYM 0000000000000000 000040 000018 18 A   014 15--- !ELF16FileHeader:17  Class: ELFCLASS6418  Data:  ELFDATA2LSB19  Type:  ET_DYN20Sections:21  - Name:   .dynsym22    Type:   SHT_DYNSYM23    Offset: [[OFFSET=<none>]]24 25## Check we can use the "Offset" key to to set an arbitrary offset for the SHT_DYNSYM section.26 27# RUN: yaml2obj %s -DOFFSET=0x100 -o %t228# RUN: llvm-readelf --section-headers %t2 | FileCheck %s --check-prefix=OFFSET29 30# OFFSET:      Section Headers:31# OFFSET-NEXT:   [Nr] Name    Type   Address          Off    Size   ES Flg Lk Inf Al32# OFFSET-NEXT:   [ 0]         NULL   0000000000000000 000000 000000 00     0   0  033# OFFSET-NEXT:   [ 1] .dynsym DYNSYM 0000000000000000 000100 000018 18   A 0   1  034 35## Check we are able to set Link = 0 for the .dynsym section explicitly.36 37# RUN: yaml2obj %s --docnum=2 -DLINK=0 -o %t238# RUN: llvm-readelf --section-headers %t2 | FileCheck %s --check-prefix=LINK-NULL39 40# LINK-NULL: [Nr] Name    {{.*}} Flg Lk Inf41# LINK-NULL: [ 1] .dynsym {{.*}}   A 0   142 43--- !ELF44FileHeader:45  Class: ELFCLASS6446  Data:  ELFDATA2LSB47  Type:  ET_DYN48Sections:49  - Name: .dynsym50    Type: SHT_DYNSYM51    Link: [[LINK=<none>]]52  - Name: .dynstr53    Type: SHT_STRTAB54  - Name: .foo55    Type: SHT_PROGBITS56 57## Check that by default the .dynsym section will be linked to the .dynstr section,58## when the latter one exists.59 60# RUN: yaml2obj %s --docnum=2 -o %t361# RUN: llvm-readelf --section-headers %t3 | FileCheck %s --check-prefix=LINK-DEFAULT62 63# LINK-DEFAULT: [Nr] Name    {{.*}} Flg Lk Inf64# LINK-DEFAULT: [ 1] .dynsym {{.*}}   A 2   165# LINK-DEFAULT: [ 2] .dynstr {{.*}}   A 0   066 67## Even when the .dynstr section exists, we can explicitly link the .dynsym section68## to another section.69 70# RUN: yaml2obj %s --docnum=2 -DLINK=3 -o %t471# RUN: llvm-readelf --section-headers %t4 | FileCheck %s --check-prefix=LINK-FOO72 73# LINK-FOO: [Nr] Name     {{.*}} Flg Lk Inf74# LINK-FOO: [ 1] .dynsym  {{.*}}   A 3   175# LINK-FOO: [ 3] .foo76 77## Check we can use a section name as a Link value for .dynsym.78 79# RUN: yaml2obj %s --docnum=2 -DLINK=.foo -o %t580# RUN: llvm-readelf --section-headers %t5 | FileCheck %s --check-prefix=LINK-FOO81