[lld][WebAssembly] Allow relocations against non-live global symbols
authorSam Clegg <sbc@chromium.org>
Tue, 27 Apr 2021 20:45:10 +0000 (13:45 -0700)
committerSam Clegg <sbc@chromium.org>
Wed, 28 Apr 2021 17:29:41 +0000 (10:29 -0700)
commit3e7bc0da57f17673ac61e5af3b005ffabfb449f3
tree59513c1d2b417d75f2d909b13e6d7c2ec338bf5b
parentbf72f6baccfe7d39a12f9319d108d6d55aefeeef
[lld][WebAssembly] Allow relocations against non-live global symbols

Just like the in case for function and data symbols this is needed to
support relocations in debug info sections which are allowed contains
relocations against non-live symbols.

The motivating use case is an object file that contains debug info that
references `__stack_pointer` (a local symbol) but does not actually
contain any uses of `__stack_pointer`.

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

Differential Revision: https://reviews.llvm.org/D101399
lld/test/wasm/debuginfo-undefined-global.s [new file with mode: 0644]
lld/test/wasm/globals.s
lld/wasm/InputFiles.cpp