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: 0x8
14 # CASE1-NEXT: Size of .data section: 0x8
15 # CASE1-NEXT: Size of .bss section: 0x8
16 # CASE1-NEXT: Entry point address: 0x0
17 # CASE1-NEXT: .text section start address: 0x4
18 # CASE1-NEXT: .data section start address: 0x10
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: same as case1, except it is 64-bit.
83 # RUN: yaml2obj %s --docnum=1 -DMAGIC=0x1F7 -o %t2
84 # RUN: llvm-readobj --auxiliary-header %t2 | FileCheck %s --check-prefix=CASE2
86 # CASE2: AuxiliaryHeader {
87 # CASE2-NEXT: Magic: 0x10B
88 # CASE2-NEXT: Version: 0x1
89 # CASE2-NEXT: Reserved for debugger: 0x0
90 # CASE2-NEXT: .text section start address: 0x2
91 # CASE2-NEXT: .data section start address: 0xE
92 # CASE2-NEXT: TOC anchor address: 0x0
93 # CASE2-NEXT: Section number of entryPoint: 0
94 # CASE2-NEXT: Section number of .text: 2
95 # CASE2-NEXT: Section number of .data: 4
96 # CASE2-NEXT: Section number of TOC: 0
97 # CASE2-NEXT: Section number of loader data: 12
98 # CASE2-NEXT: Section number of .bss: 6
99 # CASE2-NEXT: Maxium alignment of .text: 0x0
100 # CASE2-NEXT: Maxium alignment of .data: 0x0
101 # CASE2-NEXT: Module type: 0x0
102 # CASE2-NEXT: CPU type of objects: 0x0
103 # CASE2-NEXT: (Reserved): 0x0
104 # CASE2-NEXT: Text page size: 0x0
105 # CASE2-NEXT: Data page size: 0x0
106 # CASE2-NEXT: Stack page size: 0x0
107 # CASE2-NEXT: Flag: 0x80
108 # CASE2-NEXT: Alignment of thread-local storage: 0x0
109 # CASE2-NEXT: Size of .text section: 0x8
110 # CASE2-NEXT: Size of .data section: 0x8
111 # CASE2-NEXT: Size of .bss section: 0x8
112 # CASE2-NEXT: Entry point address: 0x0
113 # CASE2-NEXT: Maximum stack size: 0x0
114 # CASE2-NEXT: Maximum data size: 0x0
115 # CASE2-NEXT: Section number for .tdata: 8
116 # CASE2-NEXT: Section number for .tbss: 10
117 # CASE2-NEXT: Additional flags 64-bit XCOFF: 0x8000
120 ## Case3: if all fields in the aux header are omitted and text/data/bss/tdata/tbss/loader
121 ## sections are not set, we set the fields using default values.
122 # RUN: yaml2obj %s --docnum=2 -o %t3
123 # RUN: llvm-readobj --auxiliary-header %t3 | FileCheck %s --check-prefix=CASE3
125 # CASE3: AuxiliaryHeader {
126 # CASE3-NEXT: Magic: 0x1
127 # CASE3-NEXT: Version: 0x1
128 # CASE3-NEXT: Size of .text section: 0x0
129 # CASE3-NEXT: Size of .data section: 0x0
130 # CASE3-NEXT: Size of .bss section: 0x0
131 # CASE3-NEXT: Entry point address: 0x0
132 # CASE3-NEXT: .text section start address: 0x0
133 # CASE3-NEXT: .data section start address: 0x0
134 # CASE3-NEXT: TOC anchor address: 0x0
135 # CASE3-NEXT: Section number of entryPoint: 0
136 # CASE3-NEXT: Section number of .text: 0
137 # CASE3-NEXT: Section number of .data: 0
138 # CASE3-NEXT: Section number of TOC: 0
139 # CASE3-NEXT: Section number of loader data: 0
140 # CASE3-NEXT: Section number of .bss: 0
141 # CASE3-NEXT: Maxium alignment of .text: 0x0
142 # CASE3-NEXT: Maxium alignment of .data: 0x0
143 # CASE3-NEXT: Module type: 0x0
144 # CASE3-NEXT: CPU type of objects: 0x0
145 # CASE3-NEXT: (Reserved): 0x0
146 # CASE3-NEXT: Maximum stack size: 0x0
147 # CASE3-NEXT: Maximum data size: 0x0
148 # CASE3-NEXT: Reserved for debugger: 0x0
149 # CASE3-NEXT: Text page size: 0x0
150 # CASE3-NEXT: Data page size: 0x0
151 # CASE3-NEXT: Stack page size: 0x0
152 # CASE3-NEXT: Flag: 0x0
153 # CASE3-NEXT: Alignment of thread-local storage: 0x0
154 # CASE3-NEXT: Section number for .tdata: 0
155 # CASE3-NEXT: Section number for .tbss: 0
160 MagicNumber: [[MAGIC=0x1DF]]
163 ## Case4: same as case3, except producing 64-bit output.
164 # RUN: yaml2obj %s --docnum=2 -DMAGIC=0x1F7 -o %t4
165 # RUN: llvm-readobj --auxiliary-header %t4 | FileCheck %s --check-prefix=CASE4
167 # CASE4: AuxiliaryHeader {
168 # CASE4-NEXT: Magic: 0x1
169 # CASE4-NEXT: Version: 0x1
170 # CASE4-NEXT: Reserved for debugger: 0x0
171 # CASE4-NEXT: .text section start address: 0x0
172 # CASE4-NEXT: .data section start address: 0x0
173 # CASE4-NEXT: TOC anchor address: 0x0
174 # CASE4-NEXT: Section number of entryPoint: 0
175 # CASE4-NEXT: Section number of .text: 0
176 # CASE4-NEXT: Section number of .data: 0
177 # CASE4-NEXT: Section number of TOC: 0
178 # CASE4-NEXT: Section number of loader data: 0
179 # CASE4-NEXT: Section number of .bss: 0
180 # CASE4-NEXT: Maxium alignment of .text: 0x0
181 # CASE4-NEXT: Maxium alignment of .data: 0x0
182 # CASE4-NEXT: Module type: 0x0
183 # CASE4-NEXT: CPU type of objects: 0x0
184 # CASE4-NEXT: (Reserved): 0x0
185 # CASE4-NEXT: Text page size: 0x0
186 # CASE4-NEXT: Data page size: 0x0
187 # CASE4-NEXT: Stack page size: 0x0
188 # CASE4-NEXT: Flag: 0x80
189 # CASE4-NEXT: Alignment of thread-local storage: 0x0
190 # CASE4-NEXT: Size of .text section: 0x0
191 # CASE4-NEXT: Size of .data section: 0x0
192 # CASE4-NEXT: Size of .bss section: 0x0
193 # CASE4-NEXT: Entry point address: 0x0
194 # CASE4-NEXT: Maximum stack size: 0x0
195 # CASE4-NEXT: Maximum data size: 0x0
196 # CASE4-NEXT: Section number for .tdata: 0
197 # CASE4-NEXT: Section number for .tbss: 0
198 # CASE4-NEXT: Additional flags 64-bit XCOFF: 0x8000