1## Test that only debug sections are kept with --only-keep-debug.
2# RUN: yaml2obj %s -o %t
3# RUN: llvm-strip --only-keep-debug %t
4# RUN: obj2yaml %t | FileCheck %s
5
6## Test that keep-section overrides only-keep-debug.
7# RUN: yaml2obj %s -o %t
8# RUN: llvm-strip --only-keep-debug --keep-section=foo %t
9# RUN: obj2yaml %t | FileCheck --implicit-check-not=Name --check-prefix=CHECK --check-prefix=KEEP %s
10
11## Test that keep-section overrides only-keep-debug, even for known sections.
12# RUN: yaml2obj %s -o %t
13# RUN: llvm-strip --only-keep-debug --keep-section=TYPE %t
14# RUN: obj2yaml %t | FileCheck --implicit-check-not=Name --check-prefix=CHECK --check-prefix=KEEPTYPE %s
15
16# CHECK:      Sections:
17# KEEPTYPE:     - Type: TYPE
18# CHECK:        - Type: CUSTOM
19# CHECK-NEXT:     Name: .debug_info
20# CHECK:        - Type: CUSTOM
21# CHECK-NEXT:     Name: .debug_line
22# KEEP:           Name: foo
23
24## Test that remove-section overrides only-keep-debug.
25# RUN: yaml2obj %s -o %t
26# RUN: llvm-strip --only-keep-debug --remove-section=.debug_info %t
27# RUN: obj2yaml %t | FileCheck %s --check-prefix=NOINFO --implicit-check-not=.debug_info
28
29# NOINFO: Name: .debug_line
30
31--- !WASM
32FileHeader:
33  Version: 0x00000001
34Sections:
35  - Type: TYPE
36    Signatures:
37      - Index: 0
38        ParamTypes:
39          - I32
40        ReturnTypes:
41          - F32
42  - Type: CUSTOM
43    Name: .debug_info
44    Payload: CAFE1234
45  - Type: CUSTOM
46    Name: linking
47    Version: 2
48  - Type: CUSTOM
49    Name: producers
50    Tools:
51      - Name:   clang
52        Version: 9.0.0
53  - Type: CUSTOM
54    Name: .debug_line
55    Payload: DEADBEEF
56  - Type: CUSTOM
57    Name: foo
58    Payload: CAFE
59