[all-commits] [llvm/llvm-project] 4d575e: [ELF] Sort forward thunks by destination to preven...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Tue Jul 28 09:41:09 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 4d575e790fef3995b23d6838e4ce557d2f9b5b98
https://github.com/llvm/llvm-project/commit/4d575e790fef3995b23d6838e4ce557d2f9b5b98
Author: Fangrui Song <i at maskray.me>
Date: 2026-07-28 (Tue, 28 Jul 2026)
Changed paths:
M lld/ELF/Config.h
M lld/ELF/Driver.cpp
M lld/ELF/Relocations.cpp
M lld/ELF/SyntheticSections.cpp
M lld/ELF/SyntheticSections.h
M lld/test/ELF/aarch64-thunk-align.s
M lld/test/ELF/aarch64-thunk-bti-execute-only.s
M lld/test/ELF/aarch64-thunk-bti-multipass.s
M lld/test/ELF/aarch64-thunk-bti.s
M lld/test/ELF/aarch64-thunk-script.s
A lld/test/ELF/aarch64-thunk-sort.s
M lld/test/ELF/arm-bl-v4t.s
M lld/test/ELF/arm-branch-rangethunk.s
M lld/test/ELF/arm-force-pi-thunk.s
M lld/test/ELF/arm-thumb-condbranch-thunk.s
M lld/test/ELF/arm-thumb-interwork-shared.s
M lld/test/ELF/arm-thumb-interwork-thunk.s
M lld/test/ELF/arm-thumb-mix-range-thunk-os.s
M lld/test/ELF/arm-thumb-plt-range-thunk-os.s
M lld/test/ELF/arm-thumb-range-thunk-os-no-ext.s
M lld/test/ELF/arm-thumb-range-thunk-os.s
M lld/test/ELF/arm-thunk-arm-thumb-reuse.s
M lld/test/ELF/arm-thunk-linkerscript-dotexpr.s
M lld/test/ELF/arm-thunk-linkerscript-orphan.s
M lld/test/ELF/arm-thunk-linkerscript.s
M lld/test/ELF/arm-thunk-re-add.s
M lld/test/ELF/hexagon-thunk-range-b22rel.s
M lld/test/ELF/ppc32-call-stub-nopic.s
M lld/test/ELF/ppc32-call-stub-pic.s
M lld/test/ELF/ppc32-long-thunk.s
M lld/test/ELF/ppc64-call-reach.s
M lld/test/ELF/ppc64-ifunc.s
M lld/test/ELF/ppc64-long-branch-pi.s
M lld/test/ELF/ppc64-long-branch-rel14.s
M lld/test/ELF/ppc64-long-branch.s
Log Message:
-----------
[ELF] Sort forward thunks by destination to prevent convergence failures (#211721)
A thunk's distance to a forward destination grows when a thunk after it
grows.
For
```
[forward A B C] dstA dstB dstC
```
When all thunks are initially short, promoting C can push B to be
enlarged on the following pass, which in turn pushes A to be promoted on
the following pass. Promoting just one thunk on a pass can therefore
trigger "address assignment did not converge".
Sort each ThunkSection once pass 0 has created its thunks. A forward
thunk's distance grows only when a thunk after it grows, so order
forward thunks by descending destination. A backward thunk's distance
grows only with a promotion before it, already applied when we reach
it, so backward thunks need no ordering; partition them ahead of the
forward thunks in creation order.
Tests that depend on creation order are pinned with -z nosort-thunks;
they can be migrated individually, after which the option can be
removed.
Fixes #61250
Co-authored-by: Pranav Kant <prka at google.com>
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