[lld][WebAssembly] Fix crash accessing non-live __tls_base symbol
authorSam Clegg <sbc@chromium.org>
Thu, 17 Mar 2022 05:28:38 +0000 (22:28 -0700)
committerSam Clegg <sbc@chromium.org>
Thu, 17 Mar 2022 20:59:45 +0000 (13:59 -0700)
commita04a5077140b6699938a73643f71d00d9748ec7e
treecbadb5813e59821acf4ccd7ce8fd5f740b77aee7
parent523c572c376a8998747cf81d16dce8aee69127e5
[lld][WebAssembly] Fix crash accessing non-live __tls_base symbol

In programs that don't otherwise depend on `__tls_base` it won't
be marked as live.  However this symbol is used internally in
a couple of places do we need to mark it as live explictily in
those places.

Fixes: #54386

Differential Revision: https://reviews.llvm.org/D121931
lld/test/wasm/tls_init_symbols.s [new file with mode: 0644]
lld/wasm/Writer.cpp