[PATCH] D96233: [WebAssembly] Use data sections by default
Sam Clegg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 9 11:03:34 PST 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7e7cfce0b688: [WebAssembly] Use data sections by default (authored by sbc100).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96233/new/
https://reviews.llvm.org/D96233
Files:
llvm/lib/MC/MCParser/WasmAsmParser.cpp
llvm/test/MC/WebAssembly/data-section-combined.s
Index: llvm/test/MC/WebAssembly/data-section-combined.s
===================================================================
--- /dev/null
+++ llvm/test/MC/WebAssembly/data-section-combined.s
@@ -0,0 +1,37 @@
+# Test that placing multiple data symbols in the same section works
+
+# RUN: llvm-mc -triple=wasm32-unknown-unknown < %s | FileCheck %s
+
+test0:
+ .functype test0 () -> (i32)
+ i32.const a
+ i32.const b
+ end_function
+
+ .section mysec,"",@
+a:
+ .int32 42
+ .int32 43
+ .size a, 8
+b:
+ .int32 44
+ .size b, 4
+
+# CHECK: .section mysec,"",@
+# CHECK-NEXT: a:
+# CHECK-NEXT: .int32 42
+# CHECK-NEXT: .int32 43
+# CHECK-NEXT: .size a, 8
+# CHECK-NEXT: b:
+# CHECK-NEXT: .int32 44
+# CHECK-NEXT: .size b, 4
+
+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown < %s | llvm-objdump --triple=wasm32-unknown-unknown -d -t -r - | FileCheck %s --check-prefix=OBJ
+
+
+# OBJ: 00000001 <test0>:
+# OBJ: 3: 41 80 80 80 80 00 i32.const 0
+# OBJ-NEXT: 00000004: R_WASM_MEMORY_ADDR_SLEB a+0
+# OBJ-NEXT: 9: 41 88 80 80 80 00 i32.const 8
+# OBJ-NEXT: 0000000a: R_WASM_MEMORY_ADDR_SLEB b+0
+# OBJ-NEXT: f: 0b end
Index: llvm/lib/MC/MCParser/WasmAsmParser.cpp
===================================================================
--- llvm/lib/MC/MCParser/WasmAsmParser.cpp
+++ llvm/lib/MC/MCParser/WasmAsmParser.cpp
@@ -151,10 +151,7 @@
// TargetLoweringObjectFileWasm
.StartsWith(".init_array", SectionKind::getData())
.StartsWith(".debug_", SectionKind::getMetadata())
- .Default(Optional<SectionKind>());
- if (!Kind.hasValue())
- return Parser->Error(Lexer->getLoc(), "unknown section kind: " + Name);
-
+ .Default(SectionKind::getData());
// Update section flags if present in this .section directive
bool Passive = false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96233.322450.patch
Type: text/x-patch
Size: 2025 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210209/f55b2233/attachment.bin>
More information about the llvm-commits
mailing list