public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Michal Marek <mmarek@suse.cz>
To: Ben Hutchings <ben@decadent.org.uk>
Cc: linux-kbuild <linux-kbuild@vger.kernel.org>
Subject: Re: [PATCH] kbuild: Use -nostdinc in compile tests
Date: Tue, 25 Nov 2014 22:53:06 +0100	[thread overview]
Message-ID: <5474FA42.20605@suse.cz> (raw)
In-Reply-To: <1415235534.3398.35.camel@decadent.org.uk>

Dne 6.11.2014 v 01:58 Ben Hutchings napsal(a):
> gcc 4.8 and later include <stdc-predef.h> by default.  In some
> versions of eglibc that includes <bits/predefs.h>, but that may be
> missing when building with a biarch compiler.  Also <stdc-predef.h>
> itself could be missing as we are only trying to build a kernel, not
> userland.
> 
> The -nostdinc option disables this, though it isn't explicitly
> documented.  This option is already used when actually building
> the kernel, but not by cc-option and other tests.  This can result
> in silently miscompiling the kernel.
> 
> References: https://bugs.debian.org/717557
> References: https://bugs.debian.org/726861
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> ---
> This specific issue appeared and then was fixed in Debian about a year
> ago, but it seems like it can also affect cross-builds.
> 
> It may also be worth adding some sort of sanity test, so we stop
> immediately if $(cc-option $(empty),broken) yields 'broken'.
> 
> Ben.
> 
>  Makefile               |  4 +++-
>  scripts/Kbuild.include | 15 ++++++++-------
>  2 files changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index ffc1ce2..c0fbf67 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -619,6 +619,8 @@ endif
>  # Tell gcc to never replace conditional load with a non-conditional one
>  KBUILD_CFLAGS	+= $(call cc-option,--param=allow-store-data-races=0)
>  
> +NOSTDINC_FLAGS += -nostdinc
> +
>  ifdef CONFIG_READABLE_ASM
>  # Disable optimizations that make assembler listings hard to read.
>  # reorder blocks reorders the control in the function
> @@ -742,7 +744,7 @@ KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once)
>  endif
>  
>  # arch Makefile may override CC so keep this after arch Makefile is included
> -NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
> +NOSTDINC_FLAGS += -isystem $(shell $(CC) -print-file-name=include)

Why not simply move the whole assignment up? Also, there are two
cc-option tests and one cc-disable-warning test before the first part
assignment. Looks like a result of a mismerge.

Michal

  reply	other threads:[~2014-11-25 21:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-06  0:58 [PATCH] kbuild: Use -nostdinc in compile tests Ben Hutchings
2014-11-25 21:53 ` Michal Marek [this message]
2014-11-26 13:47   ` Michal Marek

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=5474FA42.20605@suse.cz \
    --to=mmarek@suse.cz \
    --cc=ben@decadent.org.uk \
    --cc=linux-kbuild@vger.kernel.org \
    /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