[PATCH] D96473: [WebAssembly] Fix assert in lookup of section symbols
Wouter van Oortmerssen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 10 17:37:35 PST 2021
aardappel updated this revision to Diff 322878.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96473/new/
https://reviews.llvm.org/D96473
Files:
llvm/lib/MC/MCContext.cpp
llvm/test/MC/WebAssembly/section-symbol.s
Index: llvm/test/MC/WebAssembly/section-symbol.s
===================================================================
--- /dev/null
+++ llvm/test/MC/WebAssembly/section-symbol.s
@@ -0,0 +1,14 @@
+# RUN: llvm-mc -triple=wasm32 < %s | FileCheck %s
+
+# check that we can refer to section symbols of other sections.
+# getWasmSection currently forces the section symbol to have a suffix.
+
+ .section .debug_abbrev,"",@
+ .int8 1
+ .section .debug_info,"",@
+ .int32 .debug_abbrev0
+
+# CHECK: .section .debug_abbrev,"",@
+# CHECK-NEXT: .int8 1
+# CHECK-NEXT: .section .debug_info,"",@
+# CHECK-NEXT: .int32 .debug_abbrev0
Index: llvm/lib/MC/MCContext.cpp
===================================================================
--- llvm/lib/MC/MCContext.cpp
+++ llvm/lib/MC/MCContext.cpp
@@ -652,6 +652,7 @@
StringRef CachedName = Entry.first.SectionName;
MCSymbol *Begin = createSymbol(CachedName, true, false);
+ Symbols[Begin->getName()] = Begin;
cast<MCSymbolWasm>(Begin)->setType(wasm::WASM_SYMBOL_TYPE_SECTION);
MCSectionWasm *Result = new (WasmAllocator.Allocate())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96473.322878.patch
Type: text/x-patch
Size: 1145 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210211/d8473ba9/attachment.bin>
More information about the llvm-commits
mailing list