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

Nicholas Wilson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 6 01:17:04 PST 2018


ncw planned changes to this revision.
ncw added a comment.

In https://reviews.llvm.org/D44028#1027253, @sbc100 wrote:

> How about this for a longer term solution:  When a relocation like this is found the linker can create a linker synthetic function which will abort.. a simple one might be "call_indirect 0" which we know.


I thought about that too... the synthetic function would just be `(func (type) unreachable)` of course! It's messy as you need a separate one for each type signature. It adds quite a bit of "weight" and machinery to LLD.

It basically comes down to whether you think this should be "fixed" in LLD or LLC; should we make a dummy unreachable function in LLD or bodge LLC to emit call_indirect for weak-undefined calls. This patch is currently operating on the basis that the fix will be in LLC... but actually maybe you could convince me otherwise. We shouldn't really use call_indirect for things that aren't truly indirect, so even though it's a nuisance, maybe the linker-synthetic functions are right after all.

> For globals I think we can ban weak references, since there is no way to checking the address of a global before calling get_global in it.

Hm, on reflection, I agree. We should disallow undefined globals, even if weak.

> I'm happy with the code change for now, but can you write the test as minimal piece of bitcode rather than yaml.  (Is there some reason you didn't do that already?)

I'm not sure I can, for the global case (there's no way to emit globals other than __stack_pointer currently). For the "call" case, I can change over to bitcode, OK.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D44028





More information about the llvm-commits mailing list