71 lines · plain
1# RUN: yaml2obj --docnum=1 %s -o %t12# RUN: llvm-objcopy %t1 %t23# RUN: llvm-readobj --relocations %t2 | FileCheck %s4 5--- !ELF6FileHeader:7 Class: ELFCLASS648 Data: ELFDATA2LSB9 Type: ET_EXEC10 Machine: EM_X86_6411Sections:12 - Name: .text13 Type: SHT_PROGBITS14 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]15 Address: 0x100016 AddressAlign: 0x000000000000001017 Content: "0000000000000000"18 - Name: .rel.text19 Type: SHT_REL20 Info: .text21 Relocations:22 - Offset: 0x100023 Type: R_X86_64_RELATIVE24 25# CHECK: Relocations [26# CHECK-NEXT: Section (2) .rel.text {27# CHECK-NEXT: 0x1000 R_X86_64_RELATIVE -28# CHECK-NEXT: }29# CHECK-NEXT:]30 31## Check we produce a valid output when stripping unneeded symbols from an object that32## has a symbol table and a relocation with a symbol index of 0.33 34# RUN: yaml2obj --docnum=2 %s -o %t335# RUN: llvm-objcopy --strip-unneeded %t3 %t436# RUN: llvm-readobj --relocations --sections --symbols %t4 | FileCheck %s --check-prefix=STRIP37 38# STRIP: Relocations [39# STRIP-NEXT: Section {{.*}} .rel.text {40# STRIP-NEXT: 0x1000 R_X86_64_NONE -41# STRIP-NEXT: }42# STRIP-NEXT: ]43# STRIP-NEXT: Symbols [44# STRIP-NEXT: Symbol {45# STRIP-NEXT: Name: (0)46# STRIP-NEXT: Value: 0x047# STRIP-NEXT: Size: 048# STRIP-NEXT: Binding: Local (0x0)49# STRIP-NEXT: Type: None (0x0)50# STRIP-NEXT: Other: 051# STRIP-NEXT: Section: Undefined (0x0)52# STRIP-NEXT: }53# STRIP-NEXT: ]54 55--- !ELF56FileHeader:57 Class: ELFCLASS6458 Data: ELFDATA2LSB59 Type: ET_REL60 Machine: EM_X86_6461Sections:62 - Name: .text63 Type: SHT_PROGBITS64 - Name: .rel.text65 Type: SHT_REL66 Info: .text67 Relocations:68 - Offset: 0x100069 Type: R_X86_64_NONE70Symbols: []71