Skip to contentSkip to conversation

toolchain: get rid of -pipe from optimisations

PATCH New Yann E. MORIN 3 participants 4 messages Dec 21, 2014 – Jan 26, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 toolchain: get rid of -pipe from optimisations

-pipe is causing some build failures in Linux kernel >= 3.17.

Also, nowadays, using -pipe does not gain as much as it used to back in the days:

Measurements made with a 3.16.7 Linux kernel:
make linux-depends
time sh -c 'make linux-build >/dev/null 2>&1'

Without -pipe:

    716.32user 54.44system 3:42.12elapsed 346%CPU
    721.22user 54.47system 3:41.81elapsed 349%CPU
    722.44user 54.00system 3:42.13elapsed 349%CPU
    721.03user 53.81system 3:41.92elapsed 349%CPU
    713.21user 53.63system 3:40.51elapsed 347%CPU
    706.67user 52.42system 3:38.40elapsed 347%CPU
    714.40user 53.18system 3:40.16elapsed 348%CPU
    706.01user 53.09system 3:37.87elapsed 348%CPU
    705.98user 53.01system 3:38.03elapsed 348%CPU
    714.17user 53.55system 3:39.98elapsed 348%CPU

Average: 3:40.29elapsed

With -pipe:

    720.13user 53.90system 3:41.98elapsed 348%CPU
    713.38user 53.69system 3:40.44elapsed 347%CPU
    711.60user 52.81system 3:39.06elapsed 348%CPU
    708.66user 53.09system 3:38.59elapsed 348%CPU
    711.76user 53.00system 3:38.48elapsed 350%CPU
    717.85user 53.97system 3:41.77elapsed 348%CPU
    716.77user 53.77system 3:40.91elapsed 348%CPU
    717.48user 53.65system 3:41.24elapsed 348%CPU
    721.44user 55.67system 3:43.45elapsed 347%CPU
    724.61user 55.63system 3:43.35elapsed 349%CPU

Average: 3:40.93elapsed

The delta is well in the measurement noise.

Just get rid of it.

Cc Romain Naour <[email protected]>
Cc Thomas Petazzoni <[email protected]>
---
 toolchain/toolchain-common.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
toolchain/toolchain-common.in +1 -1
index b246834..2ee2019 100644
@@ -122,7 +122,7 @@ config BR2_USE_MMU
 
 config BR2_TARGET_OPTIMIZATION
 	string "Target Optimizations"
-	default "-pipe"
+	default ""
 	help
 	  Optimizations to use when building for the target host.
 	  NOTE: gcc optimization level is defined in build options.
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 toolchain: get rid of -pipe from optimisations

Dear Yann E. MORIN,

Quoted 37 lines · Yann E. MORIN

-pipe is causing some build failures in Linux kernel >= 3.17.

Also, nowadays, using -pipe does not gain as much as it used to back in the days:

Measurements made with a 3.16.7 Linux kernel:
make linux-depends
time sh -c 'make linux-build >/dev/null 2>&1'

Without -pipe:

    716.32user 54.44system 3:42.12elapsed 346%CPU
    721.22user 54.47system 3:41.81elapsed 349%CPU
    722.44user 54.00system 3:42.13elapsed 349%CPU
    721.03user 53.81system 3:41.92elapsed 349%CPU
    713.21user 53.63system 3:40.51elapsed 347%CPU
    706.67user 52.42system 3:38.40elapsed 347%CPU
    714.40user 53.18system 3:40.16elapsed 348%CPU
    706.01user 53.09system 3:37.87elapsed 348%CPU
    705.98user 53.01system 3:38.03elapsed 348%CPU
    714.17user 53.55system 3:39.98elapsed 348%CPU

Average: 3:40.29elapsed

With -pipe:

    720.13user 53.90system 3:41.98elapsed 348%CPU
    713.38user 53.69system 3:40.44elapsed 347%CPU
    711.60user 52.81system 3:39.06elapsed 348%CPU
    708.66user 53.09system 3:38.59elapsed 348%CPU
    711.76user 53.00system 3:38.48elapsed 350%CPU
    717.85user 53.97system 3:41.77elapsed 348%CPU
    716.77user 53.77system 3:40.91elapsed 348%CPU
    717.48user 53.65system 3:41.24elapsed 348%CPU
    721.44user 55.67system 3:43.45elapsed 347%CPU
    724.61user 55.63system 3:43.35elapsed 349%CPU

Average: 3:40.93elapsed

The delta is well in the measurement noise.

Quoted 8 lines

Just get rid of it.

Cc Romain Naour <[email protected]>
Cc Thomas Petazzoni <[email protected]>
---
 toolchain/toolchain-common.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 toolchain: get rid of -pipe from optimisations

In reply to Yann E. MORIN

Hi Yann, All,

Le 21/12/2014 14:00, Yann E. MORIN a ?crit :

Quoted 2 lines

-pipe is causing some build failures in Linux kernel >= 3.17.

For the record.

According to Mentor codeSourcey support, the issue with -pipe is a kernel bug which was introduced by the commit a9cfccee6604854aebc70215610b9788667f4fec in the kernel 3.17 sources.

"x86, build: Change code16gcc.h from a C header to an assembly header"

-# older versions of GCC, we need to play evil and unreliable tricks to -# attempt to ensure that our asm(".code16gcc") is first in the asm -# output.
-CODE16GCC_CFLAGS := -m32 -include $(srctree)/arch/x86/boot/code16gcc.h \
- $(call cc-option, -fno-toplevel-reorder,\
- $(call cc-option, -fno-unit-at-a-time))
+# older versions of GCC, include an *assembly* header to make sure that +# gcc doesn't play any games behind our back. +CODE16GCC_CFLAGS := -m32 -Wa,$(srctree)/arch/x86/boot/code16gcc.h

But the bug seems to apply only on specific version of the GCC compiler (4.6, 4.7 or 4.8). I don't know why GCC 4.9 is not affected/what fixed the issue...

The issue can be reproduced with this toolchain:
http://autobuild.buildroot.net/toolchains/configs/x86_64-ctng_locales-linux-gnu.config

Here is the explanation:
"With -pipe, the compiler calls the assembler with no input file arguments to indicate that it should take input from stdin.
This means that if you pass an extra input file argument using -Wa, you confuse the expected interface between the compiler and assembler because the assembler sees an input file argument and so does not read stdin; you either need to avoid -pipe for the affected compilations, or pass an extra "-" argument to the assembler (-Wa,-) for those compiler versions."

So I tried to compile the kernel by changing this line:
-CODE16GCC_CFLAGS := -m32 -Wa,$(srctree)/arch/x86/boot/code16gcc.h +CODE16GCC_CFLAGS := -m32 -Wa,-,$(srctree)/arch/x86/boot/code16gcc.h

And success, it build !

What is surprising, is until recently we build everything in Buildroot with -pipe and no error like this occurred...

Best regards,
Romain Naour

#3 lore raw

PATCH 1/1 toolchain: get rid of -pipe from optimisations

Dear Romain Naour,

Quoted 5 lines · Romain Naour

So I tried to compile the kernel by changing this line:

(quoted diff) +1 -1
-CODE16GCC_CFLAGS := -m32 -Wa,$(srctree)/arch/x86/boot/code16gcc.h
+CODE16GCC_CFLAGS := -m32 -Wa,-,$(srctree)/arch/x86/boot/code16gcc.h

And success, it build !

[...]

Thanks for the feedback, definitely interesting!

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com