llvm.org GIT mirror llvm / 2b46be6
[WebAssembly] Add linking metatdata test coverage for wasm2yaml Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish Differential Revision: https://reviews.llvm.org/D41196 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320639 91177308-0d34-0410-b5e6-96231b3b80d8 Sam Clegg 1 year, 9 months ago
3 changed file(s) with 60 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
183183 enum : unsigned {
184184 WASM_SYMBOL_INFO = 0x2,
185185 WASM_DATA_SIZE = 0x3,
186 WASM_DATA_ALIGNMENT = 0x4,
187186 WASM_SEGMENT_INFO = 0x5,
188187 };
189188
0 # RUN: yaml2obj %s | obj2yaml | FileCheck %s
1 --- !WASM
2 FileHeader:
3 Version: 0x00000001
4 Sections:
5 - Type: TYPE
6 Signatures:
7 - ReturnType: I32
8 ParamTypes:
9 - I32
10 - Type: IMPORT
11 Imports:
12 - Module: foo
13 Field: bar
14 Kind: FUNCTION
15 SigIndex: 0
16 - Type: DATA
17 Segments:
18 - MemoryIndex: 0
19 Offset:
20 Opcode: I32_CONST
21 Value: 4
22 Content: '10001000'
23 - MemoryIndex: 0
24 Offset:
25 Opcode: I32_CONST
26 Value: 8
27 Content: '11110000'
28 - Type: CUSTOM
29 Name: linking
30 DataSize: 999
31 SymbolInfo:
32 - Name: bar
33 Flags: 1
34 SegmentInfo:
35 - Index: 0
36 Alignment: 4
37 Flags: 0
38 Name: mydata
39 - Index: 1
40 Alignment: 2
41 Flags: 1
42 Name: moredata
43 ...
44 # CHECK: - Type: CUSTOM
45 # CHECK-NEXT: Name: linking
46 # CHECK-NEXT: DataSize: 999
47 # CHECK-NEXT: SymbolInfo:
48 # CHECK-NEXT: - Name: bar
49 # CHECK-NEXT: Flags: 1
50 # CHECK-NEXT: SegmentInfo:
51 # CHECK-NEXT: - Index: 0
52 # CHECK-NEXT: Name: mydata
53 # CHECK-NEXT: Alignment: 4
54 # CHECK-NEXT: Flags: 0
55 # CHECK-NEXT: - Index: 1
56 # CHECK-NEXT: Name: moredata
57 # CHECK-NEXT: Alignment: 2
58 # CHECK-NEXT: Flags: 1
59 # CHECK-NEXT: ...
155155 encodeULEB128(wasm::WASM_SEGMENT_INFO, OS);
156156 encodeULEB128(Section.SegmentInfos.size(), SubSection.GetStream());
157157 for (const WasmYAML::SegmentInfo &SegmentInfo : Section.SegmentInfos) {
158 encodeULEB128(SegmentInfo.Index, SubSection.GetStream());
159158 writeStringRef(SegmentInfo.Name, SubSection.GetStream());
160159 encodeULEB128(SegmentInfo.Alignment, SubSection.GetStream());
161160 encodeULEB128(SegmentInfo.Flags, SubSection.GetStream());