[lld] [ELF] Support R_RISCV_SET_ULEB128/R_RISCV_SUB_ULEB128 in SHF_ALLOC sections (PR #77261)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 7 16:18:22 PST 2024


================
@@ -122,8 +167,21 @@ w1: call foo; w2:
 
 #--- overflow.s
 w1: call foo; w2:
+.section .alloc,"a"
+.quad 0
+.reloc ., R_RISCV_SET_ULEB128, w2+124
+.reloc ., R_RISCV_SUB_ULEB128, w1
+.byte 0x7f
 .section .debug_rnglists
 .quad 0
 .reloc ., R_RISCV_SET_ULEB128, w2+124
 .reloc ., R_RISCV_SUB_ULEB128, w1
 .byte 0x7f
+
+#--- preemptable.s
+.globl w1, w2
----------------
MaskRay wrote:

In the future, I'll consider making `R_RISCV_ADD` a constant only if `!isPreemptible` like `R_RISCV_LEB128`

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


More information about the llvm-commits mailing list