[lld] [lld] Add infrastructure for handling RISCV vendor-specific relocations. (PR #159987)
    Fangrui Song via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Tue Oct 21 22:09:07 PDT 2025
    
    
  
================
@@ -0,0 +1,18 @@
+# RUN: llvm-mc -triple riscv32 %s -filetype=obj -o %t.o
+# RUN: not ld.lld -pie %t.o -o /dev/null 2>&1 | FileCheck %s
+
+  .option exact
+
+  .global TARGET
+TARGET:
+  nop
+
+.global INVALID_VENDOR
+.reloc 1f, R_RISCV_VENDOR, INVALID_VENDOR+0
+.reloc 1f, R_RISCV_VENDOR, INVALID_VENDOR+0
+.reloc 1f, R_RISCV_CUSTOM255, TARGET
+1:
+  nop
+
+# CHECK: error: {{.*}}:(.text+0x4): malformed consecutive R_RISCV_VENDOR relocations
+# CHECK: error: {{.*}}:(.text+0x4): unknown vendor-specific relocation (255) in vendor namespace "INVALID_VENDOR" against symbol TARGET
----------------
MaskRay wrote:
Sorry for not mentioning this earlier. In newer diagnostics we quote the symbol name like `symbol 'TARGET'`
I wonder whether we could remove the second "vendor" from the message
```
- vendor-specific relocation (255) in vendor namespace "INVALID_VENDOR"
+ vendor-specific relocation (255) in namespace "INVALID_VENDOR"
```
https://github.com/llvm/llvm-project/pull/159987
    
    
More information about the llvm-commits
mailing list