blob: bc01835a4cb77cee6635660a29e9ce0304fe2aab [file] [log] [blame]
Jake Ehrlichfabddf12017-11-13 22:02:07 +00001# RUN: yaml2obj %s > %t
Alexander Shaposhnikovecc84832018-05-31 20:42:13 +00002# RUN: cp %t %t3
Jake Ehrlichfabddf12017-11-13 22:02:07 +00003# RUN: llvm-objcopy --strip-all %t %t2
4# RUN: llvm-readobj -file-headers -sections %t2 | FileCheck %s
5
Alexander Shaposhnikovecc84832018-05-31 20:42:13 +00006# Verify that the previous llvm-objcopy's run has not modified the input.
7# RUN: cmp %t %t3
Alexander Shaposhnikovcca69982018-05-07 19:32:09 +00008
Alexander Shaposhnikovcca69982018-05-07 19:32:09 +00009# RUN: llvm-strip %t3
Alexander Shaposhnikovcca69982018-05-07 19:32:09 +000010# RUN: cmp %t2 %t3
11
Alexander Shaposhnikovecc84832018-05-31 20:42:13 +000012# 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
Alexander Shaposhnikov42b5ef02018-07-06 17:51:03 +000024# 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
Stephen Hinese8c3c5f2018-07-12 17:42:17 +000030# 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-strip --strip-all %t8
36# RUN: cmp %t2 %t8
37
Stephen Hinese6e75bf2018-07-26 20:05:31 +000038# Verify that a non-existent symbol table (after first call to llvm-strip)
39# can be handled correctly.
40# RUN: cp %t %t9
41# RUN: llvm-strip --strip-all -keep=unavailable_symbol %t9
42# RUN: llvm-strip --strip-all -keep=unavailable_symbol %t9
43# RUN: cmp %t2 %t9
44
Jake Ehrlichfabddf12017-11-13 22:02:07 +000045!ELF
46FileHeader:
47 Class: ELFCLASS64
48 Data: ELFDATA2LSB
49 Type: ET_REL
50 Machine: EM_X86_64
51Sections:
Jake Ehrlich6ad72d02017-11-27 18:56:01 +000052 - Name: .bss
Jake Ehrlichfabddf12017-11-13 22:02:07 +000053 Type: SHT_NOBITS
Jake Ehrlich6ad72d02017-11-27 18:56:01 +000054 Flags: [ SHF_ALLOC ]
Jake Ehrlichfabddf12017-11-13 22:02:07 +000055 - Name: .text
56 Type: SHT_PROGBITS
57 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
Jake Ehrlich6ad72d02017-11-27 18:56:01 +000058 - Name: .blarg
Jake Ehrlichfabddf12017-11-13 22:02:07 +000059 Type: SHT_PROGBITS
60 Flags: [ ]
Jake Ehrlich6ad72d02017-11-27 18:56:01 +000061 - Name: .gnu.warning.foo
Jake Ehrlichfabddf12017-11-13 22:02:07 +000062 Type: SHT_PROGBITS
Jake Ehrlichfabddf12017-11-13 22:02:07 +000063
Jake Ehrlich6ad72d02017-11-27 18:56:01 +000064# CHECK: SectionHeaderCount: 5
Jake Ehrlichfabddf12017-11-13 22:02:07 +000065
Jake Ehrlich6ad72d02017-11-27 18:56:01 +000066# CHECK: Name: .bss
67# CHECK: Name: .text
68# CHECK: Name: .gnu.warning.foo
69# CHECK: Name: .shstrtab