diff options
author | Fangrui Song <i@maskray.me> | 2022-01-24 09:03:21 -0800 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2022-01-24 09:03:21 -0800 |
commit | c03fdd340356c9a29242975f39786529eb99f194 (patch) | |
tree | 99ccfbb70cb38b69158dcebed93a4346449966af /lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h | |
parent | 6997f4d07fa4b462dd3a02838a2cfed45db9c8a0 (diff) | |
download | llvm-c03fdd340356c9a29242975f39786529eb99f194.zip llvm-c03fdd340356c9a29242975f39786529eb99f194.tar.gz llvm-c03fdd340356c9a29242975f39786529eb99f194.tar.bz2 |
[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
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h')
0 files changed, 0 insertions, 0 deletions