1## Here we test that an arbitrary hex value can be used for a relocation type. 2 3## Show that yaml2obj is able to produce relocations for an unknown e_machine kind properly. 4# RUN: yaml2obj %s -o %t1 -DMACHINE=0x1234 5# RUN: llvm-readelf %t1 --relocations | FileCheck %s -DFIRST=Unknown -DSECOND=Unknown 6# RUN: yaml2obj %s -o %t1 -DMACHINE=0x1234 -DTYPE=SHT_CREL 7# RUN: llvm-readelf %t1 --relocations | FileCheck %s -DFIRST=Unknown -DSECOND=Unknown 8 9# CHECK: Relocation section '.rela.text' at offset 0x40 contains 4 entries: 10# CHECK: Offset Info Type 11# CHECK-NEXT: 0000000000000009 0000000000000000 [[FIRST]] 0 12# CHECK-NEXT: 0000000000000008 0000000000000001 [[SECOND]] 0 13# CHECK-NEXT: 0000000000000007 000000000000007f Unknown 0 14# CHECK-NEXT: 0000000000000006 00000000000000ff Unknown 0 15 16## Show that yaml2obj is able to produce relocations for an arbitrary known e_machine kind properly. 17# RUN: yaml2obj %s -o %t2 -DMACHINE=EM_X86_64 18# RUN: llvm-readelf %t2 --relocations | FileCheck %s -DFIRST=R_X86_64_NONE -DSECOND=R_X86_64_64 19 20--- !ELF 21FileHeader: 22 Class: ELFCLASS64 23 Data: ELFDATA2MSB 24 Type: ET_REL 25 Machine: [[MACHINE]] 26Sections: 27 - Name: .rela.text 28 Type: [[TYPE=SHT_RELA]] 29 Relocations: 30## Test a few noticeable possible values: 0, 1, max(int8_t)=127, max(uint8_t)=0xFF=-1 31 - Offset: 0x9 32 Type: 0x0 33 - Offset: 0x8 34 Type: 0x1 35 - Offset: 0x7 36 Type: 0x7F 37 - Offset: 0x6 38 Type: 0xFF 39