[llvm] [ARM] [Windows] Error out on branch relocations that require a symbol offset (PR #101906)
Jacek Caban via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 5 11:58:41 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;
----------------
cjacek wrote:
I think it would be slightly cleaner to just move it one line bellow, where `Value` is adjusted by 4 and skip the offset explanation comment.
https://github.com/llvm/llvm-project/pull/101906
More information about the llvm-commits
mailing list