50 lines · plain
1## Check we cannot remove a section containing symbols2## referenced by relocations contained in the object.3 4# RUN: yaml2obj %s -o %t15# RUN: not llvm-objcopy -R .data %t1 2>&1 | FileCheck %s -DINPUT=%t16# CHECK: error: '[[INPUT]]': section '.data' cannot be removed: (.text+0x1) has relocation against symbol 'foo'7 8## Check the behavior when we also remove the relocation section.9## We have no reference in this case and hence no error should be emitted.10 11# RUN: yaml2obj %s -o %t212# RUN: llvm-objcopy -R .data -R .rela.text %t2 %t313# RUN: llvm-objdump --section-headers %t3 | FileCheck %s --check-prefix=NOSEC14# NOSEC-NOT: .data15# NOSEC-NOT: .rela.text16 17--- !ELF18FileHeader: 19 Class: ELFCLASS6420 Data: ELFDATA2LSB21 Type: ET_REL22 Machine: EM_X86_6423Sections: 24 - Name: .text25 Type: SHT_PROGBITS26 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]27 AddressAlign: 0x000000000000000428 Content: E80000000029 - Name: .rela.text30 Type: SHT_RELA31 Link: .symtab32 AddressAlign: 0x000000000000000833 EntSize: 0x000000000000001834 Info: .text35 Relocations: 36 - Offset: 0x000000000000000137 Symbol: foo38 Type: R_X86_64_GOTPCREL39 Addend: -440 - Name: .data41 Type: SHT_PROGBITS42 Flags: [ SHF_WRITE, SHF_ALLOC ]43 AddressAlign: 0x000000000000000144 Content: '0102'45Symbols: 46 - Name: foo47 Section: .data48 Value: 0x000000000000000149...50