[llvm] [RISCV] Add support for vendor relocations on Xqci extensions (PR #135400)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed May 7 00:01:22 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:

`fixupNeedsMarkerELFRelocation` adds unneeded overhead to almost all relocations for most targets.

I still believe `evaluateTargetFixup` is the best way to add another relocation. Could you demonstrate the change you'd need if we don't use `fixupNeedsMarkerELFRelocation`?

It's acceptable to pass more args (like `RecordReloc`) to `evaluateTargetFixup`, a slow path.

https://github.com/llvm/llvm-project/pull/135400


More information about the llvm-commits mailing list