[PATCH] D155732: [MC][COFF][AArch64] Avoid incorrect IMAGE_REL_ARM64_BRANCH26 relocations.
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 19 14:45:43 PDT 2023
efriedma added a comment.
> That sounds like the correct thing to do; if a relocation with an offset isn’t supported by lld (but it is by link.exe), we should fix the linker instead of trying to avoid generating it.
The description sounds like it's also not supported by link.exe? Not sure.
------
We should teach adjustFixupValue() in AArch64AsmBackend.cpp to print an error if an unresolved branch with an offset gets there somehow.
There's a bunch of code for A.isTemporary() a few lines earlier; would it make sense to integrate with that? This is sort of similar to what we do with OffsetSymbols, except the maximum offset is zero.
You can't create symbols at arbitrary offsets from the start of a section; you need to check that the symbol actually points somewhere within the section.
================
Comment at: llvm/lib/MC/WinCOFFObjectWriter.cpp:961
+ // instruction to symbol A and drop the relocation. Set to the
+ // correct relative offset.
+ FixedValue = Layout.getSymbolOffset(A) - Reloc.Data.VirtualAddress;
----------------
We shouldn't end up in recordRelocation for branches where the source and destination are in the same section, I think.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155732/new/
https://reviews.llvm.org/D155732
More information about the llvm-commits
mailing list