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-NOT:    - Type: TYPE
19# CHECK:        - Type: CUSTOM
20# CHECK-NEXT:     Name: .debug_info
21# CHECK:        - Type: CUSTOM
22# CHECK-NEXT:     Name: .debug_line
23# KEEP:           Name: foo
24
25## Test that remove-section overrides only-keep-debug.
26# RUN: yaml2obj %s -o %t
27# RUN: llvm-strip --only-keep-debug --remove-section=.debug_info %t
28# RUN: obj2yaml %t | FileCheck %s --check-prefix=NOINFO --implicit-check-not=.debug_info
29
30# NOINFO: Name: .debug_line
31
32--- !WASM
33FileHeader:
34  Version: 0x00000001
35Sections:
36  - Type: TYPE
37    Signatures:
38      - Index: 0
39        ParamTypes:
40          - I32
41        ReturnTypes:
42          - F32
43  - Type: CUSTOM
44    Name: .debug_info
45    Payload: CAFE1234
46  - Type: CUSTOM
47    Name: linking
48    Version: 2
49  - Type: CUSTOM
50    Name: producers
51    Tools:
52      - Name:   clang
53        Version: 9.0.0
54  - Type: CUSTOM
55    Name: .debug_line
56    Payload: DEADBEEF
57  - Type: CUSTOM
58    Name: foo
59    Payload: CAFE
60