This is an archive of the discontinued LLVM Phabricator instance.

[lld][WebAssembly] Fix for debug relocations against undefined function symbols
ClosedPublic

Authored by sbc100 on Dec 1 2021, 6:17 PM.

Details

Summary

This is very similar to https://reviews.llvm.org/D103557 but applies to
symbols which are undefined at link time rather than compile time.

We already have code that handles symbols which were defined at link
time but dead stripped by --gc-sections (See
test/wasm/debug-removed-fn.ll). In that case the symbols are not live
(!isLive()). However, we can also have live symbols (which are
references by the program) but which are undefined at link time and are
imported by the linker.

In the test case here the symbol undef is used but is not defined
in the program but is imported by the linker due to the
--import-undefined flag.

Fixes: https://github.com/emscripten-core/emscripten/issues/15528

Diff Detail

Event Timeline

sbc100 created this revision.Dec 1 2021, 6:17 PM
sbc100 requested review of this revision.Dec 1 2021, 6:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 1 2021, 6:17 PM
dschuff accepted this revision.Dec 2 2021, 8:32 AM
This revision is now accepted and ready to land.Dec 2 2021, 8:32 AM