This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Call GNU ld with -O*


On Fri, Jul 12, 2013 at 06:12:26PM +0200, Marc Glisse wrote:
> On Fri, 12 Jul 2013, Jakub Jelinek wrote:
> 
> >On Fri, Jul 12, 2013 at 04:54:21PM +0200, Marc Glisse wrote:
> >>+/* GNU ld has -O1 and gold -O2, but we only pass it with -O3, -Os or -Ofast. */
> >>+#ifndef LINK_OPT_SPEC
> >>+#if HAVE_GNU_LD
> >>+#define LINK_OPT_SPEC "%{O*:%{!O0:%{!O1:%{!O2:%{!Og:%{!O:-O2}}}}}} "
> >
> >Wouldn't something like "%{O*:%{O|O0|O1|O2|Og:;:-O2}}" work?
> 
> It does (I only did a non-bootstrap c,c++ build and some manual
> tests with -v). Thanks, I didn't know this syntax.

gcc.c has a huge comment that describes the syntax.

> Is the new version ok? Any tests I should do that would be more
> useful than running the testsuite? (I tried with several -O options
> in various orders and made sure that a -Wl,-On ended up later in the
> command line)

I'd say it is important to try say -O17 -O0, -O -O5 etc. and see whether
it works as desired.  If that works, the patch is ok, with proper ChangeLog
entry.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]