2017-11-14 06:02:07 +08:00
|
|
|
# RUN: yaml2obj %s > %t
|
2018-06-01 04:42:13 +08:00
|
|
|
# RUN: cp %t %t3
|
2017-11-14 06:02:07 +08:00
|
|
|
# RUN: llvm-objcopy --strip-all %t %t2
|
|
|
|
# RUN: llvm-readobj -file-headers -sections %t2 | FileCheck %s
|
|
|
|
|
2018-06-01 04:42:13 +08:00
|
|
|
# Verify that the previous llvm-objcopy's run has not modified the input.
|
|
|
|
# RUN: cmp %t %t3
|
2018-05-08 03:32:09 +08:00
|
|
|
|
|
|
|
# RUN: llvm-strip %t3
|
|
|
|
# RUN: cmp %t2 %t3
|
|
|
|
|
2018-06-01 04:42:13 +08:00
|
|
|
# RUN: cp %t %t4
|
|
|
|
# RUN: llvm-strip %t4 -o %t5
|
|
|
|
# RUN: cmp %t2 %t5
|
|
|
|
|
|
|
|
# Verify that the previous llvm-strip's run has not modified the input.
|
|
|
|
# RUN: cmp %t %t4
|
|
|
|
|
|
|
|
# RUN: cp %t %t-should-remain-the-same
|
|
|
|
# RUN: llvm-strip %t4 -o %t-should-remain-the-same -o %t-should-be-stripped
|
|
|
|
# RUN: cmp %t2 %t-should-be-stripped
|
|
|
|
# RUN: cmp %t %t-should-remain-the-same
|
|
|
|
|
2018-07-07 01:51:03 +08:00
|
|
|
# RUN: rm -f %t.a
|
|
|
|
# RUN: llvm-ar crs %t.a %t
|
|
|
|
# RUN: llvm-objcopy --strip-all %t.a %t.a
|
|
|
|
# RUN: llvm-ar p %t.a > %t6
|
|
|
|
# RUN: cmp %t2 %t6
|
|
|
|
|
2018-07-13 01:42:17 +08:00
|
|
|
# RUN: cp %t %t7
|
|
|
|
# RUN: llvm-strip -strip-all %t7
|
|
|
|
# RUN: cmp %t2 %t7
|
|
|
|
|
|
|
|
# RUN: cp %t %t8
|
|
|
|
# RUN: llvm-strip --strip-all %t8
|
|
|
|
# RUN: cmp %t2 %t8
|
|
|
|
|
2018-10-10 05:14:09 +08:00
|
|
|
# RUN: cp %t %t9
|
|
|
|
# RUN: llvm-objcopy -S %t9 %t9
|
|
|
|
# RUN: cmp %t2 %t9
|
|
|
|
|
[llvm-strip] Support -s alias for --strip-all. Make both strip and objcopy case sensitive to support both -s (--strip-all) and -S (--strip-debug).
Summary:
GNU strip supports both `-s` and `-S` as aliases for `--strip-all` and `--strip-debug`, respectfully.
As part of this, it turns out that strip/objcopy were accepting case insensitive command line args. I'm not sure if there was an explicit reason for this. The only others uses of this are llvm-cvtres/llvm-mt/llvm-lib, which are all tools specific for windows support. Forcing case sensitivity allows both aliases to exist, but seems like a good idea anyway.
And as a surprise test case adjustment, the llvm-strip unit test was running with `-keep=unavailable_symbol`, despite `keep` not be a valid flag for strip. This is because there is a flag `-K` which, when case insensitivity is permitted, allows it to be interpreted as `-K` = `eep=unavailable_symbol` (e.g. to allow `-Kfoo` == `--keep-symbol=foo`).
Reviewers: jakehehrlich, jhenderson, alexshap
Reviewed By: jakehehrlich
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D53163
llvm-svn: 345068
2018-10-24 02:46:33 +08:00
|
|
|
# RUN: cp %t %t10
|
|
|
|
# RUN: llvm-strip -s %t10
|
|
|
|
# RUN: cmp %t2 %t10
|
|
|
|
|
2018-07-27 04:05:31 +08:00
|
|
|
# Verify that a non-existent symbol table (after first call to llvm-strip)
|
|
|
|
# can be handled correctly.
|
[llvm-strip] Support -s alias for --strip-all. Make both strip and objcopy case sensitive to support both -s (--strip-all) and -S (--strip-debug).
Summary:
GNU strip supports both `-s` and `-S` as aliases for `--strip-all` and `--strip-debug`, respectfully.
As part of this, it turns out that strip/objcopy were accepting case insensitive command line args. I'm not sure if there was an explicit reason for this. The only others uses of this are llvm-cvtres/llvm-mt/llvm-lib, which are all tools specific for windows support. Forcing case sensitivity allows both aliases to exist, but seems like a good idea anyway.
And as a surprise test case adjustment, the llvm-strip unit test was running with `-keep=unavailable_symbol`, despite `keep` not be a valid flag for strip. This is because there is a flag `-K` which, when case insensitivity is permitted, allows it to be interpreted as `-K` = `eep=unavailable_symbol` (e.g. to allow `-Kfoo` == `--keep-symbol=foo`).
Reviewers: jakehehrlich, jhenderson, alexshap
Reviewed By: jakehehrlich
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D53163
llvm-svn: 345068
2018-10-24 02:46:33 +08:00
|
|
|
# RUN: cp %t %t11
|
|
|
|
# RUN: llvm-strip --strip-all --keep-symbol=unavailable_symbol %t11
|
|
|
|
# RUN: llvm-strip --strip-all --keep-symbol=unavailable_symbol %t11
|
|
|
|
# RUN: cmp %t2 %t11
|
2018-07-27 04:05:31 +08:00
|
|
|
|
2017-11-14 06:02:07 +08:00
|
|
|
!ELF
|
|
|
|
FileHeader:
|
|
|
|
Class: ELFCLASS64
|
|
|
|
Data: ELFDATA2LSB
|
|
|
|
Type: ET_REL
|
|
|
|
Machine: EM_X86_64
|
|
|
|
Sections:
|
2017-11-28 02:56:01 +08:00
|
|
|
- Name: .bss
|
2017-11-14 06:02:07 +08:00
|
|
|
Type: SHT_NOBITS
|
2017-11-28 02:56:01 +08:00
|
|
|
Flags: [ SHF_ALLOC ]
|
2017-11-14 06:02:07 +08:00
|
|
|
- Name: .text
|
|
|
|
Type: SHT_PROGBITS
|
|
|
|
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
2017-11-28 02:56:01 +08:00
|
|
|
- Name: .blarg
|
2017-11-14 06:02:07 +08:00
|
|
|
Type: SHT_PROGBITS
|
|
|
|
Flags: [ ]
|
2017-11-28 02:56:01 +08:00
|
|
|
- Name: .gnu.warning.foo
|
2017-11-14 06:02:07 +08:00
|
|
|
Type: SHT_PROGBITS
|
|
|
|
|
2017-11-28 02:56:01 +08:00
|
|
|
# CHECK: SectionHeaderCount: 5
|
2017-11-14 06:02:07 +08:00
|
|
|
|
2017-11-28 02:56:01 +08:00
|
|
|
# CHECK: Name: .bss
|
|
|
|
# CHECK: Name: .text
|
|
|
|
# CHECK: Name: .gnu.warning.foo
|
|
|
|
# CHECK: Name: .shstrtab
|