[PATCH] Allow memset local PLT reference for RISC-V.

Jim Wilson jimw@sifive.com
Tue Jun 30 00:26:09 GMT 2020

On Mon, Jun 29, 2020 at 10:05 AM Florian Weimer via Libc-alpha
<libc-alpha@sourceware.org> wrote:
> I think we should see R_RISCV_CALL instead of R_RISCV_CALL_PLT, like
> here:

There is a proposal to deprecate one of R_RISCV_CALL and
R_RISCV_CALL_PLT, because whether you get a call to a plt or not
depends on the symbol info, not the relocation type.  We don't
actually need two different relocs for this.  Old ABIs like x86 have
two relocs, but new ABIs like aarch64 have only one reloc for calls.
So it was a mistake in the RISC-V ABI to define two relocs.  The LLVM
RISC-V port actually handles the two relocs exactly the same.  GNU ld
handles them slightly differently, but that is something that needs to
be fixed when we deprecate one.  I think that the RISC-V gcc port
always emits the R_RISCV_CALL_PLT reloc when PIC, and always emits
R_RISCV_CALL when not-PIC.  Then the linker decides for
R_RISCV_CALL_PLT whether we actually need a plt or not.

Anyways, if you want to know where the PLT call is coming from, you
can't rely on the relocs.  R_RISCV_CALL_PLT is not necessarily a plt


More information about the Libc-alpha mailing list