[llvm] [RISCV] Mark More Relocs as Relaxable (PR #151422)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 2 09:03:47 PDT 2025
================
@@ -1,32 +1,45 @@
-;; With +relax, J below needs a relocation to ensure the target is correct
-;; after linker relaxation. See https://github.com/ClangBuiltLinux/linux/issues/1965
; RUN: llc -mtriple=riscv64 -mattr=-relax -filetype=obj < %s \
; RUN: | llvm-objdump -d -r - | FileCheck %s --check-prefixes=CHECK,NORELAX
; RUN: llc -mtriple=riscv64 -mattr=+relax -filetype=obj < %s \
; RUN: | llvm-objdump -d -r - | FileCheck %s --check-prefixes=CHECK,RELAX
+;; With +relax, All `j` instructions below need a relocation to ensure the target is correct
+;; after linker relaxation. See https://github.com/ClangBuiltLinux/linux/issues/1965
+
; CHECK: j {{.*}}
; RELAX-NEXT: R_RISCV_JAL {{.*}}
+; RELAX-NOT: R_RISCV_RELAX
; CHECK-NEXT: auipc ra, 0x0
; CHECK-NEXT: R_RISCV_CALL_PLT f
; RELAX-NEXT: R_RISCV_RELAX *ABS*
; CHECK-NEXT: jalr ra
; CHECK-NEXT: j {{.*}}
+; RELAX-NEXT: R_RISCV_JAL {{.*}}
+; RELAX-NOT: R_RISCV_RELAX
----------------
MaskRay wrote:
TIL :) Thanks
https://github.com/llvm/llvm-project/pull/151422
More information about the llvm-commits
mailing list