aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/WasmObjectWriter.cpp
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2021-04-06 08:06:18 -0700
committerSam Clegg <sbc@chromium.org>2021-04-07 07:58:43 -0700
commitf23b259e1877115794c0bb5654a329c7bdefadb0 (patch)
tree124cedea9ab9ad022e4a0f95109ede35d0c84e9c /llvm/lib/MC/WasmObjectWriter.cpp
parent2dc6be52093af5347162f1ff71c61df8b9d0fdf8 (diff)
downloadllvm-f23b259e1877115794c0bb5654a329c7bdefadb0.zip
llvm-f23b259e1877115794c0bb5654a329c7bdefadb0.tar.gz
llvm-f23b259e1877115794c0bb5654a329c7bdefadb0.tar.bz2
[WebAssembly] Improve error messages regarding missing indirect function table. NFC
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. Differential Revision: https://reviews.llvm.org/D99960
Diffstat (limited to 'llvm/lib/MC/WasmObjectWriter.cpp')
-rw-r--r--llvm/lib/MC/WasmObjectWriter.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/MC/WasmObjectWriter.cpp b/llvm/lib/MC/WasmObjectWriter.cpp
index 0eda8b5..c0faf85 100644
--- a/llvm/lib/MC/WasmObjectWriter.cpp
+++ b/llvm/lib/MC/WasmObjectWriter.cpp
@@ -536,11 +536,11 @@ void WasmObjectWriter::recordRelocation(MCAssembler &Asm,
// 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 symbol has wrong type");
// Ensure that __indirect_function_table reaches the output.
Sym->setNoStrip();
Asm.registerSymbol(*Sym);