[llvm] [RISCV] Add support for vendor relocations on Xqci extensions (PR #135400)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 13 09:48:09 PDT 2025
================
@@ -1435,6 +1435,21 @@ void ELFObjectWriter::recordRelocation(MCAssembler &Asm,
: C;
FixedValue = usesRela(TO, FixupSection) ? 0 : Addend;
+ // Some RISC-V relocations need a marker relocation that appears before the
+ // relocation in question.
+ unsigned PreRelocType;
+ MCSymbol *PreRelocSymbol;
+ uint64_t PreRelocAddend;
+ if (Backend.fixupNeedsMarkerELFRelocation(Asm, *Fragment, Fixup, PreRelocType,
----------------
MaskRay wrote:
(MCAssembler.cpp and ELFObjectWriter.cpp have significant tech debt. I try to clean up them from time to time. Just noticed that my latest change 19730e37ec5d3513d188a75999c964f2ef4b9509 might need you to rebase.)
I think we should refrain from adding new hooks. (I added `Backend.handleAddSubRelocations` in the past, and on reflection we might need some cleanup so that it could be combined with getRelocType).
Can you add an extra fixup when `fixup_riscv_qc_e_branch` is appended? Or the hook is here because in some scenarios the fixup can be resolved and you don't want to add a redundant marker?
https://github.com/llvm/llvm-project/pull/135400
More information about the llvm-commits
mailing list