[llvm] [RISCV] Vendor Relocations for Xqci extension (PR #135400)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 3 09:15:35 PDT 2025


================
@@ -611,6 +612,43 @@ bool RISCVAsmBackend::evaluateTargetFixup(const MCFixup &Fixup,
          isPCRelFixupResolved(AUIPCTarget.getAddSym(), *AUIPCDF);
 }
 
+std::optional<StringRef>
+RISCVAsmBackend::getVendorIdentifierForFixup(unsigned FixupKind) const {
+  switch (FixupKind) {
+  case RISCV::fixup_riscv_qc_e_branch:
+  case RISCV::fixup_riscv_qc_abs20_u:
+  case RISCV::fixup_riscv_qc_e_32:
+  case RISCV::fixup_riscv_qc_e_jump_plt:
+    return "QUALCOMM";
+  }
+
+  return std::nullopt;
+}
+
+void RISCVAsmBackend::addVendorReloc(const MCFragment &F, const MCFixup &Fixup,
+                                     StringRef VendorIdentifier) {
+  MCContext &Ctx = Asm->getContext();
+
+  auto It = VendorSymbols.find(VendorIdentifier);
----------------
MaskRay wrote:

Add a comment:

> Create a local symbol for the vendor relocation to reference. It's fine if the symbol has the same name as an existing symbol.

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


More information about the llvm-commits mailing list