1 ## Check we are able to produce a valid SHT_LLVM_LINKER_OPTIONS
2 ## section from its description.
4 ## Check we can use "Options", "Size" and "Content" alone to describe the data.
6 # RUN: yaml2obj --docnum=1 %s -o %t1
7 # RUN: llvm-readobj --string-dump .linker-options1 --sections --section-data %t1 \
8 # RUN: | FileCheck %s --check-prefix=OPTIONS
10 # OPTIONS: Name: .linker-options1
11 # OPTIONS-NEXT: Type: SHT_LLVM_LINKER_OPTIONS
12 # OPTIONS-NEXT: Flags [
14 # OPTIONS-NEXT: Address: 0x0
15 # OPTIONS-NEXT: Offset: 0x40
16 # OPTIONS-NEXT: Size: 34
17 # OPTIONS-NEXT: Link: 0
18 # OPTIONS-NEXT: Info: 0
19 # OPTIONS-NEXT: AddressAlignment: 0
20 # OPTIONS-NEXT: EntrySize: 0
22 # OPTIONS: Name: .linker-options2
23 # OPTIONS-NEXT: Type: SHT_LLVM_LINKER_OPTIONS
24 # OPTIONS: SectionData (
25 # OPTIONS-NEXT: 0000: 00112233 |
28 # OPTIONS: Name: .linker-options3
29 # OPTIONS-NEXT: Type: SHT_LLVM_LINKER_OPTIONS
30 # OPTIONS: SectionData (
31 # OPTIONS-NEXT: 0000: 00000000 |
34 # OPTIONS: String dump of section '.linker-options1':
35 # OPTIONS-NEXT: [ 0] option 0
36 # OPTIONS-NEXT: [ 9] value 0
37 # OPTIONS-NEXT: [ 11] option 1
38 # OPTIONS-NEXT: [ 1a] value 1
46 - Name: .linker-options1
47 Type: SHT_LLVM_LINKER_OPTIONS
53 - Name: .linker-options2
54 Type: SHT_LLVM_LINKER_OPTIONS
56 - Name: .linker-options3
57 Type: SHT_LLVM_LINKER_OPTIONS
60 ## Check that "Value" and "Name" fields are mandatory when using "Options" key.
62 # RUN: not yaml2obj --docnum=2 %s 2>&1 | FileCheck %s --check-prefix=NOVALUE
63 # RUN: not yaml2obj --docnum=3 %s 2>&1 | FileCheck %s --check-prefix=NONAME
65 # NOVALUE: error: missing required key 'Value'
66 # NONAME: error: missing required key 'Name'
74 - Name: .linker-options
75 Type: SHT_LLVM_LINKER_OPTIONS
85 - Name: .linker-options
86 Type: SHT_LLVM_LINKER_OPTIONS
90 ## Check we can't use "Options" or "Size" keys together with the "Content" key.
92 # RUN: not yaml2obj %s -DOPTIONS="[]" -DCONTENT="''" --docnum=4 2>&1 | \
93 # RUN: FileCheck %s --check-prefix=TOGETHER
95 # RUN: not yaml2obj %s -DOPTIONS="[]" -DSIZE="0" --docnum=4 2>&1 | \
96 # RUN: FileCheck %s --check-prefix=TOGETHER
98 # TOGETHER: error: "Options" cannot be used with "Content" or "Size"
106 - Name: .linker-options
107 Type: SHT_LLVM_LINKER_OPTIONS
108 Options: [[OPTIONS=<none>]]
109 Content: [[CONTENT=<none>]]
110 Size: [[SIZE=<none>]]
112 ## Check we can omit "Options", "Content" and "Size" keys. This produces an empty section.
114 # RUN: yaml2obj %s --docnum=4 2>&1 -o %t5
115 # RUN: llvm-readelf --sections %t5 | FileCheck %s --check-prefix=NONE
117 # NONE: [Nr] Name Type Address Off Size
118 # NONE: [ 1] .linker-options LLVM_LINKER_OPTIONS 0000000000000000 000040 000000
120 ## Check we can use the "Content" key with the "Size" key when the size is greater
121 ## than or equal to the content size.
123 # RUN: not yaml2obj --docnum=4 -DSIZE=1 -DCONTENT="'0011'" %s 2>&1 | \
124 # RUN: FileCheck %s --check-prefix=CONTENT-SIZE-ERR
126 # CONTENT-SIZE-ERR: error: Section size must be greater than or equal to the content size
128 # RUN: yaml2obj --docnum=4 -DSIZE=2 -DCONTENT="'0011'" %s -o %t.cont.size.eq.o
129 # RUN: llvm-readobj --sections --section-data %t.cont.size.eq.o | \
130 # RUN: FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="0011"
132 # CHECK-CONTENT: Name: .linker-options (1)
133 # CHECK-CONTENT: SectionData (
134 # CHECK-CONTENT-NEXT: 0000: [[DATA]] |
135 # CHECK-CONTENT-NEXT: )
137 # RUN: yaml2obj --docnum=4 -DSIZE=3 -DCONTENT="'0011'" %s -o %t.cont.size.gr.o
138 # RUN: llvm-readobj --sections --section-data %t.cont.size.gr.o | \
139 # RUN: FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="001100"