1 ## Check how yaml2obj produces SHT_LLVM_ADDRSIG sections.
3 ## Check we can describe SHT_LLVM_ADDRSIG using the "Symbols" tag. We can define
4 ## symbols either using names or indexes.
6 # RUN: yaml2obj --docnum=1 %s -o %t1
7 # RUN: llvm-readobj --sections --section-data %t1 | FileCheck %s --check-prefix=SYMBOLS
11 # SYMBOLS-NEXT: Name: .llvm_addrsig
12 # SYMBOLS-NEXT: Type: SHT_LLVM_ADDRSIG
13 # SYMBOLS-NEXT: Flags [
15 # SYMBOLS-NEXT: Address: 0x0
16 # SYMBOLS-NEXT: Offset: 0x40
17 # SYMBOLS-NEXT: Size: 4
18 # SYMBOLS-NEXT: Link: 2
19 # SYMBOLS-NEXT: Info: 0
20 # SYMBOLS-NEXT: AddressAlignment: 0
21 # SYMBOLS-NEXT: EntrySize: 0
22 # SYMBOLS-NEXT: SectionData (
23 # SYMBOLS-NEXT: 0000: 01020102
34 Type: SHT_LLVM_ADDRSIG
35 Symbols: [ foo, bar, 1, 2 ]
44 ## Check we report an error if an unknown symbol is referenced in the
45 ## SHT_LLVM_ADDRSIG section description.
47 # RUN: not yaml2obj --docnum=2 %s 2>&1 | FileCheck %s --check-prefix=SYMBOL-UNKNOWN
49 # SYMBOL-UNKNOWN: error: unknown symbol referenced: 'foo' by YAML section '.llvm_addrsig'
50 # SYMBOL-UNKNOWN: error: unknown symbol referenced: 'bar' by YAML section '.llvm_addrsig'
59 Type: SHT_LLVM_ADDRSIG
62 ## Check we can specify any arbitrary symbol indices.
64 # RUN: yaml2obj --docnum=3 %s -o %t3
65 # RUN: llvm-readobj --sections --section-data %t3 | FileCheck %s --check-prefix=SYMBOL-INDEX
67 # SYMBOL-INDEX: Type: SHT_LLVM_ADDRSIG
68 # SYMBOL-INDEX: SectionData (
69 # SYMBOL-INDEX-NEXT: 0000: 00FF01C4 E6888901 FFFFFFFF 0F
70 # SYMBOL-INDEX-NEXT: )
79 Type: SHT_LLVM_ADDRSIG
80 ## 0xFFFFFFFF is a maximum allowed index value.
81 Symbols: [ 0, 255, 0x11223344, 0xFFFFFFFF ]
83 ## Check that the maximum symbol index size is 32 bits.
85 # RUN: not yaml2obj --docnum=4 %s 2>&1 | FileCheck %s --check-prefix=SYMBOL-INDEX-OVERFLOW
87 # SYMBOL-INDEX-OVERFLOW: error: unknown symbol referenced: '0x1122334455' by YAML section '.llvm_addrsig'
96 Type: SHT_LLVM_ADDRSIG
97 Symbols: [ 0x1122334455 ]
99 ## Check we can use the "Content" tag to specify any data for SHT_LLVM_ADDRSIG sections.
101 # RUN: yaml2obj --docnum=5 %s -o %t5
102 # RUN: llvm-readobj --sections --section-data %t5 | FileCheck %s --check-prefix=CONTENT
104 # CONTENT: Type: SHT_LLVM_ADDRSIG
107 # CONTENT: SectionData (
108 # CONTENT-NEXT: 0000: 11223344 55
117 - Name: .llvm_addrsig
118 Type: SHT_LLVM_ADDRSIG
119 Content: "1122334455"
121 ## Check we emit an empty section if neither "Content", "Size" nor "Symbols" were set.
123 # RUN: yaml2obj --docnum=6 %s -o %t6
124 # RUN: llvm-readelf --sections %t6 | FileCheck %s --check-prefix=NO-TAGS
126 # NO-TAGS: [Nr] Name Type Address Off Size
127 # NO-TAGS: [ 1] .llvm_addrsig LLVM_ADDRSIG 0000000000000000 000040 000000
135 - Name: .llvm_addrsig
136 Type: SHT_LLVM_ADDRSIG
138 ## "Content" and "Symbols" cannot be used together to describe the SHT_LLVM_ADDRSIG section.
140 # RUN: not yaml2obj --docnum=7 %s 2>&1 | FileCheck %s --check-prefix=CONTENT-SYMBOLS
142 # CONTENT-SYMBOLS: "Symbols" cannot be used with "Content" or "Size"
150 - Name: .llvm_addrsig
151 Type: SHT_LLVM_ADDRSIG
155 ## Check we can set an arbitrary sh_link value for SHT_LLVM_ADDRSIG sections.
157 # RUN: yaml2obj --docnum=8 %s -o %t8
158 # RUN: llvm-readobj --sections %t8 | FileCheck %s --check-prefix=LINK
160 # LINK: Name: .llvm_addrsig
162 # LINK-SAME: 123{{$}}
170 - Name: .llvm_addrsig
171 Type: SHT_LLVM_ADDRSIG
175 ## Check we can use only "Size" to create a SHT_LLVM_ADDRSIG section.
177 # RUN: yaml2obj --docnum=9 %s -o %t9
178 # RUN: llvm-readobj --sections --section-data %t9 | FileCheck %s --check-prefix=SIZE
180 # SIZE: Name: .llvm_addrsig
183 # SIZE: SectionData (
184 # SIZE-NEXT: 0000: 00000000 00000000 00000000 00000000 |
185 # SIZE-NEXT: 0010: 00 |
194 - Name: .llvm_addrsig
195 Type: SHT_LLVM_ADDRSIG
198 ## Check we can use "Size" and "Content" together to create a SHT_LLVM_ADDRSIG section.
200 # RUN: yaml2obj --docnum=10 %s -o %t10
201 # RUN: llvm-readobj --sections --section-data %t10 | FileCheck %s --check-prefix=SIZE-CONTENT
203 # SIZE-CONTENT: Name: .llvm_addrsig_sizegr
204 # SIZE-CONTENT: Size:
205 # SIZE-CONTENT-SAME: 5
206 # SIZE-CONTENT: SectionData (
207 # SIZE-CONTENT-NEXT: 0000: 11223300 00 |
208 # SIZE-CONTENT-NEXT: )
210 # SIZE-CONTENT: Name: .llvm_addrsig_sizeeq
211 # SIZE-CONTENT: Size:
212 # SIZE-CONTENT-SAME: 3
213 # SIZE-CONTENT: SectionData (
214 # SIZE-CONTENT-NEXT: 0000: 112233 |
215 # SIZE-CONTENT-NEXT: )
223 - Name: .llvm_addrsig_sizegr
224 Type: SHT_LLVM_ADDRSIG
227 - Name: .llvm_addrsig_sizeeq
228 Type: SHT_LLVM_ADDRSIG
232 ## Check that when "Size" and "Content" are used together, the size
233 ## must be greater than or equal to the content size.
235 # RUN: not yaml2obj --docnum=11 %s 2>&1 | FileCheck %s --check-prefix=SIZE-CONTENT-ERR
237 # SIZE-CONTENT-ERR: error: Section size must be greater than or equal to the content size
245 - Name: .llvm_addrsig
246 Type: SHT_LLVM_ADDRSIG
250 ## Check we can't use "Size" and "Symbols" tags together.
252 # RUN: not yaml2obj --docnum=12 %s 2>&1 | FileCheck %s --check-prefix=CONTENT-SYMBOLS
260 - Name: .llvm_addrsig
261 Type: SHT_LLVM_ADDRSIG