bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/27180] RISC-V far relocations for auipc instructions may cause s


From: nelsonc1225 at sourceware dot org
Subject: [Bug ld/27180] RISC-V far relocations for auipc instructions may cause segfault with --emit-relocs
Date: Thu, 29 Apr 2021 09:53:14 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=27180

--- Comment #2 from Nelson Chu <nelsonc1225 at sourceware dot org> ---
Hi Julius,

Thanks for reporting this.  Your assumption is correct, the PCREL relocs are
converted to the directly access relocs, but we don't update them to the
relocation table, so we will get segment fault when the --emit-relocs is set.

Attached is my proposed solution, without fully testing.  My idea is that try
to update the PCREL relocs and their referenced symbols to the corresponding
HI20/ LO12_I/S relocs and correct target symbols.  But there is a problem for
the R_RISCV_GOT_HI20 + PCREL_LO12.  If we convert it to HI20 + LO12, then we
should update the symbol to the got entry (maybe need to add one, but seems
hard to get the dynindx or ...).  Or alternatively, we probably can encode the
symbol value to the r_addend directly, without referring to a symbol, like what
RELATIVE relocs do.  I don't know which one is better, so I just report the
dangerous relocs for those changed R_RISCV_GOT_HI20, rather than report segment
fault.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]