xref: /llvm-project/llvm/test/tools/llvm-objcopy/wasm/basic-keep.test (revision 7cb25f53875e5490bccaf297accd34b7331cfb8b)
1## Test that --keep-section keeps a debug section when stripping.
2# RUN: yaml2obj %s -o %t
3# RUN: llvm-objcopy --strip-all --keep-section=.debug_info %t %t2
4# RUN: obj2yaml %t2 | FileCheck --implicit-check-not linking %s
5
6# CHECK:      Sections:
7# CHECK:        Name: .debug_info
8# CHECK-NEXT:   Payload: DEADBEEF
9
10## Test that keep overrides an explicit removal.
11# RUN: llvm-objcopy --remove-section=.debug_info --keep-section=.debug_info %t %t2
12# RUN: obj2yaml %t2 | FileCheck %s --check-prefix=KEEP
13
14# KEEP: Sections:
15# KEEP:   Name: .debug_info
16
17--- !WASM
18FileHeader:
19  Version: 0x00000001
20Sections:
21  - Type: CUSTOM
22    Name: linking
23    Version: 2
24  - Type: CUSTOM
25    Name: .debug_info
26    Payload: DEADBEEF
27