62 lines · plain
1## Here we want to check that llvm-objcopy removes an undefined symbol2## if all references to it have been stripped.3 4# RUN: yaml2obj --docnum=1 %s -o %t.o5# RUN: llvm-objcopy -j .other.section %t.o %t2.o6# RUN: llvm-readobj --symbols %t2.o | FileCheck %s7 8# RUN: llvm-objcopy -j .text -j .rela.text1 %t.o %t2.o9# RUN: llvm-readobj --symbols %t2.o | FileCheck %s --check-prefix=BAR10 11# CHECK-NOT: Name: bar12# BAR: Name: bar13 14--- !ELF15FileHeader:16 Class: ELFCLASS6417 Data: ELFDATA2LSB18 Type: ET_REL19 Machine: EM_X86_6420Sections:21 - Name: .text22 Type: SHT_PROGBITS23 - Name: .rela.text124 Type: SHT_RELA25 Relocations:26 - Offset: 0x000000000000000127 Symbol: bar28 Type: R_X86_64_3229 - Name: .rela.text230 Type: SHT_RELA31 Relocations:32 - Offset: 0x000000000000000133 Symbol: bar34 Type: R_X86_64_3235 - Name: .other.section36 Type: SHT_PROGBITS37Symbols:38 - Name: bar39 Binding: STB_GLOBAL40...41 42## Check we remove unreferenced undefined symbols, even if43## they weren't previously referenced. This follows GNU.44 45# RUN: yaml2obj --docnum=2 %s -o %t.o46# RUN: llvm-objcopy -j .keep_me %t.o %t2.o47# RUN: llvm-readobj --symbols %t2.o | FileCheck %s48 49--- !ELF50FileHeader:51 Class: ELFCLASS6452 Data: ELFDATA2LSB53 Type: ET_REL54 Machine: EM_X86_6455Sections:56 - Name: .keep_me57 Type: SHT_PROGBITS58Symbols:59 - Name: bar60 Binding: STB_GLOBAL61...62