[llvm] [ARMAsmBackend] Add checks for relocation addends in assembler (PR #109969)
Oliver Stannard via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 26 01:12:43 PDT 2024
================
@@ -579,13 +579,24 @@ unsigned ARMAsmBackend::adjustFixupValue(const MCAssembler &Asm,
case ARM::fixup_arm_uncondbl:
case ARM::fixup_arm_condbl:
case ARM::fixup_arm_blx:
+ // Check that the fixup value is legal.
+ Value = Value - 8;
+ if (!isInt<25>(Value)) {
+ Ctx.reportError(Fixup.getLoc(), "Relocation out of range");
+ return 0;
+ }
+ if (Value % 4 != 0) {
----------------
ostannard wrote:
The ARM BLX instruction can branch to Thumb code, so only needs to be 2-byte aligned.
https://github.com/llvm/llvm-project/pull/109969
More information about the llvm-commits
mailing list