[PATCH] D56396: [LLD][ELF] Fix ARM and Thumb V7PILongThunk overflow behavior.
Peter Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 7 08:46:30 PST 2019
peter.smith created this revision.
peter.smith added reviewers: ruiu, grimar.
Herald added subscribers: kristof.beyls, arichardson, javed.absar, emaste.
Herald added a reviewer: espindola.
When the range between the source and target of a V7PILongThunk exceeded an int32 we would trigger a relocation out of range error for the R_ARM_MOVT_PREL or R_ARM_THM_MOVT_PREL relocation. This case can happen when linking the linux kernel as it is loaded above 0xf0000000.
There are two parts to the fix.
- Remove the overflow check for R_ARM_MOVT_PREL or R_ARM_THM_MOVT_PREL. The ELF for the ARM Architecture document defines these relocations as having no overflow checking so the overflow check was spurious anyway.
- Use int64_t for the offset calculation, in line with similar thunks so that PC + (S - P) < 32-bits. This results in less surprising disassembly.
References: ELF for the ARM Architecture table 4-11 Static ARM instruction relocations
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044f/IHI0044F_aaelf.pdf
https://reviews.llvm.org/D56396
Files:
ELF/Arch/ARM.cpp
ELF/Thunks.cpp
test/ELF/arm-extreme-range-pi-thunk.s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56396.180505.patch
Type: text/x-patch
Size: 5168 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190107/6f06a488/attachment.bin>
More information about the llvm-commits
mailing list