This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Selftest framework (v7)
- From: Trevor Saunders <tbsaunde at tbsaunde dot org>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: David Malcolm <dmalcolm at redhat dot com>, Bernd Schmidt <bernds_cb1 at t-online dot de>, gcc-patches at gcc dot gnu dot org, Bernd Schmidt <bschmidt at redhat dot com>, Jeff Law <law at redhat dot com>
- Date: Mon, 6 Jun 2016 22:14:32 -0400
- Subject: Re: [PATCH] Selftest framework (v7)
- Authentication-results: sourceware.org; auth=none
- References: <5750BF79 dot 20201 at redhat dot com> <1464981166-25871-1-git-send-email-dmalcolm at redhat dot com> <57540F16 dot 8050504 at t-online dot de> <1465222628 dot 11895 dot 58 dot camel at redhat dot com> <20160606215350 dot GB29668 at ball> <20160606215749 dot GK7387 at tucnak dot redhat dot com>
On Mon, Jun 06, 2016 at 11:57:49PM +0200, Jakub Jelinek wrote:
> On Mon, Jun 06, 2016 at 05:53:50PM -0400, Trevor Saunders wrote:
> > > > As far as I can
> > > > tell this just involves moving the start of namespace selftest
> > > > upwards a
> > > > bit in the files where we have tests.
> > >
> > > Yes, and it does seem cleaner to have all of the selftest code start
> > > like this:
> > >
> > > #if CHECKING_P
> >
> > What are we gaining by ifdefing this? I would think on reasonable
> > systems the compiler would optimize out the call to the selftests in
> > release builds and then the linker would gc all the unused functions.
> > Do we really care about code size in places that doesn't happen enough
> > to go through this?
>
> Not everyone is building the compiler with LTO, and if you don't, then
> how would you optimize that away?
-ffunction-sections -Wl,--gc-sections should be enough I think. I guess
we don't use those at the moment though.
> And yes, not having the self-tests, especially if they are going to grow
> further, in release compilers is desirable, especially if it would be
> intermixed with hot code.
That's fair, though turning on --gc-sections where we can should further
help with that, and that should be more effective with
-ffunction-sections -fdata-sections, so its seems to me like the right
thing to do is add configure tests to enable those? And then its more
of a non issue?
Trev
>
> Jakub