> On Tue, Mar 5, 2024 at 1:45 PM H.J. Lu <hjl.to...@gmail.com> wrote:
> >
> > We can't instrument an IFUNC resolver nor its callees as it may require
> > TLS which hasn't been set up yet when the dynamic linker is resolving
> > IFUNC symbols.
> >
> > Add an IFUNC resolver caller marker to cgraph_node and set it if the
> > function is called by an IFUNC resolver.  Update tree_profiling to skip
> > functions called by IFUNC resolver.
> >
> > Tested with profiledbootstrap on Fedora 39/x86-64.
> >
> > gcc/ChangeLog:
> >
> >         PR tree-optimization/114115
> >         * cgraph.h (symtab_node): Add check_ifunc_callee_symtab_nodes.
> >         (cgraph_node): Add called_by_ifunc_resolver.
> >         * cgraphunit.cc (symbol_table::compile): Call
> >         symtab_node::check_ifunc_callee_symtab_nodes.
> >         * symtab.cc (check_ifunc_resolver): New.
> >         (ifunc_ref_map): Likewise.
> >         (is_caller_ifunc_resolver): Likewise.
> >         (symtab_node::check_ifunc_callee_symtab_nodes): Likewise.
> >         * tree-profile.cc (tree_profiling): Do not instrument an IFUNC
> >         resolver nor its callees.
> >
> > gcc/testsuite/ChangeLog:
> >
> >         PR tree-optimization/114115
> >         * gcc.dg/pr114115.c: New test.
> 
> PING.

I am bit worried about commonly used functions getting "infected" by
being called once from ifunc resolver.  I think we only use thread local
storage for indirect call profiling, so we may just disable indirect
call profiling for these functions.

Also the patch will be noop with -flto -flto-partition=max, so probably
we need to compute this flag at WPA time and stream to partitions.

Honza

Reply via email to