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 for .dynsym.
32 # RUN: not yaml2obj --docnum=2 %s 2>&1 | FileCheck %s --implicit-check-not=error --check-prefix=CASE2
34 # CASE2: error: cannot specify both `Size` and `DynamicSymbols` for symbol table section '.dynsym'
35 # CASE2: error: yaml2obj failed
54 ## Specifying both `Content` and symbols at the same time is not allowed for .dynsym.
56 # RUN: not yaml2obj --docnum=3 %s 2>&1 | FileCheck %s --implicit-check-not=error --check-prefix=CASE3
58 # CASE3: error: cannot specify both `Content` and `DynamicSymbols` for symbol table section '.dynsym'
59 # CASE3: error: yaml2obj failed
78 ## Check we can use just `Content` to emit custom data in the symbol table section.
79 # RUN: yaml2obj --docnum=4 %s -o %t4
80 # RUN: llvm-readobj --section-data -S %t4 | FileCheck %s --check-prefix=CASE4
82 # CASE4: Name: .dynsym
83 # CASE4-NEXT: Type: SHT_DYNSYM
85 # CASE4-NEXT: SHF_ALLOC
87 # CASE4-NEXT: Address: 0x0
88 # CASE4-NEXT: Offset: 0x40
92 # CASE4-NEXT: AddressAlignment: 0
93 # CASE4-NEXT: EntrySize: 24
94 # CASE4-NEXT: SectionData (
95 # CASE4-NEXT: 0000: 0123
109 ## Check we can use just `Size` to emit custom data filled with zeroes
110 ## in the symbol table section.
111 # RUN: yaml2obj --docnum=5 %s -o %t5
112 # RUN: llvm-readobj --section-data -S %t5 | FileCheck %s --check-prefix=CASE5
114 # CASE5: Name: .dynsym
115 # CASE5-NEXT: Type: SHT_DYNSYM
116 # CASE5-NEXT: Flags [
117 # CASE5-NEXT: SHF_ALLOC
119 # CASE5-NEXT: Address: 0x0
120 # CASE5-NEXT: Offset: 0x40
121 # CASE5-NEXT: Size: 5
122 # CASE5-NEXT: Link: 0
123 # CASE5-NEXT: Info: 1
124 # CASE5-NEXT: AddressAlignment: 0
125 # CASE5-NEXT: EntrySize: 24
126 # CASE5-NEXT: SectionData (
127 # CASE5-NEXT: 0000: 00000000 00
141 ## Check we can specify both `Size` and `Content` when size is greater
142 ## than content size. In this case zeroes are added as padding
143 ## after after the specified content.
145 # RUN: yaml2obj --docnum=6 %s -o %t6
146 # RUN: llvm-readobj %t6 --section-data -S | FileCheck %s --check-prefix=CASE6
148 # CASE6: Name: .dynsym
149 # CASE6-NEXT: Type: SHT_DYNSYM
150 # CASE6-NEXT: Flags [
151 # CASE6-NEXT: SHF_ALLOC
153 # CASE6-NEXT: Address: 0x0
154 # CASE6-NEXT: Offset: 0x40
155 # CASE6-NEXT: Size: 4
156 # CASE6-NEXT: Link: 0
157 # CASE6-NEXT: Info: 1
158 # CASE6-NEXT: AddressAlignment: 0
159 # CASE6-NEXT: EntrySize: 24
160 # CASE6-NEXT: SectionData (
161 # CASE6-NEXT: 0000: 01230000
176 ## Check we can specify both `Size` and `Content` when size is
177 ## equal to content size.
179 # RUN: yaml2obj --docnum=7 %s -o %t7
180 # RUN: llvm-readobj --section-data -S %t7 | FileCheck %s --check-prefix=CASE7
182 # CASE7: Name: .dynsym
183 # CASE7-NEXT: Type: SHT_DYNSYM
184 # CASE7-NEXT: Flags [
185 # CASE7-NEXT: SHF_ALLOC
187 # CASE7-NEXT: Address: 0x0
188 # CASE7-NEXT: Offset: 0x40
189 # CASE7-NEXT: Size: 2
190 # CASE7-NEXT: Link: 0
191 # CASE7-NEXT: Info: 1
192 # CASE7-NEXT: AddressAlignment: 0
193 # CASE7-NEXT: EntrySize: 24
194 # CASE7-NEXT: SectionData (
195 # CASE7-NEXT: 0000: 0123