llvm-project/lld/test
Fangrui Song c03fdd3403 [ELF] Fix the branch range computation when reusing a thunk
Notation: dst is `t->getThunkTargetSym()->getVA()`

On AArch64, when `src-0x8000000-r_addend <= dst < src-0x8000000`, the condition
`target->inBranchRange(rel.type, src, rel.sym->getVA(rel.addend))` may
incorrectly consider a thunk reusable.
`rel.addend = -getPCBias(rel.type)` resets the addend to 0 for AArch64/PPC
and the zero addend is used by `rel.sym->getVA(rel.addend)` to check
out-of-range relocations.

See the test for a case this computation is wrong:
`error: a.o:(.text_high+0x4): relocation R_AARCH64_JUMP26 out of range: -134217732 is not in [-134217728, 134217727]`
I have seen a real world case with r_addend=19960.

Reviewed By: peter.smith

Differential Revision: https://reviews.llvm.org/D117734
2022-01-24 09:03:21 -08:00
..
COFF Re-land [CodeView] Add full repro to LF_BUILDINFO record 2022-01-19 19:44:37 -05:00
ELF [ELF] Fix the branch range computation when reusing a thunk 2022-01-24 09:03:21 -08:00
MachO [lld][macho] Stop grouping symbols by sections in mapfile. 2022-01-20 12:16:37 -08:00
MinGW [LLD] [MinGW] Add more options for disabling flags in the executable 2021-08-12 13:27:09 +03:00
Unit Support multi-configuration generators correctly in several config files 2021-02-11 09:32:20 -08:00
wasm [lld][WebAssemlby] Convert test to check disassembly output. NFC 2022-01-20 09:32:01 -08:00
CMakeLists.txt [lld/test] List one test dep per line 2021-12-17 09:51:01 -05:00
lit.cfg.py [lld/tests] Stop setting the "asserts" and "debug" features 2022-01-05 13:39:17 -05:00
lit.site.cfg.py.in Fix lld macho standalone build by including llvm/Config/llvm-config.h instead of llvm/Config/config.h 2021-05-19 11:15:07 -04:00