[lld][WebAssembly] Apply relocations to TLS data
authorSam Clegg <sbc@chromium.org>
Tue, 31 Jan 2023 21:33:29 +0000 (13:33 -0800)
committerSam Clegg <sbc@chromium.org>
Tue, 31 Jan 2023 23:50:44 +0000 (15:50 -0800)
commita0495e6b008c7b1f5af2d0756bf62aefdc6a43ea
treec8b96cbd159958532d4fdd4edb315f54eb68309d
parent9f8fd57cb6638f8137d82b1ceb02845626816b4f
[lld][WebAssembly] Apply relocations to TLS data

This is only needed in the case of dynamic linking and pthreads.
Previously these relocations were simply not being applied.

Verified that this works using a more real world emscripten test:
https://github.com/emscripten-core/emscripten/pull/18641

Differential Revision: https://reviews.llvm.org/D143020
lld/test/wasm/tls-relocations.s [new file with mode: 0644]
lld/test/wasm/tls.s
lld/wasm/InputChunks.cpp
lld/wasm/Symbols.cpp
lld/wasm/Symbols.h
lld/wasm/Writer.cpp