HomePhabricator

[ELF] Fix ARM and Thumb V7PILongThunk overflow behavior.

Description

[ELF] Fix ARM and Thumb V7PILongThunk overflow behavior.

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 check was spurious.

  • 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.

Differential Revision: https://reviews.llvm.org/D56396

Details

Committed
psmithJan 10 2019, 8:08 AM
Differential Revision
D56396: [LLD][ELF] Fix ARM and Thumb V7PILongThunk overflow behavior.
Branches
Unknown
Tags
Unknown