1 ## For implicit dynamic symbol table sections, `Size` and/or `Content`
2 ## fields can also be specified in YAML. Here we test the behavior in
5 ## When no `Size` or `Content` is specified for a dynamic symbol table section,
6 ## yaml2obj writes the default content.
8 # RUN: yaml2obj --docnum=1 %s -o %t1
9 # RUN: llvm-readelf %t1 --dyn-symbols | FileCheck %s --check-prefix=CASE1
11 # CASE1: Symbol table '.dynsym' contains 2 entries:
12 # CASE1-NEXT: Num: Value Size Type Bind Vis Ndx Name
13 # CASE1-NEXT: 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
14 # CASE1-NEXT: 1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND foo
30 ## Specifying both `Size` and symbols at the same time is not allowed.
31 # RUN: not yaml2obj --docnum=2 %s -o %t2 2>&1 | FileCheck %s --check-prefix=CASE2
33 # CASE2: error: Cannot specify both `Size` and `DynamicSymbols` for symbol table section '.dynsym'.
49 ## Specifying both `Content` and symbols at the same time is not allowed.
50 # RUN: not yaml2obj --docnum=3 %s -o %t3 2>&1 | FileCheck %s --check-prefix=CASE3
52 # CASE3: error: Cannot specify both `Content` and `DynamicSymbols` for symbol table section '.dynsym'.
68 ## Check we can use just `Content` to emit custom data in the symbol table section.
69 # RUN: yaml2obj --docnum=4 %s -o %t4
70 # RUN: llvm-readobj --section-data -S %t4 | FileCheck %s --check-prefix=CASE4
72 # CASE4: Name: .dynsym
73 # CASE4-NEXT: Type: SHT_DYNSYM
75 # CASE4-NEXT: SHF_ALLOC
77 # CASE4-NEXT: Address: 0x0
78 # CASE4-NEXT: Offset: 0x180
82 # CASE4-NEXT: AddressAlignment: 0
83 # CASE4-NEXT: EntrySize: 24
84 # CASE4-NEXT: SectionData (
85 # CASE4-NEXT: 0000: 0123
99 ## Check we can use just `Size` to emit custom data filled with zeroes
100 ## in the symbol table section.
101 # RUN: yaml2obj --docnum=5 %s -o %t5
102 # RUN: llvm-readobj --section-data -S %t5 | FileCheck %s --check-prefix=CASE5
104 # CASE5: Name: .dynsym
105 # CASE5-NEXT: Type: SHT_DYNSYM
106 # CASE5-NEXT: Flags [
107 # CASE5-NEXT: SHF_ALLOC
109 # CASE5-NEXT: Address: 0x0
110 # CASE5-NEXT: Offset: 0x180
111 # CASE5-NEXT: Size: 5
112 # CASE5-NEXT: Link: 0
113 # CASE5-NEXT: Info: 1
114 # CASE5-NEXT: AddressAlignment: 0
115 # CASE5-NEXT: EntrySize: 24
116 # CASE5-NEXT: SectionData (
117 # CASE5-NEXT: 0000: 00000000 00
131 ## Check we can specify both `Size` and `Content` when size is greater
132 ## than content size. In this case zeroes are added as padding
133 ## after after the specified content.
135 # RUN: yaml2obj --docnum=6 %s -o %t6
136 # RUN: llvm-readobj %t6 --section-data -S | FileCheck %s --check-prefix=CASE6
138 # CASE6: Name: .dynsym
139 # CASE6-NEXT: Type: SHT_DYNSYM
140 # CASE6-NEXT: Flags [
141 # CASE6-NEXT: SHF_ALLOC
143 # CASE6-NEXT: Address: 0x0
144 # CASE6-NEXT: Offset: 0x180
145 # CASE6-NEXT: Size: 4
146 # CASE6-NEXT: Link: 0
147 # CASE6-NEXT: Info: 1
148 # CASE6-NEXT: AddressAlignment: 0
149 # CASE6-NEXT: EntrySize: 24
150 # CASE6-NEXT: SectionData (
151 # CASE6-NEXT: 0000: 01230000
166 ## Check we can specify both `Size` and `Content` when size is
167 ## equal to content size.
169 # RUN: yaml2obj --docnum=7 %s -o %t7
170 # RUN: llvm-readobj --section-data -S %t7 | FileCheck %s --check-prefix=CASE7
172 # CASE7: Name: .dynsym
173 # CASE7-NEXT: Type: SHT_DYNSYM
174 # CASE7-NEXT: Flags [
175 # CASE7-NEXT: SHF_ALLOC
177 # CASE7-NEXT: Address: 0x0
178 # CASE7-NEXT: Offset: 0x180
179 # CASE7-NEXT: Size: 2
180 # CASE7-NEXT: Link: 0
181 # CASE7-NEXT: Info: 1
182 # CASE7-NEXT: AddressAlignment: 0
183 # CASE7-NEXT: EntrySize: 24
184 # CASE7-NEXT: SectionData (
185 # CASE7-NEXT: 0000: 0123