diff mbox

GCC being built without optimisation

Message ID CANLjY-=3Gbio6nzUPhhevDHV7cUN=6Vigooe9nSf-RnGCqnjog@mail.gmail.com
State Accepted
Commit a9130ff13b19
Headers show

Commit Message

Michael Hope Nov. 14, 2012, 1:06 a.m. UTC
On 14 November 2012 13:30, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> Michael, All,
>
> On Wednesday 14 November 2012 Michael Hope wrote:
>> Hi Yann, all.  Someone recently spotted that the crosstool-NG based
>> Linaro builds took twice as long to compile code than the Ubuntu cross
>> compiler.
> [--SNIP--]
>> It turns out that GCC and the libraries are being built without
>> optimisation.
> [--SNIP--]
>> scripts: set default CFLAGS to optimise.
>>
>> Our extra CFLAGS override the product defaults, meaning that we build
>> without optimisation or debug.  Be explicit and add these in.
>
> Can I have your SoB-line for that patch?

scripts: set default CFLAGS to optimise.

The extra CFLAGS override the product defaults, causing the product to
be built without optimisation or debug.  Be explicit and add these in.

Signed-off-by: Michael Hope <michael.hope@linaro.org>

>> diff:
>> === modified file 'scripts/crosstool-NG.sh.in'
>> --- scripts/crosstool-NG.sh.in  2012-03-23 05:22:58 +0000
>> +++ scripts/crosstool-NG.sh.in  2012-11-13 23:50:41 +0000
>> @@ -488,7 +488,7 @@
>>      fi
>>
>>      # Help gcc
>> -    CT_CFLAGS_FOR_HOST=
>> +    CT_CFLAGS_FOR_HOST="-O2 -g"
>>      [ "${CT_USE_PIPES}" = "y" ] && CT_CFLAGS_FOR_HOST+=" -pipe"
>>      CT_CFLAGS_FOR_HOST+=" ${CT_EXTRA_FLAGS_FOR_HOST}"
>
> Whoohoo! A one-liner that makes it twice faster! Love it :-)
> I'll look at it tomorrow.
>
> Also, I'd like to review your crosstool-NG fork, to see what we can bring
> back upstream, so you get less to maintain in your tree, so it makes it
> easier for you to follow upstream. That item's been basically sitting quite
> high on my TODO-list, but time being sparse, I always post-poned it. I'll
> try to get to it during this cycle.

It's our fault for forking.  Most of the stuff is Linaro specific
(samples, outer build scripts) and the remainder is hacks.

We're going to rebase as part of upstreaming the aarch64 support to
you.  I was reluctant to post it as we needed to pick random binutils
and other versions, but the recent Microblaze work has added all we
need.  FYI, we track things through blueprints and the aarch64
upstreaming is logged at:

 https://launchpad.net/linaro-toolchain-binaries/+spec/upstream-crosstool-ng-aarch64-support

-- Michael

> Do you think you could come up with a list of features / changesets you have
> in your tree that would be suitable for upstreaming?
>
> Also, I'm not used to bazaar. Can you point me to a quick cheat-sheet?
>
> Regards,
> Yann E. MORIN, sleepy at 01:27 AM... Zzzz....
>
> --
> .-----------------.--------------------.------------------.--------------------.
> |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
> | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
> | +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
> | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
> '------------------------------^-------^------------------^--------------------'

--
For unsubscribe information see http://sourceware.org/lists.html#faq

Comments

Johannes Stezenbach Nov. 14, 2012, 9:40 a.m. UTC | #1
On Wed, Nov 14, 2012 at 02:06:18PM +1300, Michael Hope wrote:
> On 14 November 2012 13:30, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> > On Wednesday 14 November 2012 Michael Hope wrote:
> >> It turns out that GCC and the libraries are being built without
> >> optimisation.
...
> --- a/scripts/crosstool-NG.sh.in	Fri Nov 09 18:22:31 2012 +0100
> +++ b/scripts/crosstool-NG.sh.in	Wed Nov 14 13:48:18 2012 +1300
> @@ -494,7 +494,9 @@
>      fi
> 
>      # Help gcc
> -    CT_CFLAGS_FOR_HOST=
> +    # Explicitly optimise, else the lines below will overide the
> +    # package's default optimisation flags
> +    CT_CFLAGS_FOR_HOST="-O2 -g"
>      [ "${CT_USE_PIPES}" = "y" ] && CT_CFLAGS_FOR_HOST+=" -pipe"
>      CT_CFLAGS_FOR_HOST+=" ${CT_EXTRA_FLAGS_FOR_HOST}"

FWIW, I brought this issue up in February:
http://sourceware.org/ml/crossgcc/2012-02/msg00089.html

I should've sent a patch but it was so easy to just
use CT_EXTRA_FLAGS_FOR_HOST...

Johannes

--
For unsubscribe information see http://sourceware.org/lists.html#faq
Michael Hope Nov. 14, 2012, 8:36 p.m. UTC | #2
On 14 November 2012 22:40, Johannes Stezenbach <js@sig21.net> wrote:
> On Wed, Nov 14, 2012 at 02:06:18PM +1300, Michael Hope wrote:
>> On 14 November 2012 13:30, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
>> > On Wednesday 14 November 2012 Michael Hope wrote:
>> >> It turns out that GCC and the libraries are being built without
>> >> optimisation.
> ...
>> --- a/scripts/crosstool-NG.sh.in      Fri Nov 09 18:22:31 2012 +0100
>> +++ b/scripts/crosstool-NG.sh.in      Wed Nov 14 13:48:18 2012 +1300
>> @@ -494,7 +494,9 @@
>>      fi
>>
>>      # Help gcc
>> -    CT_CFLAGS_FOR_HOST=
>> +    # Explicitly optimise, else the lines below will overide the
>> +    # package's default optimisation flags
>> +    CT_CFLAGS_FOR_HOST="-O2 -g"
>>      [ "${CT_USE_PIPES}" = "y" ] && CT_CFLAGS_FOR_HOST+=" -pipe"
>>      CT_CFLAGS_FOR_HOST+=" ${CT_EXTRA_FLAGS_FOR_HOST}"
>
> FWIW, I brought this issue up in February:
> http://sourceware.org/ml/crossgcc/2012-02/msg00089.html
>
> I should've sent a patch but it was so easy to just
> use CT_EXTRA_FLAGS_FOR_HOST...

Looking at the original discussion, a nice thing about putting these
options first is EXTRA_FLAGS appear later in the command line and can
override these defaults.  So if you want to build at -Os you can.  I
can't find the 'disable debug' option though - I thought there was a
'-no-flag-name' such as '-no-g' addeded in recent GCCs.

-- Michael

--
For unsubscribe information see http://sourceware.org/lists.html#faq
Yann E. MORIN Nov. 14, 2012, 8:48 p.m. UTC | #3
Michael, All,

On Wednesday 14 November 2012 Michael Hope wrote:
> scripts: set default CFLAGS to optimise.

OK, will push. Thank you! :-)

> On 14 November 2012 13:30, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> > Also, I'd like to review your crosstool-NG fork, to see what we can bring
> > back upstream, so you get less to maintain in your tree, so it makes it
> > easier for you to follow upstream. That item's been basically sitting quite
> > high on my TODO-list, but time being sparse, I always post-poned it. I'll
> > try to get to it during this cycle.
> 
> It's our fault for forking.  Most of the stuff is Linaro specific
> (samples, outer build scripts) and the remainder is hacks.

Well, at least we can try to see if there are things that can be shaped
for upstreaming.

(And no, forking is not a fault!)

> We're going to rebase as part of upstreaming the aarch64 support to
> you.

Ah-Ah! See, you've got things to upstream! :-)
I'm eager to see that!

> I was reluctant to post it as we needed to pick random binutils
> and other versions, but the recent Microblaze work has added all we
> need.

Great! Looks like the timing was good, then. :-)

Regards,
Yann E. MORIN.
Yann E. MORIN Nov. 14, 2012, 8:49 p.m. UTC | #4
Johannes, All,

On Wednesday 14 November 2012 Johannes Stezenbach wrote:
> On Wed, Nov 14, 2012 at 02:06:18PM +1300, Michael Hope wrote:
> > On 14 November 2012 13:30, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> > > On Wednesday 14 November 2012 Michael Hope wrote:
> > >> It turns out that GCC and the libraries are being built without
> > >> optimisation.
[--SNIP--]
> FWIW, I brought this issue up in February:
> http://sourceware.org/ml/crossgcc/2012-02/msg00089.html

Doh... Sorry, it slipped through the cracks... :-(

Regards,
Yann E. MORIN.
Yann E. MORIN Nov. 14, 2012, 10:49 p.m. UTC | #5
Michael, All,

Your patch:
    scripts: set default CFLAGS to optimise.

has been applied as: #a9130ff13b19
    http://crosstool-ng.org/hg/crosstool-ng/rev/a9130ff13b19

Thank you!

Regards,
Yann E. MORIN.



--
For unsubscribe information see http://sourceware.org/lists.html#faq
diff mbox

Patch

diff -r cfb1783d4cb8 -r d7c10d1bc152 scripts/crosstool-NG.sh.in
--- a/scripts/crosstool-NG.sh.in	Fri Nov 09 18:22:31 2012 +0100
+++ b/scripts/crosstool-NG.sh.in	Wed Nov 14 13:48:18 2012 +1300
@@ -494,7 +494,9 @@ 
     fi

     # Help gcc
-    CT_CFLAGS_FOR_HOST=
+    # Explicitly optimise, else the lines below will overide the
+    # package's default optimisation flags
+    CT_CFLAGS_FOR_HOST="-O2 -g"
     [ "${CT_USE_PIPES}" = "y" ] && CT_CFLAGS_FOR_HOST+=" -pipe"
     CT_CFLAGS_FOR_HOST+=" ${CT_EXTRA_FLAGS_FOR_HOST}"