[PATCH] D96473: [WebAssembly] Fix assert in lookup of section symbols

Wouter van Oortmerssen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 18 11:50:57 PST 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG508aa69e9dbc: [WebAssembly] Fix assert in lookup of section symbols (authored by aardappel).

Repository:
  rG LLVM Github Monorepo

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,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
Index: llvm/lib/MC/MCContext.cpp
===================================================================
--- llvm/lib/MC/MCContext.cpp
+++ llvm/lib/MC/MCContext.cpp
@@ -656,6 +656,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.324719.patch
Type: text/x-patch
Size: 1218 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210218/2fe11d82/attachment.bin>


More information about the llvm-commits mailing list