[all-commits] [llvm/llvm-project] 93bc18: [lld][macho] Fix thunks with multiple text section...
Ellis Hoag via All-commits
all-commits at lists.llvm.org
Tue Jun 9 10:14:55 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 93bc18ff2d13e3246a7629ca17bb8352d2c51d89
https://github.com/llvm/llvm-project/commit/93bc18ff2d13e3246a7629ca17bb8352d2c51d89
Author: Ellis Hoag <ellis.sparky.hoag at gmail.com>
Date: 2026-06-09 (Tue, 09 Jun 2026)
Changed paths:
M lld/MachO/ConcatOutputSection.cpp
M lld/MachO/ConcatOutputSection.h
A lld/test/MachO/arm64-thunk-stubs-multi-text.s
A lld/test/MachO/arm64-thunk-stubs.s
M lld/test/MachO/arm64-thunks.s
Log Message:
-----------
[lld][macho] Fix thunks with multiple text sections (#199747)
When there are multiple `__text` sections, LLD might not generate thunks
to stubs sections when they are required, leading to relocation errors.
```
ld64.lld: error: a.o:(symbol _foo+0x0): relocation BRANCH26 is out of range: 134217744 is not in [-134217728, 134217727]; references _extern_sym
```
Create `TextOutputSection::estimateStubsEndVA()` to correctly estimate
the end VA of the last stubs section so we can tell when branches to
stub symbols will be in range.
Technically this could cause lld to generate more thunks in some cases.
If a binary requires thunks (the `__TEXT` segment is >128MiB) and has
multiple `__text` sections like `__text_cold` or `__lcxx_override`, then
all branches to stub symbols will require thunks. Without this change we
could get the relocation errors above. We might be able to workaround
the problem by placing the `__text` section last.
Fixes https://github.com/llvm/llvm-project/issues/195387.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list