llvm
ba228181 - [lld][Hexagon] Fix out-of-range PLT branch thunks (#186545)

Commit
3 days ago
[lld][Hexagon] Fix out-of-range PLT branch thunks (#186545) Linking large Hexagon binaries (e.g. ASan runtime with >8 MiB of text) fails with R_HEX_B22_PCREL / R_HEX_PLT_B22_PCREL relocation overflow on calls to PLT entries, even though the thunk infrastructure exists and needsThunks is set. needsThunk() always used s.getVA() to compute the branch destination, even for PLT calls where the actual destination is the PLT entry. This meant the distance check used the wrong address and failed to create thunks when the PLT entry was out of B22_PCREL range. Fix by using s.getPltVA() when expr == R_PLT_PC. Also override getThunkSectionSpacing() so ThunkSections are pre-created at appropriate intervals for large binaries.
Author
Parents
Loading