[PATCH] D119794: [WebAssembly] Allow .data shorthand for .section .data.0,"",@
Wouter van Oortmerssen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 22 10:22:27 PST 2022
aardappel updated this revision to Diff 410583.
aardappel added a comment.
Addressed comment
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119794/new/
https://reviews.llvm.org/D119794
Files:
llvm/lib/MC/MCParser/WasmAsmParser.cpp
llvm/test/MC/WebAssembly/basic-assembly.s
Index: llvm/test/MC/WebAssembly/basic-assembly.s
===================================================================
--- llvm/test/MC/WebAssembly/basic-assembly.s
+++ llvm/test/MC/WebAssembly/basic-assembly.s
@@ -137,6 +137,9 @@
.int32 2000000000
.size .L.str, 28
+ .data
+ .int8 73
+
.section .init_array.42,"",@
.p2align 2
.int32 test0
@@ -272,6 +275,10 @@
# CHECK-NEXT: .int32 2000000000
# CHECK-NEXT: .size .L.str, 28
+# CHECK: .data
+# CHECK-EMPTY:
+# CHECK-NEXT: .int8 73
+
# CHECK: .section .init_array.42,"",@
# CHECK-NEXT: .p2align 2
# CHECK-NEXT: .int32 test0
Index: llvm/lib/MC/MCParser/WasmAsmParser.cpp
===================================================================
--- llvm/lib/MC/MCParser/WasmAsmParser.cpp
+++ llvm/lib/MC/MCParser/WasmAsmParser.cpp
@@ -21,6 +21,7 @@
#include "llvm/MC/MCParser/MCAsmLexer.h"
#include "llvm/MC/MCParser/MCAsmParser.h"
#include "llvm/MC/MCParser/MCAsmParserExtension.h"
+#include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/MC/MCSectionWasm.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbolWasm.h"
@@ -52,6 +53,7 @@
this->MCAsmParserExtension::Initialize(*Parser);
addDirectiveHandler<&WasmAsmParser::parseSectionDirectiveText>(".text");
+ addDirectiveHandler<&WasmAsmParser::parseSectionDirectiveData>(".data");
addDirectiveHandler<&WasmAsmParser::parseSectionDirective>(".section");
addDirectiveHandler<&WasmAsmParser::parseDirectiveSize>(".size");
addDirectiveHandler<&WasmAsmParser::parseDirectiveType>(".type");
@@ -89,6 +91,12 @@
return false;
}
+ bool parseSectionDirectiveData(StringRef, SMLoc) {
+ auto *S = getContext().getObjectFileInfo()->getDataSection();
+ getStreamer().SwitchSection(S);
+ return false;
+ }
+
uint32_t parseSectionFlags(StringRef FlagStr, bool &Passive, bool &Group) {
uint32_t flags = 0;
for (char C : FlagStr) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119794.410583.patch
Type: text/x-patch
Size: 2021 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220222/683bb5da/attachment.bin>
More information about the llvm-commits
mailing list