[PATCH] D99574: [ARM] [COFF] Properly produce cross-section relative relocations
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 30 08:57:27 PDT 2021
mstorsjo added inline comments.
================
Comment at: llvm/lib/Target/ARM/MCTargetDesc/ARMWinCOFFObjectWriter.cpp:63
+ }
+ FixupKind = FK_PCRel_4;
+ }
----------------
compnerd wrote:
> I'm not sure I understand entirely how this works. If this is used in a data only table, the data is now PC-relative. Is that really the same thing? Everything on COFF is PC-relative if it is base relocated, but that requires generation in the frontend to account for that, which understands the semantics for the data better than we do at this point.
If it's a table of plain addresses, not address differences, I think `IsCrossSection` isn't set. The coff-relocations.s testcase has a check for it, see around the addr32 label.
As for who makes sure the offset is adjusted to be PC relative (when the subtracted bit in the asm expression isn't the PC but some other address), not entirely sure, but apparently it's done by some other MC layer. This corresponds pretty much 1:1 to the same in the X86 target, see https://github.com/llvm/llvm-project/blob/llvmorg-11.1.0/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp#L46-L52.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99574/new/
https://reviews.llvm.org/D99574
More information about the llvm-commits
mailing list