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

Owen Anderson via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 18 15:56:01 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'll add the fallback path. LLD should print *something* sane if run on object files containing vendor-relics it doesn't (yet) understand. If we don't include the relocation number, it makes it impossible for user to figure out what's going wrong.

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


More information about the llvm-commits mailing list