xref: /llvm-project/llvm/test/tools/llvm-objcopy/wasm/remove-section.test (revision c9dd1cc6f0536c6547f322107cd27cd953913f5c)
1## Test the --remove-section flag.
2# RUN: yaml2obj %s -o %t
3# RUN: llvm-objcopy -R producers %t %t2
4# RUN: obj2yaml %t2 | FileCheck --implicit-check-not=producers %s
5## Check that the producers section has been removed, but not the type section.
6# CHECK: TYPE
7
8## Requests to remove nonexistent sections are silently ignored.
9# RUN: llvm-objcopy --remove-section=nonexistent=%t.sec %t 2>&1 | count 0
10
11## Remove the type section.
12# RUN: llvm-objcopy -R TYPE %t %t3
13# RUN: obj2yaml %t3 | FileCheck --check-prefix=REMOVETYPE --implicit-check-not=TYPE %s
14## Check that the producers section is still there.
15# REMOVETYPE: producers
16
17--- !WASM
18FileHeader:
19  Version: 0x00000001
20Sections:
21  - Type: TYPE
22    Signatures:
23      - Index: 0
24        ParamTypes:
25          - I32
26        ReturnTypes:
27          - F32
28  - Type: CUSTOM
29    Name: producers
30    Tools:
31      - Name:   clang
32        Version: 9.0.0
33