[PATCH] PR gold/18886: Unnecessary PLT entry for IFUNC function from DSO

Markus Trippelsdorf markus@trippelsdorf.de
Mon Sep 7 10:25:00 GMT 2015


On 2015.09.01 at 18:02 -0700, Cary Coutant wrote:
> >         PR gold/18886
> >         * resolve.cc (Symbol::override_base): Turn IFUNC symbols from
> >         shared libraries into normal FUNC symbols.
> > ---
> >  gold/resolve.cc | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/gold/resolve.cc b/gold/resolve.cc
> > index 2dcf7b5..dd5b6b6 100644
> > --- a/gold/resolve.cc
> > +++ b/gold/resolve.cc
> > @@ -98,7 +98,13 @@ Symbol::override_base(const elfcpp::Sym<size, big_endian>& sym,
> >    this->is_ordinary_shndx_ = is_ordinary;
> >    // Don't override st_type from plugin placeholder symbols.
> >    if (object->pluginobj() == NULL)
> > -    this->type_ = sym.get_st_type();
> > +    {
> > +      // Turn IFUNC symbols from shared libraries into normal FUNC symbols.
> > +      elfcpp::STT type = sym.get_st_type();
> > +      if (object->is_dynamic() && type == elfcpp::STT_GNU_IFUNC)
> > +       type = elfcpp::STT_FUNC;
> > +      this->type_ = type;
> > +    }
> >    this->binding_ = sym.get_st_bind();
> >    this->override_visibility(sym.get_st_visibility());
> >    this->nonvis_ = sym.get_st_nonvis();
> 
> In symtab.cc, Symbol_table::sized_write_symbol(), we do this
> replacement as we're writing symbols to the output file:
> 
>   // Turn IFUNC symbols from shared libraries into normal FUNC symbols.
>   if (type == elfcpp::STT_GNU_IFUNC
>       && sym->is_from_dynobj())
>     type = elfcpp::STT_FUNC;
> 
> Since that's being done earlier now, that code should be replaced with:
> 
>   gold_assert(type != elfcpp::STT_GNU_IFUNC || !sym->is_from_dynobj());
> 
> OK with that change. Thanks!

This caused:
https://sourceware.org/bugzilla/show_bug.cgi?id=18930

-- 
Markus



More information about the Binutils mailing list