1## Show how obj2yaml dumps relocation types. 2 3## Show that obj2yaml is able to dump relocation types when `e_machine` kind is unknown. 4# RUN: yaml2obj %s -o %t1 -DMACHINE=0x1234 5# RUN: obj2yaml %t1 | FileCheck %s -DMACHINE=0x1234 -DFIRST=0x0 -DSECOND=0x1 6 7# CHECK: --- !ELF 8# CHECK-NEXT: FileHeader: 9# CHECK-NEXT: Class: ELFCLASS64 10# CHECK-NEXT: Data: ELFDATA2MSB 11# CHECK-NEXT: Type: ET_REL 12# CHECK-NEXT: Machine: [[MACHINE]] 13# CHECK-NEXT: Sections: 14# CHECK-NEXT: - Name: .rela.text 15# CHECK-NEXT: Type: SHT_RELA 16# CHECK-NEXT: Relocations: 17# CHECK-NEXT: - Offset: 0x9 18# CHECK-NEXT: Type: [[FIRST]] 19# CHECK-NEXT: - Offset: 0x8 20# CHECK-NEXT: Type: [[SECOND]] 21# CHECK-NEXT: - Offset: 0x7 22# CHECK-NEXT: Type: 0x7F 23# CHECK-NEXT: - Offset: 0x6 24# CHECK-NEXT: Type: 0xFF 25# CHECK-NEXT: ... 26 27## Show how obj2yaml dumps relocation types when `e_machine` kind is known. 28## In this case unknown relocation types are dumped as hex values. 29## All known relocation types are printed as strings representing relocation names. 30# RUN: yaml2obj %s -o %t2 -DMACHINE=EM_X86_64 31# RUN: obj2yaml %t2 | FileCheck %s -DMACHINE=EM_X86_64 -DFIRST=R_X86_64_NONE -DSECOND=R_X86_64_64 32 33--- !ELF 34FileHeader: 35 Class: ELFCLASS64 36 Data: ELFDATA2MSB 37 Type: ET_REL 38 Machine: [[MACHINE]] 39Sections: 40 - Name: .rela.text 41 Type: SHT_RELA 42 Relocations: 43## Test a few noticeable possible values: 0, 1, max(int8_t)=127, max(uint8_t)=0xFF=-1 44 - Offset: 0x9 45 Type: 0x0 46 - Offset: 0x8 47 Type: 0x1 48 - Offset: 0x7 49 Type: 0x7F 50 - Offset: 0x6 51 Type: 0xFF 52