llvm.org GIT mirror llvm / 8738ed4
[ObjectYAML] Map relocation types for COFF ARMNT and ARM64 Differential Revision: https://reviews.llvm.org/D39668 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317459 91177308-0d34-0410-b5e6-96231b3b80d8 Martin Storsjo 1 year, 11 months ago
3 changed file(s) with 216 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
157157 };
158158
159159 template <>
160 struct ScalarEnumerationTraits {
161 static void enumeration(IO &IO, COFF::RelocationTypesARM &Value);
162 };
163
164 template <>
165 struct ScalarEnumerationTraits {
166 static void enumeration(IO &IO, COFF::RelocationTypesARM64 &Value);
167 };
168
169 template <>
160170 struct ScalarEnumerationTraits {
161171 static void enumeration(IO &IO, COFF::WindowsSubsystem &Value);
162172 };
177177 ECase(IMAGE_REL_AMD64_SSPAN32);
178178 }
179179
180 void ScalarEnumerationTraits::enumeration(
181 IO &IO, COFF::RelocationTypesARM &Value) {
182 ECase(IMAGE_REL_ARM_ABSOLUTE);
183 ECase(IMAGE_REL_ARM_ADDR32);
184 ECase(IMAGE_REL_ARM_ADDR32NB);
185 ECase(IMAGE_REL_ARM_BRANCH24);
186 ECase(IMAGE_REL_ARM_BRANCH11);
187 ECase(IMAGE_REL_ARM_TOKEN);
188 ECase(IMAGE_REL_ARM_BLX24);
189 ECase(IMAGE_REL_ARM_BLX11);
190 ECase(IMAGE_REL_ARM_SECTION);
191 ECase(IMAGE_REL_ARM_SECREL);
192 ECase(IMAGE_REL_ARM_MOV32A);
193 ECase(IMAGE_REL_ARM_MOV32T);
194 ECase(IMAGE_REL_ARM_BRANCH20T);
195 ECase(IMAGE_REL_ARM_BRANCH24T);
196 ECase(IMAGE_REL_ARM_BLX23T);
197 }
198
199 void ScalarEnumerationTraits::enumeration(
200 IO &IO, COFF::RelocationTypesARM64 &Value) {
201 ECase(IMAGE_REL_ARM64_ABSOLUTE);
202 ECase(IMAGE_REL_ARM64_ADDR32);
203 ECase(IMAGE_REL_ARM64_ADDR32NB);
204 ECase(IMAGE_REL_ARM64_BRANCH26);
205 ECase(IMAGE_REL_ARM64_PAGEBASE_REL21);
206 ECase(IMAGE_REL_ARM64_REL21);
207 ECase(IMAGE_REL_ARM64_PAGEOFFSET_12A);
208 ECase(IMAGE_REL_ARM64_PAGEOFFSET_12L);
209 ECase(IMAGE_REL_ARM64_SECREL);
210 ECase(IMAGE_REL_ARM64_SECREL_LOW12A);
211 ECase(IMAGE_REL_ARM64_SECREL_HIGH12A);
212 ECase(IMAGE_REL_ARM64_SECREL_LOW12L);
213 ECase(IMAGE_REL_ARM64_TOKEN);
214 ECase(IMAGE_REL_ARM64_SECTION);
215 ECase(IMAGE_REL_ARM64_ADDR64);
216 ECase(IMAGE_REL_ARM64_BRANCH19);
217 ECase(IMAGE_REL_ARM64_BRANCH14);
218 }
219
180220 void ScalarEnumerationTraits::enumeration(
181221 IO &IO, COFF::WindowsSubsystem &Value) {
182222 ECase(IMAGE_SUBSYSTEM_UNKNOWN);
377417 MappingNormalization, uint16_t> NT(
378418 IO, Rel.Type);
379419 IO.mapRequired("Type", NT->Type);
420 } else if (H.Machine == COFF::IMAGE_FILE_MACHINE_ARMNT) {
421 MappingNormalization, uint16_t> NT(
422 IO, Rel.Type);
423 IO.mapRequired("Type", NT->Type);
424 } else if (H.Machine == COFF::IMAGE_FILE_MACHINE_ARM64) {
425 MappingNormalization, uint16_t> NT(
426 IO, Rel.Type);
427 IO.mapRequired("Type", NT->Type);
380428 } else {
381429 IO.mapRequired("Type", Rel.Type);
382430 }
0 RUN: obj2yaml %p/Inputs/trivial-object-test.coff-i386 | FileCheck %s --check-prefix COFF-I386
11 RUN: obj2yaml %p/Inputs/trivial-object-test.coff-x86-64 | FileCheck %s --check-prefix COFF-X86-64
2 RUN: obj2yaml %p/Inputs/trivial-object-test.coff-armnt | FileCheck %s --check-prefix COFF-ARMNT
3 RUN: obj2yaml %p/Inputs/trivial-object-test.coff-arm64 | FileCheck %s --check-prefix COFF-ARM64
24 RUN: obj2yaml %p/Inputs/trivial-object-test.elf-mipsel | FileCheck %s --check-prefix ELF-MIPSEL
35 RUN: obj2yaml %p/Inputs/trivial-object-test.elf-mips64el | FileCheck %s --check-prefix ELF-MIPS64EL
46 RUN: obj2yaml %p/Inputs/trivial-object-test.elf-x86-64 | FileCheck %s --check-prefix ELF-X86-64
187189 COFF-X86-64-NEXT: SimpleType: IMAGE_SYM_TYPE_NULL
188190 COFF-X86-64-NEXT: ComplexType: IMAGE_SYM_DTYPE_FUNCTION
189191 COFF-X86-64-NEXT: StorageClass: IMAGE_SYM_CLASS_STATIC
192
193 COFF-ARMNT: header:
194 COFF-ARMNT-NEXT: Machine: IMAGE_FILE_MACHINE_ARMNT
195
196 COFF-ARMNT: sections:
197 COFF-ARMNT-NEXT: - Name: .text
198 COFF-ARMNT-NEXT: Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_PURGEABLE, IMAGE_SCN_MEM_16BIT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
199 COFF-ARMNT-NEXT: Alignment: 4
200 COFF-ARMNT-NEXT: SectionData: 00F000F87047
201
202 COFF-ARMNT: Relocations:
203 COFF-ARMNT-NEXT: - VirtualAddress: 0
204 COFF-ARMNT-NEXT: SymbolName: otherFunc
205 COFF-ARMNT-NEXT: Type: IMAGE_REL_ARM_BLX23T
206
207 COFF-ARMNT: - Name: .data
208 COFF-ARMNT-NEXT: Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
209 COFF-ARMNT-NEXT: Alignment: 4
210 COFF-ARMNT-NEXT: SectionData: ''
211
212 COFF-ARMNT: - Name: .bss
213 COFF-ARMNT-NEXT: Characteristics: [ IMAGE_SCN_CNT_UNINITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
214 COFF-ARMNT-NEXT: Alignment: 4
215 COFF-ARMNT-NEXT: SectionData: ''
216
217 COFF-ARMNT: symbols:
218 COFF-ARMNT-NEXT: - Name: .text
219 COFF-ARMNT-NEXT: Value: 0
220 COFF-ARMNT-NEXT: SectionNumber: 1
221 COFF-ARMNT-NEXT: SimpleType: IMAGE_SYM_TYPE_NULL
222 COFF-ARMNT-NEXT: ComplexType: IMAGE_SYM_DTYPE_NULL
223 COFF-ARMNT-NEXT: StorageClass: IMAGE_SYM_CLASS_STATIC
224 COFF-ARMNT-NEXT: SectionDefinition:
225 COFF-ARMNT-NEXT: Length: 6
226 COFF-ARMNT-NEXT: NumberOfRelocations: 1
227 COFF-ARMNT-NEXT: NumberOfLinenumbers: 0
228 COFF-ARMNT-NEXT: CheckSum: 879026160
229 COFF-ARMNT-NEXT: Number: 1
230
231 COFF-ARMNT: - Name: .data
232 COFF-ARMNT-NEXT: Value: 0
233 COFF-ARMNT-NEXT: SectionNumber: 2
234 COFF-ARMNT-NEXT: SimpleType: IMAGE_SYM_TYPE_NULL
235 COFF-ARMNT-NEXT: ComplexType: IMAGE_SYM_DTYPE_NULL
236 COFF-ARMNT-NEXT: StorageClass: IMAGE_SYM_CLASS_STATIC
237 COFF-ARMNT-NEXT: SectionDefinition:
238 COFF-ARMNT-NEXT: Length: 0
239 COFF-ARMNT-NEXT: NumberOfRelocations: 0
240 COFF-ARMNT-NEXT: NumberOfLinenumbers: 0
241 COFF-ARMNT-NEXT: CheckSum: 0
242 COFF-ARMNT-NEXT: Number: 2
243
244 COFF-ARMNT: - Name: .bss
245 COFF-ARMNT-NEXT: Value: 0
246 COFF-ARMNT-NEXT: SectionNumber: 3
247 COFF-ARMNT-NEXT: SimpleType: IMAGE_SYM_TYPE_NULL
248 COFF-ARMNT-NEXT: ComplexType: IMAGE_SYM_DTYPE_NULL
249 COFF-ARMNT-NEXT: StorageClass: IMAGE_SYM_CLASS_STATIC
250 COFF-ARMNT-NEXT: SectionDefinition:
251 COFF-ARMNT-NEXT: Length: 0
252 COFF-ARMNT-NEXT: NumberOfRelocations: 0
253 COFF-ARMNT-NEXT: NumberOfLinenumbers: 0
254 COFF-ARMNT-NEXT: CheckSum: 0
255 COFF-ARMNT-NEXT: Number: 3
256
257 COFF-ARMNT: - Name: main
258 COFF-ARMNT-NEXT: Value: 0
259 COFF-ARMNT-NEXT: SectionNumber: 1
260 COFF-ARMNT-NEXT: SimpleType: IMAGE_SYM_TYPE_NULL
261 COFF-ARMNT-NEXT: ComplexType: IMAGE_SYM_DTYPE_NULL
262 COFF-ARMNT-NEXT: StorageClass: IMAGE_SYM_CLASS_EXTERNAL
263
264 COFF-ARMNT: - Name: otherFunc
265 COFF-ARMNT-NEXT: Value: 0
266 COFF-ARMNT-NEXT: SectionNumber: 0
267 COFF-ARMNT-NEXT: SimpleType: IMAGE_SYM_TYPE_NULL
268 COFF-ARMNT-NEXT: ComplexType: IMAGE_SYM_DTYPE_NULL
269 COFF-ARMNT-NEXT: StorageClass: IMAGE_SYM_CLASS_EXTERNAL
270
271 COFF-ARM64: header:
272 COFF-ARM64-NEXT: Machine: IMAGE_FILE_MACHINE_ARM64
273
274 COFF-ARM64: sections:
275 COFF-ARM64-NEXT: - Name: .text
276 COFF-ARM64-NEXT: Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
277 COFF-ARM64-NEXT: Alignment: 4
278 COFF-ARM64-NEXT: SectionData: 00000094C0035FD6
279
280 COFF-ARM64: Relocations:
281 COFF-ARM64-NEXT: - VirtualAddress: 0
282 COFF-ARM64-NEXT: SymbolName: otherFunc
283 COFF-ARM64-NEXT: Type: IMAGE_REL_ARM64_BRANCH26
284
285 COFF-ARM64: - Name: .data
286 COFF-ARM64-NEXT: Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
287 COFF-ARM64-NEXT: Alignment: 4
288 COFF-ARM64-NEXT: SectionData: ''
289
290 COFF-ARM64: - Name: .bss
291 COFF-ARM64-NEXT: Characteristics: [ IMAGE_SCN_CNT_UNINITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
292 COFF-ARM64-NEXT: Alignment: 4
293 COFF-ARM64-NEXT: SectionData: ''
294
295 COFF-ARM64: symbols:
296 COFF-ARM64-NEXT: - Name: .text
297 COFF-ARM64-NEXT: Value: 0
298 COFF-ARM64-NEXT: SectionNumber: 1
299 COFF-ARM64-NEXT: SimpleType: IMAGE_SYM_TYPE_NULL
300 COFF-ARM64-NEXT: ComplexType: IMAGE_SYM_DTYPE_NULL
301 COFF-ARM64-NEXT: StorageClass: IMAGE_SYM_CLASS_STATIC
302 COFF-ARM64-NEXT: SectionDefinition:
303 COFF-ARM64-NEXT: Length: 8
304 COFF-ARM64-NEXT: NumberOfRelocations: 1
305 COFF-ARM64-NEXT: NumberOfLinenumbers: 0
306 COFF-ARM64-NEXT: CheckSum: 35579893
307 COFF-ARM64-NEXT: Number: 1
308
309 COFF-ARM64: - Name: .data
310 COFF-ARM64-NEXT: Value: 0
311 COFF-ARM64-NEXT: SectionNumber: 2
312 COFF-ARM64-NEXT: SimpleType: IMAGE_SYM_TYPE_NULL
313 COFF-ARM64-NEXT: ComplexType: IMAGE_SYM_DTYPE_NULL
314 COFF-ARM64-NEXT: StorageClass: IMAGE_SYM_CLASS_STATIC
315 COFF-ARM64-NEXT: SectionDefinition:
316 COFF-ARM64-NEXT: Length: 0
317 COFF-ARM64-NEXT: NumberOfRelocations: 0
318 COFF-ARM64-NEXT: NumberOfLinenumbers: 0
319 COFF-ARM64-NEXT: CheckSum: 0
320 COFF-ARM64-NEXT: Number: 2
321
322 COFF-ARM64: - Name: .bss
323 COFF-ARM64-NEXT: Value: 0
324 COFF-ARM64-NEXT: SectionNumber: 3
325 COFF-ARM64-NEXT: SimpleType: IMAGE_SYM_TYPE_NULL
326 COFF-ARM64-NEXT: ComplexType: IMAGE_SYM_DTYPE_NULL
327 COFF-ARM64-NEXT: StorageClass: IMAGE_SYM_CLASS_STATIC
328 COFF-ARM64-NEXT: SectionDefinition:
329 COFF-ARM64-NEXT: Length: 0
330 COFF-ARM64-NEXT: NumberOfRelocations: 0
331 COFF-ARM64-NEXT: NumberOfLinenumbers: 0
332 COFF-ARM64-NEXT: CheckSum: 0
333 COFF-ARM64-NEXT: Number: 3
334
335 COFF-ARM64: - Name: main
336 COFF-ARM64-NEXT: Value: 0
337 COFF-ARM64-NEXT: SectionNumber: 1
338 COFF-ARM64-NEXT: SimpleType: IMAGE_SYM_TYPE_NULL
339 COFF-ARM64-NEXT: ComplexType: IMAGE_SYM_DTYPE_NULL
340 COFF-ARM64-NEXT: StorageClass: IMAGE_SYM_CLASS_EXTERNAL
341
342 COFF-ARM64: - Name: otherFunc
343 COFF-ARM64-NEXT: Value: 0
344 COFF-ARM64-NEXT: SectionNumber: 0
345 COFF-ARM64-NEXT: SimpleType: IMAGE_SYM_TYPE_NULL
346 COFF-ARM64-NEXT: ComplexType: IMAGE_SYM_DTYPE_NULL
347 COFF-ARM64-NEXT: StorageClass: IMAGE_SYM_CLASS_EXTERNAL
190348
191349 ELF-MIPSEL: FileHeader:
192350 ELF-MIPSEL-NEXT: Class: ELFCLASS32