[PATCH] D99960: [WebAssembly] Improve error messages regarding missing indirect function table. NFC

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 6 08:09:18 PDT 2021


sbc100 created this revision.
Herald added subscribers: wingo, ecnelises, sunfish, hiraditya, jgravelle-google, dschuff.
sbc100 requested review of this revision.
Herald added subscribers: llvm-commits, aheejin.
Herald added a project: LLVM.

Use report_fatal_error here since this is an internal error, and not
something the user can/should be trying to fix.

Also distinguish between the symbol being missing and the symbol having
the wrong type.

We have a failure internally where the symbol is missing.  Currently
trying to reduce the test case to something we can attach to an llvm
bug.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99960

Files:
  llvm/lib/MC/WasmObjectWriter.cpp


Index: llvm/lib/MC/WasmObjectWriter.cpp
===================================================================
--- llvm/lib/MC/WasmObjectWriter.cpp
+++ llvm/lib/MC/WasmObjectWriter.cpp
@@ -536,11 +536,11 @@
     // We require the function table to have already been defined.
     auto TableName = "__indirect_function_table";
     MCSymbolWasm *Sym = cast_or_null<MCSymbolWasm>(Ctx.lookupSymbol(TableName));
-    if (!Sym || !Sym->isFunctionTable()) {
-      Ctx.reportError(
-          Fixup.getLoc(),
-          "symbol '__indirect_function_table' is not a function table");
+    if (!Sym) {
+      report_fatal_error("missing indirect function table symbol");
     } else {
+      if (!Sym->isFunctionTable())
+        report_fatal_error("__indirect_function_table symble has wrong type");
       // Ensure that __indirect_function_table reaches the output.
       Sym->setNoStrip();
       Asm.registerSymbol(*Sym);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99960.335513.patch
Type: text/x-patch
Size: 917 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210406/031ddeef/attachment.bin>


More information about the llvm-commits mailing list