Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Romain Naour <romain.naour@openwide.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] toolchain: get rid of -pipe from optimisations
Date: Mon, 26 Jan 2015 22:51:16 +0100	[thread overview]
Message-ID: <54C6B6D4.5060608@openwide.fr> (raw)
In-Reply-To: <1419166825-25133-1-git-send-email-yann.morin.1998@free.fr>

Hi Yann, All,

Le 21/12/2014 14:00, Yann E. MORIN a ?crit :
> -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

  parent reply	other threads:[~2015-01-26 21:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-21 13:00 [Buildroot] [PATCH] toolchain: get rid of -pipe from optimisations Yann E. MORIN
2014-12-21 21:05 ` Thomas Petazzoni
2015-01-26 21:51 ` Romain Naour [this message]
2015-01-26 21:57   ` Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54C6B6D4.5060608@openwide.fr \
    --to=romain.naour@openwide.fr \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox