| 1 |
# RUN: yaml2obj %s -o %t |
| 2 |
# RUN: cp %t %t3 |
| 3 |
# RUN: llvm-objcopy --strip-all %t %t2 |
| 4 |
# RUN: llvm-readobj --file-headers --sections %t2 | FileCheck %s |
| 5 |
|
| 6 |
# Verify that the previous llvm-objcopy's run has not modified the input. |
| 7 |
# RUN: cmp %t %t3 |
| 8 |
|
| 9 |
# RUN: llvm-strip %t3 |
| 10 |
# RUN: cmp %t2 %t3 |
| 11 |
|
| 12 |
# RUN: cp %t %t4 |
| 13 |
# RUN: llvm-strip %t4 -o %t5 |
| 14 |
# RUN: cmp %t2 %t5 |
| 15 |
|
| 16 |
# Verify that the previous llvm-strip's run has not modified the input. |
| 17 |
# RUN: cmp %t %t4 |
| 18 |
|
| 19 |
# RUN: cp %t %t-should-remain-the-same |
| 20 |
# RUN: llvm-strip %t4 -o %t-should-remain-the-same -o %t-should-be-stripped |
| 21 |
# RUN: cmp %t2 %t-should-be-stripped |
| 22 |
# RUN: cmp %t %t-should-remain-the-same |
| 23 |
|
| 24 |
# RUN: rm -f %t.a |
| 25 |
# RUN: llvm-ar crs %t.a %t |
| 26 |
# RUN: llvm-objcopy --strip-all %t.a %t.a |
| 27 |
# RUN: llvm-ar p %t.a > %t6 |
| 28 |
# RUN: cmp %t2 %t6 |
| 29 |
|
| 30 |
# RUN: cp %t %t7 |
| 31 |
# RUN: llvm-strip --strip-all %t7 |
| 32 |
# RUN: cmp %t2 %t7 |
| 33 |
|
| 34 |
# RUN: cp %t %t8 |
| 35 |
# RUN: llvm-objcopy -S %t8 %t8 |
| 36 |
# RUN: cmp %t2 %t8 |
| 37 |
|
| 38 |
# RUN: cp %t %t9 |
| 39 |
# RUN: llvm-strip -s %t9 |
| 40 |
# RUN: cmp %t2 %t9 |
| 41 |
|
| 42 |
# Verify that a non-existent symbol table (after first call to llvm-strip) |
| 43 |
# can be handled correctly. |
| 44 |
# RUN: cp %t %t10 |
| 45 |
# RUN: llvm-strip --strip-all --keep-symbol=unavailable_symbol %t10 |
| 46 |
# RUN: llvm-strip --strip-all --keep-symbol=unavailable_symbol %t10 |
| 47 |
# RUN: cmp %t2 %t10 |
| 48 |
|
| 49 |
!ELF |
| 50 |
FileHeader: |
| 51 |
Class: ELFCLASS64 |
| 52 |
Data: ELFDATA2LSB |
| 53 |
Type: ET_REL |
| 54 |
Machine: EM_X86_64 |
| 55 |
Sections: |
| 56 |
- Name: non_alloc_in_segment |
| 57 |
Type: SHT_PROGBITS |
| 58 |
Flags: [ ] |
| 59 |
Size: 4 |
| 60 |
- Name: .bss |
| 61 |
Type: SHT_NOBITS |
| 62 |
Flags: [ SHF_ALLOC ] |
| 63 |
- Name: .text |
| 64 |
Type: SHT_PROGBITS |
| 65 |
Flags: [ SHF_ALLOC, SHF_EXECINSTR ] |
| 66 |
- Name: .blarg |
| 67 |
Type: SHT_PROGBITS |
| 68 |
Flags: [ ] |
| 69 |
- Name: .gnu.warning.foo |
| 70 |
Type: SHT_PROGBITS |
| 71 |
- Name: .gnu_debuglink |
| 72 |
Type: SHT_PROGBITS |
| 73 |
ProgramHeaders: |
| 74 |
# Use an arbitrary segment type to show that the segment type is unimportant. |
| 75 |
- Type: 0x61234567 |
| 76 |
FirstSec: non_alloc_in_segment |
| 77 |
LastSec: non_alloc_in_segment |
| 78 |
|
| 79 |
# CHECK: SectionHeaderCount: 7 |
| 80 |
|
| 81 |
# CHECK: Name: non_alloc_in_segment |
| 82 |
# CHECK: Name: .bss |
| 83 |
# CHECK: Name: .text |
| 84 |
# CHECK: Name: .gnu.warning.foo |
| 85 |
# CHECK: Name: .gnu_debuglink |
| 86 |
# CHECK: Name: .shstrtab |