xref: /llvm-project/llvm/test/tools/llvm-objcopy/wasm/strip-reloc.test (revision 2a6136e552d24b6bf665c42a6e32efc0b2d88fbf)
1## Test that linking, reloc, and name sections are stripped by --strip-all.
2
3## These get a separate test because ObjectYaml understands relocs and names,
4## so the test needs to be a valid object with relocs and names.
5
6# RUN: yaml2obj %s -o %t
7# RUN: llvm-objcopy --strip-all %t %t2
8# RUN: obj2yaml %t2 | FileCheck %s
9
10## Check that the known sections are still present.
11# CHECK: Sections:
12# CHECK: - Type: TYPE
13# CHECK: - Type: FUNCTION
14# CHECK: - Type: CODE
15# CHECK-NOT: Relocations
16# CHECK-NOT: linking
17## Check that there are still functions in the code section.
18# CHECK: Functions:
19
20--- !WASM
21FileHeader:
22  Version:         0x00000001
23Sections:
24  - Type:            TYPE
25    Signatures:
26      - Index:           0
27        ParamTypes:      []
28        ReturnTypes:     []
29  - Type:            FUNCTION
30    FunctionTypes:   [ 0 ]
31  - Type:            CODE
32    Relocations:
33      - Type:            R_WASM_FUNCTION_INDEX_LEB
34        Index:           0
35        Offset:          0x4
36    Functions:
37      - Index:           0
38        Locals:          []
39        Body:            1080808080000B
40  - Type:            CUSTOM
41    Name:            linking
42    Version:         2
43    SymbolTable:
44      - Index:           0
45        Kind:            FUNCTION
46        Name:            foo
47        Flags:           [ BINDING_LOCAL ]
48        Function:        0
49  - Type:            CUSTOM
50    Name:            name
51    FunctionNames:
52       - Index:          0
53         Name:           foo
54