This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [patch][rfc] Enabling more optimizations with -ON
- From: Rafael EspÃndola <rafael dot espindola at gmail dot com>
- To: Cary Coutant <ccoutant at google dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Thu, 20 Nov 2014 10:02:23 -0500
- Subject: Re: [patch][rfc] Enabling more optimizations with -ON
- Authentication-results: sourceware.org; auth=none
- References: <CAG3jRe+UXKKwUq==KLx9TQx2cSr2F-=fgz6cN41TndGoTwgaoQ at mail dot gmail dot com> <20141119230722 dot GA3225 at vapier dot wh0rd dot info> <CAG3jReL2HW7zp=Y9fLuYzcOg+_=6OyoTMgaUSZA7ebS6NzDSuQ at mail dot gmail dot com> <CAHACq4owqzc0oj3e_SkX4z6tsfAbvgp3-F+-BCCVqz10hTU1EQ at mail dot gmail dot com>
On 19 November 2014 19:25, Cary Coutant <ccoutant@google.com> wrote:
> Sorry, Rafael, I'm not ignoring your proposal -- I'm just pondering
> it. I'm not wild about the -O option in the first place, since it
> implies that we can nicely arrange the various optimizations into some
> order. Right now, we use it in exactly two places: -O1 with
> --compress-debug-sections uses ZIP compression level 9 instead of 1,
> and -O2 does tail optimization of the string tables. Both of those
> probably would have been cleaner with distinct options, but it was
> convenient and both simply trade a little link time for a smaller
> executable without any risk. It's not clear to me that --gc-sections
> or --icf are universally applicable, which is what bundling them with
> some optimization level would imply.
The issue then is that every software package has to test what liker
is being used to link it.
I got here by first modifying the clang build to pass --gc-sections
when linking clang. That found that older versions of bfd ld could not
handle --export-dynamic+gc-sections. I could (and if needed will)
write a check for "is this gold or a fixed bfd ld", but that need is
common to every project that wants gc-sections, so I tried to make
something more generic.
In the compiler land a project can just use -ON (module bugs) instead
of "-fopt1 -fopt2
-fopt-something-introduced-in-gcc-4.9-but-an-error-in-4.8".
Cheers,
Rafael