Files
clang-p2996/llvm/test/tools/llvm-objcopy/wasm/basic-only-section.test
Sam Clegg 2a6136e552 [llvm-objcopy][WebAssembly] Allow --strip-debug to operate on relocatable files. (#102978)
This change is enough to allow `--strip-debug` to work on object files,
without breaking the relocation information or symbol table.

A more complete version of this change would instead reconstruct the
symbol table and relocation sections, but that is much larger change.

Bug: #102002
2024-08-19 21:52:17 -07:00

46 lines
1.4 KiB
Plaintext

## Test --only-section.
# RUN: yaml2obj %s -o %t
# RUN: llvm-objcopy --only-section=foo %t %t2
# RUN: obj2yaml %t2 | FileCheck --implicit-check-not TYPE --implicit-check-not producers %s
## Test that it's the same with only-section + keep-section (for the same section).
# RUN: llvm-objcopy --only-section=foo --keep-section=foo %t %t2
# RUN: obj2yaml %t2 | FileCheck --implicit-check-not TYPE --implicit-check-not producers %s
## Also test that only-section overrides remove-section.
# RUN: llvm-objcopy --only-section=foo --remove-section=foo %t %t2
# RUN: obj2yaml %t2 | FileCheck --implicit-check-not producers %s
## This file has both known and custom sections. Check that only the foo section is left.
# CHECK: Sections:
# CHECK-NEXT: - Type: CUSTOM
# CHECK-NEXT: Name: foo
# CHECK-NEXT: Payload: DEADBEEF
# CHECK-NEXT: ...
## Test that only-section + keep-section keeps both sections.
# RUN: llvm-objcopy --only-section=foo --keep-section=producers %t %t2
# RUN: obj2yaml %t2 | FileCheck --implicit-check-not=TYPE --check-prefix=KEEP %s
# KEEP: Name: foo
# KEEP: Name: producers
--- !WASM
FileHeader:
Version: 0x00000001
Sections:
- Type: CUSTOM
Name: foo
Payload: DEADBEEF
- Type: TYPE
Signatures:
- Index: 0
ParamTypes:
- I32
ReturnTypes:
- F32
- Type: CUSTOM
Name: producers
Tools:
- Name: clang
Version: 9.0.0