1 ## Check how we produce SHT_DYNSYM sections.
3 ## Check we do not crash/assert when .dynsym is specified
4 ## explicitly, but .dynstr is not present.
5 ## Check we set the sh_link field to 0 for the .dynsym section in this case.
7 # RUN: yaml2obj %s -o %t1
8 # RUN: llvm-readelf --section-headers %t1 | FileCheck %s
10 # CHECK: Section Headers:
11 # CHECK-NEXT: [Nr] Name Type Address Off Size ES Flg Lk
12 # CHECK-NEXT: [ 0] NULL 0000000000000000 000000 000000 00 0 0
13 # CHECK-NEXT: [ 1] .dynsym DYNSYM 0000000000000000 000040 000018 18 A 0
23 Offset: [[OFFSET=<none>]]
25 ## Check we can use the "Offset" key to to set an arbitrary offset for the SHT_DYNSYM section.
27 # RUN: yaml2obj %s -DOFFSET=0x100 -o %t2
28 # RUN: llvm-readelf --section-headers %t2 | FileCheck %s --check-prefix=OFFSET
30 # OFFSET: Section Headers:
31 # OFFSET-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
32 # OFFSET-NEXT: [ 0] NULL 0000000000000000 000000 000000 00 0 0 0
33 # OFFSET-NEXT: [ 1] .dynsym DYNSYM 0000000000000000 000100 000018 18 A 0 1 0
35 ## Check we are able to set Link = 0 for the .dynsym section explicitly.
37 # RUN: yaml2obj %s --docnum=2 -DLINK=0 -o %t2
38 # RUN: llvm-readelf --section-headers %t2 | FileCheck %s --check-prefix=LINK-NULL
40 # LINK-NULL: [Nr] Name {{.*}} Flg Lk Inf
41 # LINK-NULL: [ 1] .dynsym {{.*}} A 0 1
57 ## Check that by default the .dynsym section will be linked to the .dynstr section,
58 ## when the latter one exists.
60 # RUN: yaml2obj %s --docnum=2 -o %t3
61 # RUN: llvm-readelf --section-headers %t3 | FileCheck %s --check-prefix=LINK-DEFAULT
63 # LINK-DEFAULT: [Nr] Name {{.*}} Flg Lk Inf
64 # LINK-DEFAULT: [ 1] .dynsym {{.*}} A 2 1
65 # LINK-DEFAULT: [ 2] .dynstr {{.*}} A 0 0
67 ## Even when the .dynstr section exists, we can explicitly link the .dynsym section
68 ## to another section.
70 # RUN: yaml2obj %s --docnum=2 -DLINK=3 -o %t4
71 # RUN: llvm-readelf --section-headers %t4 | FileCheck %s --check-prefix=LINK-FOO
73 # LINK-FOO: [Nr] Name {{.*}} Flg Lk Inf
74 # LINK-FOO: [ 1] .dynsym {{.*}} A 3 1
77 ## Check we can use a section name as a Link value for .dynsym.
79 # RUN: yaml2obj %s --docnum=2 -DLINK=.foo -o %t5
80 # RUN: llvm-readelf --section-headers %t5 | FileCheck %s --check-prefix=LINK-FOO