[llvm] [ARM] [Windows] Error out on branch relocations that require a symbol offset (PR #101906)
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 5 12:08:47 PDT 2024
================
@@ -587,6 +587,14 @@ unsigned ARMAsmBackend::adjustFixupValue(const MCAssembler &Asm,
return 0;
return 0xffffff & ((Value - 8) >> 2);
case ARM::fixup_t2_uncondbranch: {
+ if (STI->getTargetTriple().isOSBinFormatCOFF() && !IsResolved &&
+ Value != 4) {
+ // MSVC link.exe and lld do not support this relocation type
+ // with a non-zero offset. ("Value" is offset by 4 at this point.)
+ Ctx.reportError(Fixup.getLoc(),
+ "cannot perform a PC-relative fixup with a non-zero "
+ "symbol offset");
+ }
Value = Value - 4;
----------------
mstorsjo wrote:
Yes, I considered that, but as only 1 case out of 3 have the `Value = Value - 4;` as a separate step, I preferred to keep it consistent, and early upfront in each case.
https://github.com/llvm/llvm-project/pull/101906
More information about the llvm-commits
mailing list