1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[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
This commit is contained in:
Sam Clegg 2021-04-06 08:06:18 -07:00
parent b2479f1ec0
commit d2a91d13b3

View File

@ -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);