xref: /llvm-project/llvm/test/tools/llvm-objcopy/wasm/section-header-size.test (revision 1b21067cf247c62c2442daa7ee2d3915249d1ee2)
1## Test that objcopy generates section headers that are identical to those from
2## the input binary, including the encoded size of the LEB that represents the
3## section size.
4
5# RUN: yaml2obj %s -o %t.wasm
6# RUN: llvm-objcopy %t.wasm %t.wasm.copy
7# RUN: diff %t.wasm %t.wasm.copy
8
9--- !WASM
10FileHeader:
11  Version:         0x1
12Sections:
13  - Type:            TYPE
14    HeaderSecSizeEncodingLen:   3
15    Signatures:
16      - Index:           0
17        ParamTypes:
18          - I32
19          - I32
20        ReturnTypes:
21          - I32
22  - Type:            FUNCTION
23    HeaderSecSizeEncodingLen:  4
24    FunctionTypes:             [ 0 ]
25  - Type:            MEMORY
26    HeaderSecSizeEncodingLen:  1
27    Memories:
28      - Flags:           [ HAS_MAX ]
29        Minimum:         0x100
30        Maximum:         0x100
31  - Type:            EXPORT
32    HeaderSecSizeEncodingLen:  5
33    Exports:
34      - Name:            add
35        Kind:            FUNCTION
36        Index:           0
37  - Type:            CODE
38    Functions:
39      - Index:           0
40        Locals:          []
41        Body:            200020016A0B
42