[llvm-branch-commits] [llvm] [GOFF] Write out relocations in the GOFF writer (PR #167054)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Nov 10 14:51:07 PST 2025
================
@@ -545,8 +743,68 @@ GOFFObjectWriter::GOFFObjectWriter(
GOFFObjectWriter::~GOFFObjectWriter() = default;
+void GOFFObjectWriter::recordRelocation(const MCFragment &F,
+ const MCFixup &Fixup, MCValue Target,
+ uint64_t &FixedValue) {
+ const MCFixupKindInfo &FKI =
+ Asm->getBackend().getFixupKindInfo(Fixup.getKind());
+ const uint32_t Length = FKI.TargetSize / 8;
+ assert(FKI.TargetSize % 8 == 0 && "Target Size not multiple of 8");
+ const uint64_t FixupOffset = Asm->getFragmentOffset(F) + Fixup.getOffset();
+ bool IsPCRel = Fixup.isPCRel();
+
+ unsigned RelocType = TargetObjectWriter->getRelocType(Target, Fixup, IsPCRel);
+
+ const MCSectionGOFF *PSection = static_cast<MCSectionGOFF *>(F.getParent());
+ const auto &A = *static_cast<const MCSymbolGOFF *>(Target.getAddSym());
----------------
tltao wrote:
Minor nitpick: Is there a reason A is dereferenced? It looks to me like we should be able to keep declarations for A and B consistent?
https://github.com/llvm/llvm-project/pull/167054
More information about the llvm-branch-commits
mailing list