[lld][WebAssembly] Add suppport for PIC + passive data initialization
authorSam Clegg <sbc@chromium.org>
Fri, 4 Dec 2020 00:51:56 +0000 (16:51 -0800)
committerSam Clegg <sbc@chromium.org>
Sat, 5 Dec 2020 01:28:23 +0000 (17:28 -0800)
commitab58e4cb5185cc2042f3e1c077c85430b83c28b5
tree4c793f9b354290fbe1383b441d598337f0a87977
parent2518433f861fcb877d0a7bdd9aec1aec1f77505a
[lld][WebAssembly] Add suppport for PIC + passive data initialization

This change improves our support for shared memory to include
PIC executables (and shared libraries).

To handle this case the linker-generated `__wasm_init_memory`
function (that only exists in shared memory builds) must be
capable of loading memory segements at non-const offsets based
on the runtime value of `__memory_base`.

Differential Revision: https://reviews.llvm.org/D92620
lld/test/lit.cfg.py
lld/test/wasm/data-segments.ll
lld/wasm/Driver.cpp
lld/wasm/SyntheticSections.cpp
lld/wasm/Writer.cpp
llvm/include/llvm/BinaryFormat/Wasm.h