Previously, taking the address for an alias would
result in:
"Symbol not found in table index space"
Increase test coverage for weak aliases.
This code should be more efficient too as it avoids building the
IsAddressTaken set.
Paths
| Differential D41510
[WebAssembly] MC: Fix for address taken aliases ClosedPublic Authored by sbc100 on Dec 21 2017, 1:08 PM.
Details Summary Previously, taking the address for an alias would Increase test coverage for weak aliases. This code should be more efficient too as it avoids building the
Diff Detail
Event TimelineHerald added subscribers: sunfish, aheejin, jgravelle-google and 2 others. · View Herald TranscriptDec 21 2017, 1:08 PM Comment Actions Looks like it should work. One thing I wonder about is the size of the table? It looks like we're now writing out a table entry for each relocation, which is (a tiny amount of) bloat and makes function pointers not compare equal (which is irrelevant for the object file which can't run anyway). It was neater before to be writing out the table entry only once per symbol. In https://bugs.llvm.org/show_bug.cgi?id=35625, I'd suggested augmenting the alias-loop (it could actually be pulled out into a helper function rather than copy-and-pasted, oops). Then at least you'd only have one table entry per-symbol, even if the "ideal" would be one table entry per function. Comment Actions
Oops, you are totally right. I forgot to add the extra check. Comment Actions
It makes sense to me to build the indirect table via single pass through the relocations since that tells us precisely which functions have had their address taken. Comment Actions Thanks, you're right that's nicer. I'll leave the bugzilla issue open for now until the Linking.md issue is closed as well. (The lambda could become a proper member function, just to keep the length down on these huge functions that need splitting.) This revision is now accepted and ready to land.Dec 22 2017, 12:40 AM Closed by commit rL321384: [WebAssembly] MC: Fix for address taken aliases (authored by sbc). · Explain WhyDec 22 2017, 12:32 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 128050 llvm/trunk/lib/MC/WasmObjectWriter.cpp
llvm/trunk/test/MC/WebAssembly/weak-alias.ll
|
Having just approved this, I'm wondering why we have to handle the MEMORY_ADDR relocations? OK, so I can see that IsAddressTaken used to handle them - but was for address-taken globals? Since we're now inside as isFunction() block, I'd have thought that only TABLE_INDEX relocations can target the symbol.