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
29 ## Specifying both `Size` and symbols at the same time is not allowed for .dynsym.
31 # RUN: not yaml2obj --docnum=2 %s 2>&1 | FileCheck %s --implicit-check-not=error --check-prefix=CASE2
32 # RUN: not yaml2obj --docnum=3 %s 2>&1 | FileCheck %s --implicit-check-not=error --check-prefix=CASE2
34 # CASE2: yaml2obj: error: cannot specify both `Size` and `DynamicSymbols` for symbol table section '.dynsym'
66 ## Specifying both `Content` and symbols at the same time is not allowed for .dynsym.
68 # RUN: not yaml2obj --docnum=4 %s 2>&1 | FileCheck %s --implicit-check-not=error --check-prefix=CASE3
69 # RUN: not yaml2obj --docnum=5 %s 2>&1 | FileCheck %s --implicit-check-not=error --check-prefix=CASE3
71 # CASE3: yaml2obj: error: cannot specify both `Content` and `DynamicSymbols` for symbol table section '.dynsym'
103 ## Check we can use just `Content` to emit custom data in the symbol table section.
104 # RUN: yaml2obj --docnum=6 %s -o %t4
105 # RUN: llvm-readobj --section-data -S %t4 | FileCheck %s --check-prefix=CASE4
107 # CASE4: Name: .dynsym
108 # CASE4-NEXT: Type: SHT_DYNSYM
109 # CASE4-NEXT: Flags [
110 # CASE4-NEXT: SHF_ALLOC
112 # CASE4-NEXT: Address: 0x0
113 # CASE4-NEXT: Offset: 0x40
114 # CASE4-NEXT: Size: 2
115 # CASE4-NEXT: Link: 0
116 # CASE4-NEXT: Info: 1
117 # CASE4-NEXT: AddressAlignment: 0
118 # CASE4-NEXT: EntrySize: 24
119 # CASE4-NEXT: SectionData (
120 # CASE4-NEXT: 0000: 0123
133 ## Check we can use just `Size` to emit custom data filled with zeroes
134 ## in the symbol table section.
135 # RUN: yaml2obj --docnum=7 %s -o %t5
136 # RUN: llvm-readobj --section-data -S %t5 | FileCheck %s --check-prefix=CASE5
138 # CASE5: Name: .dynsym
139 # CASE5-NEXT: Type: SHT_DYNSYM
140 # CASE5-NEXT: Flags [
141 # CASE5-NEXT: SHF_ALLOC
143 # CASE5-NEXT: Address: 0x0
144 # CASE5-NEXT: Offset: 0x40
145 # CASE5-NEXT: Size: 5
146 # CASE5-NEXT: Link: 0
147 # CASE5-NEXT: Info: 1
148 # CASE5-NEXT: AddressAlignment: 0
149 # CASE5-NEXT: EntrySize: 24
150 # CASE5-NEXT: SectionData (
151 # CASE5-NEXT: 0000: 00000000 00
164 ## Check we can specify both `Size` and `Content` when size is greater
165 ## than content size. In this case zeroes are added as padding
166 ## after after the specified content.
168 # RUN: yaml2obj --docnum=8 %s -o %t6
169 # RUN: llvm-readobj %t6 --section-data -S | FileCheck %s --check-prefix=CASE6
171 # CASE6: Name: .dynsym
172 # CASE6-NEXT: Type: SHT_DYNSYM
173 # CASE6-NEXT: Flags [
174 # CASE6-NEXT: SHF_ALLOC
176 # CASE6-NEXT: Address: 0x0
177 # CASE6-NEXT: Offset: 0x40
178 # CASE6-NEXT: Size: 4
179 # CASE6-NEXT: Link: 0
180 # CASE6-NEXT: Info: 1
181 # CASE6-NEXT: AddressAlignment: 0
182 # CASE6-NEXT: EntrySize: 24
183 # CASE6-NEXT: SectionData (
184 # CASE6-NEXT: 0000: 01230000
198 ## Check we can specify both `Size` and `Content` when size is
199 ## equal to content size.
201 # RUN: yaml2obj --docnum=9 %s -o %t7
202 # RUN: llvm-readobj --section-data -S %t7 | FileCheck %s --check-prefix=CASE7
204 # CASE7: Name: .dynsym
205 # CASE7-NEXT: Type: SHT_DYNSYM
206 # CASE7-NEXT: Flags [
207 # CASE7-NEXT: SHF_ALLOC
209 # CASE7-NEXT: Address: 0x0
210 # CASE7-NEXT: Offset: 0x40
211 # CASE7-NEXT: Size: 2
212 # CASE7-NEXT: Link: 0
213 # CASE7-NEXT: Info: 1
214 # CASE7-NEXT: AddressAlignment: 0
215 # CASE7-NEXT: EntrySize: 24
216 # CASE7-NEXT: SectionData (
217 # CASE7-NEXT: 0000: 0123