1# RUN: yaml2obj %s -o %t 2# RUN: llvm-objcopy --remove-symbol-prefix __pf_ %t %t2 3# RUN: llvm-readelf --symbols %t2 | FileCheck %s 4 5## Show that an empty string is permitted as the argument to 6## --remove-symbol-prefix. 7# RUN: llvm-objcopy --remove-symbol-prefix= %t2 %t3 8# RUN: cmp %t2 %t3 9 10## When both options are present, llvm-objcopy should remove 11## prefixes first, before adding prefixes. 12# RUN: llvm-objcopy --prefix-symbols=__1_ %t %t4 13# RUN: llvm-objcopy --prefix-symbols=__2_ %t %t5 14# RUN: llvm-objcopy --remove-symbol-prefix=__1_ --prefix-symbols=__2_ %t4 %t6 15# RUN: cmp %t5 %t6 16 17## Show that the last --remove-symbol-prefix option wins. 18# RUN: llvm-objcopy --remove-symbol-prefix=__pf_ --remove-symbol-prefix=__ %t %t7 19# RUN: llvm-objcopy --remove-symbol-prefix=__ %t %t8 20# RUN: cmp %t7 %t8 21 22!ELF 23FileHeader: 24 Class: ELFCLASS64 25 Data: ELFDATA2LSB 26 Type: ET_REL 27 Machine: EM_X86_64 28Sections: 29 - Name: .text 30 Type: SHT_PROGBITS 31 Flags: [ SHF_ALLOC, SHF_EXECINSTR ] 32 Address: 0x1000 33 AddressAlign: 0x0000000000000010 34 Size: 64 35Symbols: 36 - Name: __pf_foo 37 Type: STT_SECTION 38 Section: .text 39 - Name: __pf_bar 40 Type: STT_FILE 41 Section: .text 42 - Name: foobar 43 Type: STT_FUNC 44 Section: .text 45 Binding: STB_GLOBAL 46 - Name: foo__pf_bar1 47 Type: STT_FUNC 48 Section: .text 49 Binding: STB_GLOBAL 50 - Name: __pf_foo__pf_bar2 51 Type: STT_FUNC 52 Section: .text 53 Binding: STB_GLOBAL 54 - Name: undef 55 Binding: STB_GLOBAL 56 57# CHECK: Symbol table '.symtab' contains 7 entries: 58# CHECK-NEXT: Name 59# CHECK-NEXT: {{ $}} 60# CHECK-NEXT: __pf_foo 61# CHECK-NEXT: bar 62# CHECK-NEXT: foobar 63# CHECK-NEXT: foo__pf_bar1 64# CHECK-NEXT: foo__pf_bar2 65# CHECK-NEXT: undef 66