[all-commits] [llvm/llvm-project] 8544b4: [lld][WebAssembly] Fix for PIC output + TLS + non-...
Sam Clegg via All-commits
all-commits at lists.llvm.org
Fri May 21 15:18:35 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 8544b40b6e1d4e34650af66e25102ebcdf360e62
https://github.com/llvm/llvm-project/commit/8544b40b6e1d4e34650af66e25102ebcdf360e62
Author: Sam Clegg <sbc at chromium.org>
Date: 2021-05-21 (Fri, 21 May 2021)
Changed paths:
M lld/test/wasm/data-segments.ll
M lld/test/wasm/relocation-bad-tls.s
R lld/test/wasm/tls-no-shared.s
A lld/test/wasm/tls-non-shared-memory.s
M lld/wasm/OutputSections.cpp
M lld/wasm/Relocations.cpp
M lld/wasm/Writer.cpp
Log Message:
-----------
[lld][WebAssembly] Fix for PIC output + TLS + non-shared-memory
Prior to this change build with `-shared/-pie` and using TLS (but
without -shared-memory) would hit this assert:
"Currenly only a single data segment is supported in PIC mode"
This is because we were not including TLS data when merging data
segments. However, when we build without shared-memory (i.e. without
threads) we effectively lower away TLS into a normal active data
segment.. so we were ending up with two active data segments: the merged
data, and the lowered TLS data.
To fix this problem we can instead avoid combining data segments at
all when running in shared memory mode (because in this case all
segment initialization is passive). And then in non-shared memory
mode we know that TLS has been lowered and therefore we can can
and should combine all segments.
So with this new behavior we have two different modes:
1. With shared memory / mutli-threaded: Never combine data segments
since it is not necessary. (All data segments as passive already).
2. Wihout shared memory / single-threaded: Combine *all* data segments
since we treat TLS as normal data. (We end up with a single
active data segment).
Differential Revision: https://reviews.llvm.org/D102937
More information about the All-commits
mailing list