blob: dabb9ef6a91a9ab0d9fa44384affacd96888105f [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
Jordan Rupprecht298ea3f2019-01-11 18:06:31 +00004# RUN: llvm-readobj --file-headers --sections %t2 | FileCheck %s
Jake Ehrlichfabddf12017-11-13 22:02:07 +00005
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
Fangrui Song2db79e92019-04-26 02:10:10 +000031# RUN: llvm-strip --strip-all %t7
Stephen Hinese8c3c5f2018-07-12 17:42:17 +000032# RUN: cmp %t2 %t7
33
34# RUN: cp %t %t8
Fangrui Song2db79e92019-04-26 02:10:10 +000035# RUN: llvm-objcopy -S %t8 %t8
Stephen Hinese8c3c5f2018-07-12 17:42:17 +000036# RUN: cmp %t2 %t8
37
Jake Ehrlich5e498462018-10-09 21:14:09 +000038# RUN: cp %t %t9
Fangrui Song2db79e92019-04-26 02:10:10 +000039# RUN: llvm-strip -s %t9
Jake Ehrlich5e498462018-10-09 21:14:09 +000040# RUN: cmp %t2 %t9
41
Stephen Hinese6e75bf2018-07-26 20:05:31 +000042# Verify that a non-existent symbol table (after first call to llvm-strip)
43# can be handled correctly.
Fangrui Song2db79e92019-04-26 02:10:10 +000044# 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
Stephen Hinese6e75bf2018-07-26 20:05:31 +000048
Jake Ehrlichfabddf12017-11-13 22:02:07 +000049!ELF
50FileHeader:
51 Class: ELFCLASS64
52 Data: ELFDATA2LSB
53 Type: ET_REL
54 Machine: EM_X86_64
55Sections:
James Hendersonb5de5e22019-03-14 11:47:41 +000056 - Name: non_alloc_in_segment
57 Type: SHT_PROGBITS
58 Flags: [ ]
59 Size: 4
Jake Ehrlich6ad72d02017-11-27 18:56:01 +000060 - Name: .bss
Jake Ehrlichfabddf12017-11-13 22:02:07 +000061 Type: SHT_NOBITS
Jake Ehrlich6ad72d02017-11-27 18:56:01 +000062 Flags: [ SHF_ALLOC ]
Jake Ehrlichfabddf12017-11-13 22:02:07 +000063 - Name: .text
64 Type: SHT_PROGBITS
65 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
Jake Ehrlich6ad72d02017-11-27 18:56:01 +000066 - Name: .blarg
Jake Ehrlichfabddf12017-11-13 22:02:07 +000067 Type: SHT_PROGBITS
68 Flags: [ ]
Jake Ehrlich6ad72d02017-11-27 18:56:01 +000069 - Name: .gnu.warning.foo
Jake Ehrlichfabddf12017-11-13 22:02:07 +000070 Type: SHT_PROGBITS
James Hendersonb5de5e22019-03-14 11:47:41 +000071ProgramHeaders:
72 # Use an arbitrary segment type to show that the segment type is unimportant.
73 - Type: 0x61234567
74 Sections:
75 - Section: non_alloc_in_segment
Jake Ehrlichfabddf12017-11-13 22:02:07 +000076
James Hendersonb5de5e22019-03-14 11:47:41 +000077# CHECK: SectionHeaderCount: 6
Jake Ehrlichfabddf12017-11-13 22:02:07 +000078
James Hendersonb5de5e22019-03-14 11:47:41 +000079# CHECK: Name: non_alloc_in_segment
Jake Ehrlich6ad72d02017-11-27 18:56:01 +000080# CHECK: Name: .bss
81# CHECK: Name: .text
82# CHECK: Name: .gnu.warning.foo
83# CHECK: Name: .shstrtab