1 ## Test that yaml2obj automatically sets fields of the auxiliary file header
2 ## if not set explicitly.
4 ## Case1: if text/data/bss/tdata/tbss/loader sections are set and corresponding
5 ## fields in the aux header are omitted, we use the derived values of
6 ## those sections to set corresponding fields.
7 # RUN: yaml2obj %s --docnum=1 -o %t1
8 # RUN: llvm-readobj --auxiliary-header %t1 | FileCheck %s --check-prefix=CASE1
10 # CASE1: AuxiliaryHeader {
11 # CASE1-NEXT: Magic: 0x10B
12 # CASE1-NEXT: Version: 0x1
13 # CASE1-NEXT: Size of .text section: 0x5
14 # CASE1-NEXT: Size of .data section: 0x5
15 # CASE1-NEXT: Size of .bss section: 0x5
16 # CASE1-NEXT: Entry point address: 0x0
17 # CASE1-NEXT: .text section start address: 0x0
18 # CASE1-NEXT: .data section start address: 0x0
19 # CASE1-NEXT: TOC anchor address: 0x0
20 # CASE1-NEXT: Section number of entryPoint: 0
21 # CASE1-NEXT: Section number of .text: 2
22 # CASE1-NEXT: Section number of .data: 4
23 # CASE1-NEXT: Section number of TOC: 0
24 # CASE1-NEXT: Section number of loader data: 12
25 # CASE1-NEXT: Section number of .bss: 6
26 # CASE1-NEXT: Maxium alignment of .text: 0x0
27 # CASE1-NEXT: Maxium alignment of .data: 0x0
28 # CASE1-NEXT: Module type: 0x0
29 # CASE1-NEXT: CPU type of objects: 0x0
30 # CASE1-NEXT: (Reserved): 0x0
31 # CASE1-NEXT: Maximum stack size: 0x0
32 # CASE1-NEXT: Maximum data size: 0x0
33 # CASE1-NEXT: Reserved for debugger: 0x0
34 # CASE1-NEXT: Text page size: 0x0
35 # CASE1-NEXT: Data page size: 0x0
36 # CASE1-NEXT: Stack page size: 0x0
37 # CASE1-NEXT: Flag: 0x0
38 # CASE1-NEXT: Alignment of thread-local storage: 0x0
39 # CASE1-NEXT: Section number for .tdata: 8
40 # CASE1-NEXT: Section number for .tbss: 10
45 MagicNumber: [[MAGIC=0x1DF]]
51 ## Set two sections with different contents for a given type to
52 ## demonstrate that the values in the aux header depend on the first one.
53 - Flags: [ STYP_TEXT ]
54 SectionData: "1234000000"
55 - Flags: [ STYP_TEXT ]
57 - Flags: [ STYP_DATA ]
58 SectionData: "1234000000"
59 - Flags: [ STYP_DATA ]
62 SectionData: "1234000000"
65 - Flags: [ STYP_TDATA ]
66 SectionData: "1234000000"
67 - Flags: [ STYP_TDATA ]
69 - Flags: [ STYP_TBSS ]
70 SectionData: "1234000000"
71 - Flags: [ STYP_TBSS ]
73 - Flags: [ STYP_LOADER ]
74 SectionData: "1234000000"
75 - Flags: [ STYP_LOADER ]
78 ## Case2: same as case1, except producing 64-bit output.
79 # RUN: yaml2obj %s --docnum=1 -DMAGIC=0x1F7 -o %t2
80 # RUN: llvm-readobj --auxiliary-header %t2 | FileCheck %s --check-prefix=CASE2
82 # CASE2: AuxiliaryHeader {
83 # CASE2-NEXT: Magic: 0x10B
84 # CASE2-NEXT: Version: 0x1
85 # CASE2-NEXT: Reserved for debugger: 0x0
86 # CASE2-NEXT: .text section start address: 0x0
87 # CASE2-NEXT: .data section start address: 0x0
88 # CASE2-NEXT: TOC anchor address: 0x0
89 # CASE2-NEXT: Section number of entryPoint: 0
90 # CASE2-NEXT: Section number of .text: 2
91 # CASE2-NEXT: Section number of .data: 4
92 # CASE2-NEXT: Section number of TOC: 0
93 # CASE2-NEXT: Section number of loader data: 12
94 # CASE2-NEXT: Section number of .bss: 6
95 # CASE2-NEXT: Maxium alignment of .text: 0x0
96 # CASE2-NEXT: Maxium alignment of .data: 0x0
97 # CASE2-NEXT: Module type: 0x0
98 # CASE2-NEXT: CPU type of objects: 0x0
99 # CASE2-NEXT: (Reserved): 0x0
100 # CASE2-NEXT: Text page size: 0x0
101 # CASE2-NEXT: Data page size: 0x0
102 # CASE2-NEXT: Stack page size: 0x0
103 # CASE2-NEXT: Flag: 0x80
104 # CASE2-NEXT: Alignment of thread-local storage: 0x0
105 # CASE2-NEXT: Size of .text section: 0x5
106 # CASE2-NEXT: Size of .data section: 0x5
107 # CASE2-NEXT: Size of .bss section: 0x5
108 # CASE2-NEXT: Entry point address: 0x0
109 # CASE2-NEXT: Maximum stack size: 0x0
110 # CASE2-NEXT: Maximum data size: 0x0
111 # CASE2-NEXT: Section number for .tdata: 8
112 # CASE2-NEXT: Section number for .tbss: 10
113 # CASE2-NEXT: Additional flags 64-bit XCOFF: 0x8000
116 ## Case3: if all fields in the aux header are omitted and text/data/bss/tdata/tbss/loader
117 ## sections are not set, we set the fields using default values.
118 # RUN: yaml2obj %s --docnum=2 -o %t3
119 # RUN: llvm-readobj --auxiliary-header %t3 | FileCheck %s --check-prefix=CASE3
121 # CASE3: AuxiliaryHeader {
122 # CASE3-NEXT: Magic: 0x1
123 # CASE3-NEXT: Version: 0x1
124 # CASE3-NEXT: Size of .text section: 0x0
125 # CASE3-NEXT: Size of .data section: 0x0
126 # CASE3-NEXT: Size of .bss section: 0x0
127 # CASE3-NEXT: Entry point address: 0x0
128 # CASE3-NEXT: .text section start address: 0x0
129 # CASE3-NEXT: .data section start address: 0x0
130 # CASE3-NEXT: TOC anchor address: 0x0
131 # CASE3-NEXT: Section number of entryPoint: 0
132 # CASE3-NEXT: Section number of .text: 0
133 # CASE3-NEXT: Section number of .data: 0
134 # CASE3-NEXT: Section number of TOC: 0
135 # CASE3-NEXT: Section number of loader data: 0
136 # CASE3-NEXT: Section number of .bss: 0
137 # CASE3-NEXT: Maxium alignment of .text: 0x0
138 # CASE3-NEXT: Maxium alignment of .data: 0x0
139 # CASE3-NEXT: Module type: 0x0
140 # CASE3-NEXT: CPU type of objects: 0x0
141 # CASE3-NEXT: (Reserved): 0x0
142 # CASE3-NEXT: Maximum stack size: 0x0
143 # CASE3-NEXT: Maximum data size: 0x0
144 # CASE3-NEXT: Reserved for debugger: 0x0
145 # CASE3-NEXT: Text page size: 0x0
146 # CASE3-NEXT: Data page size: 0x0
147 # CASE3-NEXT: Stack page size: 0x0
148 # CASE3-NEXT: Flag: 0x0
149 # CASE3-NEXT: Alignment of thread-local storage: 0x0
150 # CASE3-NEXT: Section number for .tdata: 0
151 # CASE3-NEXT: Section number for .tbss: 0
156 MagicNumber: [[MAGIC=0x1DF]]
159 ## Case4: same as case3, except producing 64-bit output.
160 # RUN: yaml2obj %s --docnum=2 -DMAGIC=0x1F7 -o %t4
161 # RUN: llvm-readobj --auxiliary-header %t4 | FileCheck %s --check-prefix=CASE4
163 # CASE4: AuxiliaryHeader {
164 # CASE4-NEXT: Magic: 0x1
165 # CASE4-NEXT: Version: 0x1
166 # CASE4-NEXT: Reserved for debugger: 0x0
167 # CASE4-NEXT: .text section start address: 0x0
168 # CASE4-NEXT: .data section start address: 0x0
169 # CASE4-NEXT: TOC anchor address: 0x0
170 # CASE4-NEXT: Section number of entryPoint: 0
171 # CASE4-NEXT: Section number of .text: 0
172 # CASE4-NEXT: Section number of .data: 0
173 # CASE4-NEXT: Section number of TOC: 0
174 # CASE4-NEXT: Section number of loader data: 0
175 # CASE4-NEXT: Section number of .bss: 0
176 # CASE4-NEXT: Maxium alignment of .text: 0x0
177 # CASE4-NEXT: Maxium alignment of .data: 0x0
178 # CASE4-NEXT: Module type: 0x0
179 # CASE4-NEXT: CPU type of objects: 0x0
180 # CASE4-NEXT: (Reserved): 0x0
181 # CASE4-NEXT: Text page size: 0x0
182 # CASE4-NEXT: Data page size: 0x0
183 # CASE4-NEXT: Stack page size: 0x0
184 # CASE4-NEXT: Flag: 0x80
185 # CASE4-NEXT: Alignment of thread-local storage: 0x0
186 # CASE4-NEXT: Size of .text section: 0x0
187 # CASE4-NEXT: Size of .data section: 0x0
188 # CASE4-NEXT: Size of .bss section: 0x0
189 # CASE4-NEXT: Entry point address: 0x0
190 # CASE4-NEXT: Maximum stack size: 0x0
191 # CASE4-NEXT: Maximum data size: 0x0
192 # CASE4-NEXT: Section number for .tdata: 0
193 # CASE4-NEXT: Section number for .tbss: 0
194 # CASE4-NEXT: Additional flags 64-bit XCOFF: 0x8000