[lld] [WebAssembly] Fix __init_tls_base global in coop threading (PR #208597)
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 9 18:03:33 PDT 2026
================
@@ -1092,16 +1092,20 @@ void Writer::createOutputSegments() {
}
}
- // Sort segments by type, placing .bss last
+ // Sort segments by type, placing .bss last. Note that one requirement of
+ // this sort is that all eventually-active segments must come first in
+ // case `combineActiveOutputSegments` is used. When combined the relative
+ // address of the data segment must be 0 (to be compatible with PIC and a
+ // lack of extended-const).
llvm::stable_sort(segments,
[](const OutputSegment *a, const OutputSegment *b) {
auto order = [](StringRef name) {
return StringSwitch<int>(name)
- .StartsWith(".tdata", 0)
- .StartsWith(".rodata", 1)
- .StartsWith(".data", 2)
+ .StartsWith(".rodata", 0)
+ .StartsWith(".data", 1)
+ .StartsWith(".tdata", 3)
.StartsWith(".bss", 4)
----------------
sbc100 wrote:
I guess most of the test expectation changes due to this re-ordering of segments?
Would it be possible to put this change in its own commit (along with the effects it has on the tests). We could even consider landing this first to prepare for the actual change?
https://github.com/llvm/llvm-project/pull/208597
More information about the llvm-commits
mailing list