[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:48 PST 2025


================
@@ -1703,6 +1704,18 @@ void DynamicReloc::finalize(Ctx &ctx, SymbolTableBaseSection *symt) {
   isFinal = true; // Catch errors
 }
 
+size_t RelocationBaseSection::getSize() const {
+  size_t size = relocs.size() * entsize;
+  if (ctx.arg.emachine == EM_RISCV) {
+    for (const auto &reloc : relocs) {
+      if (reloc.type.v & INTERNAL_RISCV_VENDOR_MASK) {
+        size += entsize;
+      }
----------------
resistor wrote:

I think this is the only place where the distinction matters, so maybe it's OK to add a little complexity here to make everywhere else simpler?

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


More information about the llvm-commits mailing list