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

Alistair Francis alistair23@gmail.com
Sat Sep 12 21:51:07 GMT 2020


On Thu, Aug 27, 2020 at 11:31 AM Alistair Francis <alistair23@gmail.com> wrote:
>
> On Fri, Aug 21, 2020 at 3:44 AM Maciej W. Rozycki <macro@wdc.com> wrote:
> >
> > 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.
>
> Thanks!
>
> This was discussed in the RISC-V Plumbers session yesterday and the
> decision was made to just ignore this failure and wait for the
> binutils patch.

So apparently the binutils patch does not fix it.

I'm going to apply this patch. It has been acked by Palmer. Let me
know if anyone objects.

Alistair

>
> Alistair
>
> >
> >   Maciej


More information about the Libc-alpha mailing list