56 lines · plain
1## Check that we can copy an object that has a relocation2## with a symbol index of 0 even when there is no symbol table.3 4# RUN: yaml2obj --docnum=1 %s -o %t15# RUN: llvm-objcopy %t1 %t26# RUN: llvm-readobj --relocations %t2 | FileCheck %s7 8# CHECK: Relocations [9# CHECK-NEXT: Section {{.*}} .rel.text {10# CHECK-NEXT: 0x1000 R_X86_64_RELATIVE -11# CHECK-NEXT: }12# CHECK-NEXT:]13 14--- !ELF15FileHeader:16 Class: ELFCLASS6417 Data: ELFDATA2LSB18 Type: ET_REL19 Machine: EM_X86_6420Sections:21 - Name: .text22 Type: SHT_PROGBITS23 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]24 - Name: .rel.text25 Type: SHT_REL26 Info: .text27 Relocations:28 - Offset: 0x100029 Type: R_X86_64_RELATIVE30 31## Check that we report an error when a relocation refers to a32## non-zero symbol index but there is no symbol table.33 34# RUN: yaml2obj --docnum=2 %s -o %t335# RUN: not llvm-objcopy %t3 /dev/null 2>&1 | FileCheck %s --check-prefix=ERR36 37# ERR: error: '.rel.text': relocation references symbol with index 1, but there is no symbol table38 39--- !ELF40FileHeader:41 Class: ELFCLASS6442 Data: ELFDATA2LSB43 Type: ET_REL44 Machine: EM_X86_6445Sections:46 - Name: .text47 Type: SHT_PROGBITS48 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]49 - Name: .rel.text50 Type: SHT_REL51 Info: .text52 Relocations:53 - Offset: 0x100054 Symbol: 155 Type: R_X86_64_NONE56