1 ## For implicit symbol table sections, `Size` and/or `Content` fields can also
2 ## be specified in YAML. Here we test the behavior in different cases.
4 ## When no `Size` or `Content` is specified for a symbol table section,
5 ## yaml2obj writes the default content.
7 # RUN: yaml2obj --docnum=1 %s -o %t1
8 # RUN: llvm-readelf %t1 -s | FileCheck %s --check-prefix=CASE1
10 # CASE1: Symbol table '.symtab' contains 2 entries:
11 # CASE1-NEXT: Num: Value Size Type Bind Vis Ndx Name
12 # CASE1-NEXT: 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
13 # CASE1-NEXT: 1: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND foo
27 ## Specifying both `Size` and symbols at the same time is not allowed.
28 # RUN: not yaml2obj --docnum=2 %s -o %t2 2>&1 | FileCheck %s --check-prefix=CASE2
29 # RUN: not yaml2obj --docnum=3 %s -o %t2 2>&1 | FileCheck %s --check-prefix=CASE2
31 # CASE2: error: cannot specify both `Size` and `Symbols` for symbol table section '.symtab'
56 ## Specifying both `Content` and symbols at the same time is not allowed.
57 # RUN: not yaml2obj --docnum=4 %s -o %t3 2>&1 | FileCheck %s --check-prefix=CASE3
58 # RUN: not yaml2obj --docnum=5 %s -o %t3 2>&1 | FileCheck %s --check-prefix=CASE3
60 # CASE3: error: cannot specify both `Content` and `Symbols` for symbol table section '.symtab'
85 ## Check we can use just `Content` to emit custom data in the symbol table section.
86 # RUN: yaml2obj --docnum=6 %s -o %t4
87 # RUN: llvm-readobj --section-data -S %t4 | FileCheck %s --check-prefix=CASE4
89 # CASE4: Name: .symtab
90 # CASE4-NEXT: Type: SHT_SYMTAB
91 # CASE4-NEXT: Flags [ (0x0)
93 # CASE4-NEXT: Address: 0x0
94 # CASE4-NEXT: Offset: 0x40
98 # CASE4-NEXT: AddressAlignment: 0
99 # CASE4-NEXT: EntrySize: 24
100 # CASE4-NEXT: SectionData (
101 # CASE4-NEXT: 0000: 0123
114 ## Check we can use just `Size` to emit custom data filled with zeroes
115 ## in the symbol table section.
116 # RUN: yaml2obj --docnum=7 %s -o %t5
117 # RUN: llvm-readobj --section-data -S %t5 | FileCheck %s --check-prefix=CASE5
119 # CASE5: Name: .symtab (19)
120 # CASE5-NEXT: Type: SHT_SYMTAB (0x2)
121 # CASE5-NEXT: Flags [ (0x0)
123 # CASE5-NEXT: Address: 0x0
124 # CASE5-NEXT: Offset: 0x40
125 # CASE5-NEXT: Size: 5
126 # CASE5-NEXT: Link: 2
127 # CASE5-NEXT: Info: 1
128 # CASE5-NEXT: AddressAlignment: 0
129 # CASE5-NEXT: EntrySize: 24
130 # CASE5-NEXT: SectionData (
131 # CASE5-NEXT: 0000: 00000000 00
144 ## Check we can specify both `Size` and `Content` when size is greater
145 ## than content size. In this case zeroes are added as padding
146 ## after the specified content.
148 # RUN: yaml2obj --docnum=8 %s -o %t6
149 # RUN: llvm-readobj %t6 --section-data -S | FileCheck %s --check-prefix=CASE6
151 # CASE6: Name: .symtab
152 # CASE6-NEXT: Type: SHT_SYMTAB
153 # CASE6-NEXT: Flags [
155 # CASE6-NEXT: Address: 0x0
156 # CASE6-NEXT: Offset: 0x40
157 # CASE6-NEXT: Size: 4
158 # CASE6-NEXT: Link: 2
159 # CASE6-NEXT: Info: 1
160 # CASE6-NEXT: AddressAlignment: 0
161 # CASE6-NEXT: EntrySize: 24
162 # CASE6-NEXT: SectionData (
163 # CASE6-NEXT: 0000: 01230000
177 ## Check we can specify both `Size` and `Content` when size is
178 ## equal to content size.
180 # RUN: yaml2obj --docnum=9 %s -o %t7
181 # RUN: llvm-readobj --section-data -S %t7 | FileCheck %s --check-prefix=CASE7
183 # CASE7: Name: .symtab
184 # CASE7-NEXT: Type: SHT_SYMTAB
185 # CASE7-NEXT: Flags [
187 # CASE7-NEXT: Address: 0x0
188 # CASE7-NEXT: Offset: 0x40
189 # CASE7-NEXT: Size: 2
190 # CASE7-NEXT: Link: 2
191 # CASE7-NEXT: Info: 1
192 # CASE7-NEXT: AddressAlignment: 0
193 # CASE7-NEXT: EntrySize: 24
194 # CASE7-NEXT: SectionData (
195 # CASE7-NEXT: 0000: 0123