Re: Call GNU ld with -O*

2013-07-15 Thread Michael Matz
Hi, On Fri, 12 Jul 2013, Ian Lance Taylor wrote: > >> It was probably a mistake to have a linker -O option at all. > > > > > > Doesn't the linker produce something that is faster to link and/or smaller, > > with this flag? > > For gold I think it has two effects. If you use compressed debug > s

Re: Call GNU ld with -O*

2013-07-12 Thread Marc Glisse
On Fri, 12 Jul 2013, Ian Lance Taylor wrote: On Fri, Jul 12, 2013 at 12:30 PM, Jakub Jelinek wrote: On Fri, Jul 12, 2013 at 12:25:16PM -0700, Ian Lance Taylor wrote: For gold I think it has two effects. If you use compressed debug sections, it will compress them with zlib level 9 rather than

Re: Call GNU ld with -O*

2013-07-12 Thread Ian Lance Taylor
On Fri, Jul 12, 2013 at 12:30 PM, Jakub Jelinek wrote: > On Fri, Jul 12, 2013 at 12:25:16PM -0700, Ian Lance Taylor wrote: >> For gold I think it has two effects. If you use compressed debug >> sections, it will compress them with zlib level 9 rather than 1. If > > Marc's patch enabled it only f

Re: Call GNU ld with -O*

2013-07-12 Thread Jakub Jelinek
On Fri, Jul 12, 2013 at 12:25:16PM -0700, Ian Lance Taylor wrote: > For gold I think it has two effects. If you use compressed debug > sections, it will compress them with zlib level 9 rather than 1. If Marc's patch enabled it only for -O3/-Ofast (which are already compile time expensive options

Re: Call GNU ld with -O*

2013-07-12 Thread Ian Lance Taylor
On Fri, Jul 12, 2013 at 11:21 AM, Marc Glisse wrote: > On Fri, 12 Jul 2013, Ian Lance Taylor wrote: > >> On Fri, Jul 12, 2013 at 7:54 AM, Marc Glisse wrote: >>> >>> >>> this patch makes the driver pass -O2 to GNU ld if gcc was called with -O3 >>> (or more), -Ofast or -Os. >> >> >> I don't underst

Re: Call GNU ld with -O*

2013-07-12 Thread Marc Glisse
On Fri, 12 Jul 2013, Ian Lance Taylor wrote: On Fri, Jul 12, 2013 at 7:54 AM, Marc Glisse wrote: this patch makes the driver pass -O2 to GNU ld if gcc was called with -O3 (or more), -Ofast or -Os. I don't understand why that is a good idea. Well, you thought it was 3 years ago ;-) http://

Re: Call GNU ld with -O*

2013-07-12 Thread Ian Lance Taylor
On Fri, Jul 12, 2013 at 7:54 AM, Marc Glisse wrote: > > this patch makes the driver pass -O2 to GNU ld if gcc was called with -O3 > (or more), -Ofast or -Os. I don't understand why that is a good idea. The linker -O option is only distantly related to the compiler -O option. It was probably a m

Re: Call GNU ld with -O*

2013-07-12 Thread Thomas Schwinge
Hi! On Fri, 12 Jul 2013 18:53:58 +0200, Jakub Jelinek wrote: > On Fri, Jul 12, 2013 at 09:49:28AM -0700, Thomas Schwinge wrote: > > On Fri, 12 Jul 2013 16:54:21 +0200 (CEST), Marc Glisse > > wrote: > > > this patch makes the driver pass -O2 to GNU ld if gcc was called with -O3 > > > (or more),

Re: Call GNU ld with -O*

2013-07-12 Thread Marc Glisse
On Fri, 12 Jul 2013, Jakub Jelinek wrote: gcc.c has a huge comment that describes the syntax. I know, my first reflex after reading your email was to re-read that comment to understand what you had written ;-) Is the new version ok? Any tests I should do that would be more useful than runn

Re: Call GNU ld with -O*

2013-07-12 Thread Jakub Jelinek
On Fri, Jul 12, 2013 at 09:49:28AM -0700, Thomas Schwinge wrote: > Hi! > > On Fri, 12 Jul 2013 16:54:21 +0200 (CEST), Marc Glisse > wrote: > > this patch makes the driver pass -O2 to GNU ld if gcc was called with -O3 > > (or more), -Ofast or -Os. > > I wondered about this before: why are no -O

Re: Call GNU ld with -O*

2013-07-12 Thread Thomas Schwinge
Hi! On Fri, 12 Jul 2013 16:54:21 +0200 (CEST), Marc Glisse wrote: > this patch makes the driver pass -O2 to GNU ld if gcc was called with -O3 > (or more), -Ofast or -Os. I wondered about this before: why are no -O flags are passed to the (GNU) linker. What's the rationale for the mapping you

Re: Call GNU ld with -O*

2013-07-12 Thread Jakub Jelinek
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 H

Re: Call GNU ld with -O*

2013-07-12 Thread Marc Glisse
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}} "

Re: Call GNU ld with -O*

2013-07-12 Thread Jakub Jelinek
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|O