1# RUN: yaml2obj %s -o %t 2# RUN: llvm-objcopy --discard-all -K foo --keep-symbol bar %t %t2 3# RUN: llvm-objcopy -K foo -N foo -N bar --keep-symbol bar -N baz %t %t3 4# RUN: llvm-objcopy --discard-all --regex -K '^ba.*' %t %t4 5# RUN: llvm-readobj --symbols %t2 | FileCheck %s 6# RUN: llvm-readobj --symbols %t3 | FileCheck %s 7# RUN: llvm-readobj --symbols %t4 | FileCheck %s --check-prefix=REGEX 8 9# RUN: echo 'foo' > %t.symbols 10# RUN: echo 'bar' >> %t.symbols 11# RUN: llvm-objcopy --discard-all --keep-symbols %t.symbols %t %t5 12# RUN: llvm-objcopy -K foo -N foo -N bar --keep-symbols %t.symbols -N baz %t %t6 13# RUN: llvm-readobj --symbols %t5 | FileCheck %s 14# RUN: llvm-readobj --symbols %t6 | FileCheck %s 15 16!ELF 17FileHeader: 18 Class: ELFCLASS64 19 Data: ELFDATA2LSB 20 Type: ET_REL 21 Machine: EM_X86_64 22Sections: 23 - Name: .text 24 Type: SHT_PROGBITS 25 Flags: [ SHF_ALLOC, SHF_EXECINSTR ] 26 Address: 0x1000 27 AddressAlign: 0x0000000000000010 28 Size: 64 29Symbols: 30 - Name: foo 31 Type: STT_FUNC 32 Section: .text 33 Value: 0x1000 34 Size: 8 35 - Name: bar 36 Type: STT_FUNC 37 Section: .text 38 Value: 0x1008 39 Size: 8 40 - Name: baz 41 Type: STT_FUNC 42 Section: .text 43 Value: 0x1010 44 Size: 8 45 46#CHECK: Symbols [ 47#CHECK-NEXT: Symbol { 48#CHECK-NEXT: Name: 49#CHECK-NEXT: Value: 0x0 50#CHECK-NEXT: Size: 0 51#CHECK-NEXT: Binding: Local 52#CHECK-NEXT: Type: None 53#CHECK-NEXT: Other: 0 54#CHECK-NEXT: Section: Undefined 55#CHECK-NEXT: } 56#CHECK-NEXT: Symbol { 57#CHECK-NEXT: Name: foo 58#CHECK-NEXT: Value: 0x1000 59#CHECK-NEXT: Size: 8 60#CHECK-NEXT: Binding: Local 61#CHECK-NEXT: Type: Function 62#CHECK-NEXT: Other: 0 63#CHECK-NEXT: Section: .text 64#CHECK-NEXT: } 65#CHECK-NEXT: Symbol { 66#CHECK-NEXT: Name: bar 67#CHECK-NEXT: Value: 0x1008 68#CHECK-NEXT: Size: 8 69#CHECK-NEXT: Binding: Local 70#CHECK-NEXT: Type: Function 71#CHECK-NEXT: Other: 0 72#CHECK-NEXT: Section: .text 73#CHECK-NEXT: } 74#CHECK-NEXT:] 75 76#REGEX: Symbols [ 77#REGEX-NOT: foo 78#REGEX: Name: bar 79#REGEX: Name: baz 80#REGEX: ] 81