Summary: Add support for the basic section stripping (and keeping) flags for wasm: strip with no flags, --strip-all, --strip-debug, --only-section, --keep-section, and --only-keep-debug. Factor section removal into a function and use a predicate chain like the ELF implementation. Reviewers: jhenderson, sbc100 Differential Revision: https://reviews.llvm.org/D73820
27 lines
715 B
Plaintext
27 lines
715 B
Plaintext
## Test that --keep-section keeps a debug section when stripping.
|
|
# RUN: yaml2obj %s -o %t
|
|
# RUN: llvm-objcopy --strip-all --keep-section=.debug_info %t %t2
|
|
# RUN: obj2yaml %t2 | FileCheck --implicit-check-not linking %s
|
|
|
|
# CHECK: Sections:
|
|
# CHECK: Name: .debug_info
|
|
# CHECK-NEXT: Payload: DEADBEEF
|
|
|
|
## Test that keep overrides an explicit removal.
|
|
# RUN: llvm-objcopy --remove-section=.debug_info --keep-section=.debug_info %t %t2
|
|
# RUN: obj2yaml %t2 | FileCheck %s --check-prefix=KEEP
|
|
|
|
# KEEP: Sections:
|
|
# KEEP: Name: .debug_info
|
|
|
|
--- !WASM
|
|
FileHeader:
|
|
Version: 0x00000001
|
|
Sections:
|
|
- Type: CUSTOM
|
|
Name: linking
|
|
Version: 2
|
|
- Type: CUSTOM
|
|
Name: .debug_info
|
|
Payload: DEADBEEF
|