[llvm] r320639 - [WebAssembly] Add linking metatdata test coverage for wasm2yaml
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 13 13:53:40 PST 2017
Author: sbc
Date: Wed Dec 13 13:53:40 2017
New Revision: 320639
URL: http://llvm.org/viewvc/llvm-project?rev=320639&view=rev
Log:
[WebAssembly] Add linking metatdata test coverage for wasm2yaml
Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish
Differential Revision: https://reviews.llvm.org/D41196
Added:
llvm/trunk/test/ObjectYAML/wasm/linking_section.yaml
Modified:
llvm/trunk/include/llvm/BinaryFormat/Wasm.h
llvm/trunk/tools/yaml2obj/yaml2wasm.cpp
Modified: llvm/trunk/include/llvm/BinaryFormat/Wasm.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/Wasm.h?rev=320639&r1=320638&r2=320639&view=diff
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/Wasm.h (original)
+++ llvm/trunk/include/llvm/BinaryFormat/Wasm.h Wed Dec 13 13:53:40 2017
@@ -184,7 +184,6 @@ enum class ValType {
enum : unsigned {
WASM_SYMBOL_INFO = 0x2,
WASM_DATA_SIZE = 0x3,
- WASM_DATA_ALIGNMENT = 0x4,
WASM_SEGMENT_INFO = 0x5,
};
Added: llvm/trunk/test/ObjectYAML/wasm/linking_section.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ObjectYAML/wasm/linking_section.yaml?rev=320639&view=auto
==============================================================================
--- llvm/trunk/test/ObjectYAML/wasm/linking_section.yaml (added)
+++ llvm/trunk/test/ObjectYAML/wasm/linking_section.yaml Wed Dec 13 13:53:40 2017
@@ -0,0 +1,60 @@
+# RUN: yaml2obj %s | obj2yaml | FileCheck %s
+--- !WASM
+FileHeader:
+ Version: 0x00000001
+Sections:
+ - Type: TYPE
+ Signatures:
+ - ReturnType: I32
+ ParamTypes:
+ - I32
+ - Type: IMPORT
+ Imports:
+ - Module: foo
+ Field: bar
+ Kind: FUNCTION
+ SigIndex: 0
+ - Type: DATA
+ Segments:
+ - MemoryIndex: 0
+ Offset:
+ Opcode: I32_CONST
+ Value: 4
+ Content: '10001000'
+ - MemoryIndex: 0
+ Offset:
+ Opcode: I32_CONST
+ Value: 8
+ Content: '11110000'
+ - Type: CUSTOM
+ Name: linking
+ DataSize: 999
+ SymbolInfo:
+ - Name: bar
+ Flags: 1
+ SegmentInfo:
+ - Index: 0
+ Alignment: 4
+ Flags: 0
+ Name: mydata
+ - Index: 1
+ Alignment: 2
+ Flags: 1
+ Name: moredata
+...
+# CHECK: - Type: CUSTOM
+# CHECK-NEXT: Name: linking
+# CHECK-NEXT: DataSize: 999
+# CHECK-NEXT: SymbolInfo:
+# CHECK-NEXT: - Name: bar
+# CHECK-NEXT: Flags: 1
+# CHECK-NEXT: SegmentInfo:
+# CHECK-NEXT: - Index: 0
+# CHECK-NEXT: Name: mydata
+# CHECK-NEXT: Alignment: 4
+# CHECK-NEXT: Flags: 0
+# CHECK-NEXT: - Index: 1
+# CHECK-NEXT: Name: moredata
+# CHECK-NEXT: Alignment: 2
+# CHECK-NEXT: Flags: 1
+# CHECK-NEXT: ...
Modified: llvm/trunk/tools/yaml2obj/yaml2wasm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/yaml2obj/yaml2wasm.cpp?rev=320639&r1=320638&r2=320639&view=diff
==============================================================================
--- llvm/trunk/tools/yaml2obj/yaml2wasm.cpp (original)
+++ llvm/trunk/tools/yaml2obj/yaml2wasm.cpp Wed Dec 13 13:53:40 2017
@@ -156,7 +156,6 @@ int WasmWriter::writeSectionContent(raw_
encodeULEB128(wasm::WASM_SEGMENT_INFO, OS);
encodeULEB128(Section.SegmentInfos.size(), SubSection.GetStream());
for (const WasmYAML::SegmentInfo &SegmentInfo : Section.SegmentInfos) {
- encodeULEB128(SegmentInfo.Index, SubSection.GetStream());
writeStringRef(SegmentInfo.Name, SubSection.GetStream());
encodeULEB128(SegmentInfo.Alignment, SubSection.GetStream());
encodeULEB128(SegmentInfo.Flags, SubSection.GetStream());
More information about the llvm-commits
mailing list