[lld] [wip][LLD] Support RISCV vendor-specific relocations. (PR #168497)

Owen Anderson via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 18 18:46:52 PST 2025


================
@@ -40,6 +41,12 @@ using namespace lld::elf;
 
 std::string elf::toStr(Ctx &ctx, RelType type) {
   StringRef s = getELFRelocationTypeName(ctx.arg.emachine, type);
+  if (ctx.arg.emachine == EM_RISCV && s == "Unknown") {
+    auto VendorString = getRISCVVendorString(type);
+    if (VendorString)
+      s = getRISCVVendorRelocationTypeName(type & ~INTERNAL_RISCV_VENDOR_MASK,
+                                           *VendorString);
+  }
----------------
resistor wrote:

I looked at this more, and since we do print the reloc number on error, I think it's better to do that. I'll enhance it slightly to show that it was an unknown vendor-specific relic.

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


More information about the llvm-commits mailing list