1# RUN: yaml2obj --docnum=1 %s -o %t1 2# RUN: llvm-objcopy %t1 %t2 3# RUN: llvm-readobj --relocations %t2 | FileCheck %s 4 5--- !ELF 6FileHeader: 7 Class: ELFCLASS64 8 Data: ELFDATA2LSB 9 Type: ET_EXEC 10 Machine: EM_X86_64 11Sections: 12 - Name: .text 13 Type: SHT_PROGBITS 14 Flags: [ SHF_ALLOC, SHF_EXECINSTR ] 15 Address: 0x1000 16 AddressAlign: 0x0000000000000010 17 Content: "0000000000000000" 18 - Name: .rel.text 19 Type: SHT_REL 20 Info: .text 21 Relocations: 22 - Offset: 0x1000 23 Type: R_X86_64_RELATIVE 24 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 that 32## has a symbol table and a relocation with a symbol index of 0. 33 34# RUN: yaml2obj --docnum=2 %s -o %t3 35# RUN: llvm-objcopy --strip-unneeded %t3 %t4 36# RUN: llvm-readobj --relocations --sections --symbols %t4 | FileCheck %s --check-prefix=STRIP 37 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: 0x0 47# STRIP-NEXT: Size: 0 48# STRIP-NEXT: Binding: Local (0x0) 49# STRIP-NEXT: Type: None (0x0) 50# STRIP-NEXT: Other: 0 51# STRIP-NEXT: Section: Undefined (0x0) 52# STRIP-NEXT: } 53# STRIP-NEXT: ] 54 55--- !ELF 56FileHeader: 57 Class: ELFCLASS64 58 Data: ELFDATA2LSB 59 Type: ET_REL 60 Machine: EM_X86_64 61Sections: 62 - Name: .text 63 Type: SHT_PROGBITS 64 - Name: .rel.text 65 Type: SHT_REL 66 Info: .text 67 Relocations: 68 - Offset: 0x1000 69 Type: R_X86_64_NONE 70Symbols: [] 71