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
28 ## Specifying both `Size` and symbols at the same time is not allowed.
29 # RUN: not yaml2obj --docnum=2 %s -o %t2 2>&1 | FileCheck %s --check-prefix=CASE2
31 # CASE2: error: cannot specify both `Size` and `Symbols` for symbol table section '.symtab'
46 ## Specifying both `Content` and symbols at the same time is not allowed.
47 # RUN: not yaml2obj --docnum=3 %s -o %t3 2>&1 | FileCheck %s --check-prefix=CASE3
49 # CASE3: error: cannot specify both `Content` and `Symbols` for symbol table section '.symtab'
64 ## Check we can use just `Content` to emit custom data in the symbol table section.
65 # RUN: yaml2obj --docnum=4 %s -o %t4
66 # RUN: llvm-readobj --section-data -S %t4 | FileCheck %s --check-prefix=CASE4
68 # CASE4: Name: .symtab
69 # CASE4-NEXT: Type: SHT_SYMTAB
70 # CASE4-NEXT: Flags [ (0x0)
72 # CASE4-NEXT: Address: 0x0
73 # CASE4-NEXT: Offset: 0x40
77 # CASE4-NEXT: AddressAlignment: 0
78 # CASE4-NEXT: EntrySize: 24
79 # CASE4-NEXT: SectionData (
80 # CASE4-NEXT: 0000: 0123
94 ## Check we can use just `Size` to emit custom data filled with zeroes
95 ## in the symbol table section.
96 # RUN: yaml2obj --docnum=5 %s -o %t5
97 # RUN: llvm-readobj --section-data -S %t5 | FileCheck %s --check-prefix=CASE5
99 # CASE5: Name: .symtab (19)
100 # CASE5-NEXT: Type: SHT_SYMTAB (0x2)
101 # CASE5-NEXT: Flags [ (0x0)
103 # CASE5-NEXT: Address: 0x0
104 # CASE5-NEXT: Offset: 0x40
105 # CASE5-NEXT: Size: 5
106 # CASE5-NEXT: Link: 2
107 # CASE5-NEXT: Info: 1
108 # CASE5-NEXT: AddressAlignment: 0
109 # CASE5-NEXT: EntrySize: 24
110 # CASE5-NEXT: SectionData (
111 # CASE5-NEXT: 0000: 00000000 00
125 ## Check we can specify both `Size` and `Content` when size is greater
126 ## than content size. In this case zeroes are added as padding
127 ## after the specified content.
129 # RUN: yaml2obj --docnum=6 %s -o %t6
130 # RUN: llvm-readobj %t6 --section-data -S | FileCheck %s --check-prefix=CASE6
132 # CASE6: Name: .symtab
133 # CASE6-NEXT: Type: SHT_SYMTAB
134 # CASE6-NEXT: Flags [
136 # CASE6-NEXT: Address: 0x0
137 # CASE6-NEXT: Offset: 0x40
138 # CASE6-NEXT: Size: 4
139 # CASE6-NEXT: Link: 2
140 # CASE6-NEXT: Info: 1
141 # CASE6-NEXT: AddressAlignment: 0
142 # CASE6-NEXT: EntrySize: 24
143 # CASE6-NEXT: SectionData (
144 # CASE6-NEXT: 0000: 01230000
159 ## Check we can specify both `Size` and `Content` when size is
160 ## equal to content size.
162 # RUN: yaml2obj --docnum=7 %s -o %t7
163 # RUN: llvm-readobj --section-data -S %t7 | FileCheck %s --check-prefix=CASE7
165 # CASE7: Name: .symtab
166 # CASE7-NEXT: Type: SHT_SYMTAB
167 # CASE7-NEXT: Flags [
169 # CASE7-NEXT: Address: 0x0
170 # CASE7-NEXT: Offset: 0x40
171 # CASE7-NEXT: Size: 2
172 # CASE7-NEXT: Link: 2
173 # CASE7-NEXT: Info: 1
174 # CASE7-NEXT: AddressAlignment: 0
175 # CASE7-NEXT: EntrySize: 24
176 # CASE7-NEXT: SectionData (
177 # CASE7-NEXT: 0000: 0123