[all-commits] [llvm/llvm-project] 3bc798: [ELF] Fix branch range computation when picking Th...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Tue May 3 08:46:29 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 3bc79808d06343f712728e1491f31a45383d9803
https://github.com/llvm/llvm-project/commit/3bc79808d06343f712728e1491f31a45383d9803
Author: Fangrui Song <i at maskray.me>
Date: 2022-05-03 (Tue, 03 May 2022)
Changed paths:
M lld/ELF/Relocations.cpp
A lld/test/ELF/aarch64-thunk-reuse2.s
Log Message:
-----------
[ELF] Fix branch range computation when picking ThunkSection
Similar to D117734. Take AArch64 as an example when the branch range is +-0x8000000.
getISDThunkSec returns `ts` when `src-0x8000000-r_addend <= tsBase < src-0x8000000`
and the new thunk will be placed in `ts` (`ts->addThunk(t)`). However, the new
thunk (at the end of ts) may be unreachable from src. In the next pass,
`normalizeExistingThunk` reverts the relocation back to the original target.
Then a new thunk is created and the same `ts` is picked as before. The `ts` is
still unreachable.
I have observed it in one test with a sufficiently large r_addend (47664): there
are initially 245 Thunk's, then in each pass 14 new Thunk's are created and get
appended to the unreachable ThunkSection. After 15 passes lld fails with
`thunk creation not converged`.
The new test aarch64-thunk-reuse2.s checks the case.
Without `- pcBias`, arm-thumb-thunk-empty-pass.s and arm-thunk-multipass-plt.s
will fail.
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D124653
More information about the All-commits
mailing list