| 1 |
# RUN: yaml2obj %s -o %t |
| 2 |
# Establish baseline objects for further checks. --discard-locals only discards |
| 3 |
# compiler-generated local symbols (starting with .L), --discard-all discards |
| 4 |
# all regular local symbols. |
| 5 |
# RUN: llvm-objcopy %t %t-discard-none |
| 6 |
# RUN: llvm-readobj --symbols %t-discard-none | FileCheck %s --check-prefixes=CHECK,LOCAL,COMPILER-LOCAL |
| 7 |
# RUN: llvm-objcopy --discard-all %t %t-discard-all |
| 8 |
# RUN: llvm-readobj --symbols %t-discard-all | FileCheck %s |
| 9 |
# RUN: llvm-objcopy --discard-locals %t %t-discard-locals |
| 10 |
# RUN: llvm-readobj --symbols %t-discard-locals | FileCheck %s --check-prefixes=CHECK,LOCAL |
| 11 |
|
| 12 |
# When mixing --discard-all and --discard-locals, the last one wins. |
| 13 |
# RUN: llvm-objcopy --discard-all --discard-locals %t %t.1.o |
| 14 |
# RUN: cmp %t.1.o %t-discard-locals |
| 15 |
# RUN: llvm-objcopy --discard-locals --discard-all %t %t.2.o |
| 16 |
# RUN: cmp %t.2.o %t-discard-all |
| 17 |
# RUN: llvm-objcopy -x -X %t %t.3.o |
| 18 |
# RUN: cmp %t.3.o %t-discard-locals |
| 19 |
# RUN: llvm-objcopy -X -x %t %t.4.o |
| 20 |
# RUN: cmp %t.4.o %t-discard-all |
| 21 |
# RUN: llvm-objcopy -x -X -x -X %t %t.5.o |
| 22 |
# RUN: cmp %t.5.o %t-discard-locals |
| 23 |
# RUN: llvm-objcopy -X -x -X -x %t %t.6.o |
| 24 |
# RUN: cmp %t.6.o %t-discard-all |
| 25 |
# RUN: llvm-objcopy -X -x -X -x --discard-locals %t %t.7.o |
| 26 |
# RUN: cmp %t.7.o %t-discard-locals |
| 27 |
# RUN: llvm-objcopy -X -x -X -x --discard-all %t %t.8.o |
| 28 |
# RUN: cmp %t.8.o %t-discard-all |
| 29 |
|
| 30 |
# llvm-strip works in the same way. |
| 31 |
# RUN: llvm-strip --discard-all --discard-locals %t -o %t.9.o |
| 32 |
# RUN: cmp %t.9.o %t-discard-locals |
| 33 |
# RUN: llvm-strip --discard-locals --discard-all %t -o %t.10.o |
| 34 |
# RUN: cmp %t.10.o %t-discard-all |
| 35 |
# RUN: llvm-strip -x -X %t -o %t.11.o |
| 36 |
# RUN: cmp %t.11.o %t-discard-locals |
| 37 |
# RUN: llvm-strip -X -x %t -o %t.12.o |
| 38 |
# RUN: cmp %t.12.o %t-discard-all |
| 39 |
# RUN: llvm-strip -x -X -x -X %t -o %t.13.o |
| 40 |
# RUN: cmp %t.13.o %t-discard-locals |
| 41 |
# RUN: llvm-strip -X -x -X -x %t -o %t.14.o |
| 42 |
# RUN: cmp %t.14.o %t-discard-all |
| 43 |
# RUN: llvm-strip -X -x -X -x --discard-locals %t -o %t.15.o |
| 44 |
# RUN: cmp %t.15.o %t-discard-locals |
| 45 |
# RUN: llvm-strip -X -x -X -x --discard-all %t -o %t.16.o |
| 46 |
# RUN: cmp %t.16.o %t-discard-all |
| 47 |
|
| 48 |
!ELF |
| 49 |
FileHeader: |
| 50 |
Class: ELFCLASS64 |
| 51 |
Data: ELFDATA2LSB |
| 52 |
Type: ET_REL |
| 53 |
Machine: EM_X86_64 |
| 54 |
Sections: |
| 55 |
- Name: .text |
| 56 |
Type: SHT_PROGBITS |
| 57 |
Symbols: |
| 58 |
- Name: Local |
| 59 |
Type: STT_FUNC |
| 60 |
Section: .text |
| 61 |
- Name: .L.str |
| 62 |
Type: STT_OBJECT |
| 63 |
Section: .text |
| 64 |
- Name: Global |
| 65 |
Type: STT_FUNC |
| 66 |
Section: .text |
| 67 |
Binding: STB_GLOBAL |
| 68 |
|
| 69 |
# CHECK: Symbols [ |
| 70 |
# CHECK-NEXT: Symbol { |
| 71 |
# CHECK-NEXT: Name: |
| 72 |
# CHECK-NEXT: Value: 0x0 |
| 73 |
# CHECK-NEXT: Size: 0 |
| 74 |
# CHECK-NEXT: Binding: Local |
| 75 |
# CHECK-NEXT: Type: None |
| 76 |
# CHECK-NEXT: Other: 0 |
| 77 |
# CHECK-NEXT: Section: Undefined |
| 78 |
# CHECK-NEXT: } |
| 79 |
# LOCAL-NEXT: Symbol { |
| 80 |
# LOCAL-NEXT: Name: Local |
| 81 |
# LOCAL-NEXT: Value: |
| 82 |
# LOCAL-NEXT: Size: |
| 83 |
# LOCAL-NEXT: Binding: Local |
| 84 |
# LOCAL-NEXT: Type: Function |
| 85 |
# LOCAL-NEXT: Other: |
| 86 |
# LOCAL-NEXT: Section: .text |
| 87 |
# LOCAL-NEXT: } |
| 88 |
# COMPILER-LOCAL-NEXT: Symbol { |
| 89 |
# COMPILER-LOCAL-NEXT: Name: .L.str |
| 90 |
# COMPILER-LOCAL-NEXT: Value: |
| 91 |
# COMPILER-LOCAL-NEXT: Size: |
| 92 |
# COMPILER-LOCAL-NEXT: Binding: Local |
| 93 |
# COMPILER-LOCAL-NEXT: Type: Object |
| 94 |
# COMPILER-LOCAL-NEXT: Other: |
| 95 |
# COMPILER-LOCAL-NEXT: Section: .text |
| 96 |
# COMPILER-LOCAL-NEXT: } |
| 97 |
# CHECK-NEXT: Symbol { |
| 98 |
# CHECK-NEXT: Name: Global |
| 99 |
# CHECK-NEXT: Value: |
| 100 |
# CHECK-NEXT: Size: |
| 101 |
# CHECK-NEXT: Binding: Global |
| 102 |
# CHECK-NEXT: Type: Function |
| 103 |
# CHECK-NEXT: Other: |
| 104 |
# CHECK-NEXT: Section: .text |
| 105 |
# CHECK-NEXT: } |
| 106 |
# CHECK-NEXT: ] |