[PATCH 2/2] RISC-V: Don't generate R_RISCV_RELATIVE if symbol referenced section is SH_ABS
H.J. Lu
hjl.tools@gmail.com
Fri Aug 22 13:00:29 GMT 2025
On Thu, Aug 21, 2025 at 10:59 PM Fangrui Song <i@maskray.me> wrote:
>
> On Thu, Aug 21, 2025 at 10:51 PM Nelson Chu <nelson@rivosinc.com> wrote:
> >
> > Thanks H.J, the information is really helpful ;)
> >
> > cc risc-v kernel experts to see if risc-v have those section symbols defined in linker script. Please feel free to cc anyone who I've missed but should be notified.
> >
> > Thanks
> > Nelson
>
> I don't think we need to do anything different.
> A relocation of formula (S + A) referencing a non-preemptible SHN_ABS
> symbol should be resolved statically , without generating a dynamic
> relocation.
>
> All ports of lld/ELF use this logic and Linux kernels linked with lld
> are working well:
> https://github.com/llvm/llvm-project/commit/ba2de8f22d0cac86d89c1806fb54ed3463349342
>
How does it work with x86-64 kernel compiled as PIE?
--
H.J.
More information about the Binutils
mailing list