[PATCH] D44028: [WebAssembly] Add message for relocation against weak undefined symbol

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 2 10:21:35 PST 2018


sbc100 added inline comments.


================
Comment at: wasm/InputFiles.cpp:97
+    Symbol *Sym = getGlobalSymbol(Reloc.Index);
+    if (!Sym->hasOutputIndex()) {
+      // This happens if someone tries to use a `get/set_global` instruction to
----------------
ncw wrote:
> sbc100 wrote:
> > Would it make more sense to check !Sym->isDefined()?
> You think? We're calling `getOutputIndex` on the line below, it seems like it's the obvious way to check whether that will succeed/fail!
But the error message says the thing is undefined.

Actually, rethinking this I think you are right.   Since we can actually have undefined functions that do have their output index set in which case we don't want to fail here.

I kind of want there to be a better why to check for this particular case though, some kind of "isNeitherDefinedNorUndefined()".. but I'm ok with this for now.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D44028





More information about the llvm-commits mailing list