This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] libgcov.c re-factoring and offline profile-tool
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: Xinliang David Li <davidxl at google dot com>, Rong Xu <xur at google dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 5 Nov 2013 10:23:44 +0100
- Subject: Re: [RFC] libgcov.c re-factoring and offline profile-tool
- Authentication-results: sourceware.org; auth=none
- References: <CAF1bQ=Qy6--WX-bLYZ8aWXjVVu4pW-H3U+PkATgXwg5c7MZsBg at mail dot gmail dot com> <CAAkRFZ+-tLZqUNQRtu7jN3d3BYG8oi-+q0J6pkduHp5GS3oTkQ at mail dot gmail dot com> <20131104095529 dot GB28992 at kam dot mff dot cuni dot cz> <CAF1bQ=THYY8NqoJ0XDYxnFS9=j9P6-5nLwA6nX1bA+0v1zmUoQ at mail dot gmail dot com> <CAAkRFZK-AoS4eKBnoNciHeq5kn5sP60rqyV1dVZVaBte1aW-ew at mail dot gmail dot com> <20131105091850 dot GB13502 at kam dot mff dot cuni dot cz>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Nov 05, 2013 at 10:18:50AM +0100, Jan Hubicka wrote:
> > I wonder if it makes sense to get rid of the conditional compile such as
> >
> > #ifdef L_gcov_xxxxx
> > ..
> >
> > #endif
> >
> > This has the advantage of producing slightly smaller instrumented
> > binary, but this benefit can also be achieved via -ffunction-sections
> > and let linker to garbage collect unused functions.
> >
> > (probably as a follow up if it makes sense).
>
> I believe we use this funny scheme primarily for targets that have no function
> section support (and also the hand made splitting can be more sane).
> For a low-level library like libgcov is that is supposed to have small footprint,
> I guess the current scheme is resonable thing to do....
I think the #ifdef L* stuff is there mainly so that we have small
granularity in the *.a libraries (one function per object file), so that one
links only what is really required (at least, that is why libgcc.a does
that). Of course, if there are many interdependencies between the functions
and you always essentially link in everything, the usefulness of that is
lower.
Jakub