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

Maciej W. Rozycki macro@wdc.com
Fri Aug 21 10:44:16 GMT 2020


On Thu, 20 Aug 2020, Alistair Francis wrote:

> >  The `h->needs_plt' flag is set by this `riscv_elf_check_relocs' code in
> > bfd/elfnn-riscv.c:
> >
> >         case R_RISCV_CALL_PLT:
> >           /* This symbol requires a procedure linkage table entry.  We
> >              actually build the entry in adjust_dynamic_symbol,
> >              because this might be a case of linking PIC code without
> >              linking in any dynamic objects, in which case we don't
> >              need to generate a procedure linkage table after all.  */
> >
> >           if (h != NULL)
> >             {
> >               h->needs_plt = 1;
> >               h->plt.refcount += 1;
> >             }
> >           break;
> >
> > due to a reference from `addtf3.o', from `libgcc.a'.  There are further 20
> > references for a total of 21.  There is a later opportunity for the flag
> > to be cleared in `riscv_elf_adjust_dynamic_symbol', as observed in the
> > comment, however that only happens for symbols that bind locally, or which
> > are not referenced, and for `memset' obviously neither is the case (and
> > `allocate_dynrelocs' sets `h->plt.offset' in place of `h->plt.refcount'
> > then).
> >
> >  I don't think we have a way to redirect the reference to `__GI_memset'.
> 
> I'm not really clear where this ended up. I have a session at Plumbers
> next week to discuss the RV32 port and am planning on discussing this
> issue as well.

 This: <https://sourceware.org/pipermail/binutils/2020-August/112750.html> 
ought to sort it AFAICT.

  Maciej


More information about the Libc-alpha mailing list