aboutsummaryrefslogtreecommitdiff
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/MC/MCContext.cpp1
-rw-r--r--llvm/test/MC/WebAssembly/section-symbol.s16
2 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp
index 7d5a1db..0902a15 100644
--- a/llvm/lib/MC/MCContext.cpp
+++ b/llvm/lib/MC/MCContext.cpp
@@ -656,6 +656,7 @@ MCSectionWasm *MCContext::getWasmSection(const Twine &Section, SectionKind Kind,
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())
diff --git a/llvm/test/MC/WebAssembly/section-symbol.s b/llvm/test/MC/WebAssembly/section-symbol.s
new file mode 100644
index 0000000..b55221c
--- /dev/null
+++ b/llvm/test/MC/WebAssembly/section-symbol.s
@@ -0,0 +1,16 @@
+# 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.
+
+# TODO: fix the 0-suffix: https://bugs.llvm.org/show_bug.cgi?id=49252
+
+ .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