kbuild: Use -nostdinc in compile tests (workaround for #717557)

svn path=/dists/sid/linux/; revision=20729
This commit is contained in:
Ben Hutchings 2013-10-19 21:37:09 +00:00
parent 2ceff05667
commit 5bbabb3e64
3 changed files with 85 additions and 0 deletions

3
debian/changelog vendored
View File

@ -4,6 +4,9 @@ linux (3.11.5-2) UNRELEASED; urgency=low
* [armhf] Enable Xen and virtio for armmp and armmp-lpae as well as KVM for
armmp-lpae only.
[ Ben Hutchings ]
* kbuild: Use -nostdinc in compile tests (workaround for #717557)
-- Ian Campbell <ijc@hellion.org.uk> Sat, 19 Oct 2013 10:34:53 +0100
linux (3.11.5-1) unstable; urgency=low

View File

@ -0,0 +1,81 @@
From: Ben Hutchings <ben@decadent.org.uk>
Date: Sat, 19 Oct 2013 19:43:35 +0100
Subject: kbuild: Use -nostdinc in compile tests
Bug-Debian: http://bugs.debian.org/717557
Forwarded: no
Debian's gcc 4.8 pre-includes <stdc-predef.h> by default, which in
turn includes <bits/predefs.h>. This fails when building a 64-bit
kernel and only 32-bit C library headers installed.
The -nostdinc option disables this, though it isn't explicitly
documented. This option is already used when actually building
the kernel.
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -110,12 +110,12 @@ as-instr = $(call try-run,\
# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
cc-option = $(call try-run,\
- $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))
+ $(CC) $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))
# cc-option-yn
# Usage: flag := $(call cc-option-yn,-march=winchip-c6)
cc-option-yn = $(call try-run,\
- $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n)
+ $(CC) $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n)
# cc-option-align
# Prefix align with either -falign or -malign
@@ -125,16 +125,17 @@ cc-option-align = $(subst -functions=0,,
# cc-disable-warning
# Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
cc-disable-warning = $(call try-run,\
- $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
+ $(CC) $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
# cc-version
# Usage gcc-ver := $(call cc-version)
-cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))
+cc-version = $(shell $(CONFIG_SHELL) \
+ $(srctree)/scripts/gcc-version.sh $(CC) $(NOSTDINC_FLAGS))
# cc-fullversion
# Usage gcc-ver := $(call cc-fullversion)
cc-fullversion = $(shell $(CONFIG_SHELL) \
- $(srctree)/scripts/gcc-version.sh -p $(CC))
+ $(srctree)/scripts/gcc-version.sh -p $(CC) $(NOSTDINC_FLAGS))
# cc-ifversion
# Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)
@@ -148,7 +149,7 @@ cc-ldoption = $(call try-run,\
# ld-option
# Usage: LDFLAGS += $(call ld-option, -X)
ld-option = $(call try-run,\
- $(CC) -x c /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2))
+ $(CC) $(NOSTDINC_FLAGS) -x c /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2))
# ar-option
# Usage: KBUILD_ARFLAGS := $(call ar-option,D)
--- a/Makefile
+++ b/Makefile
@@ -578,6 +578,8 @@ else
KBUILD_CFLAGS += -O2
endif
+NOSTDINC_FLAGS += -nostdinc
+
include $(srctree)/arch/$(SRCARCH)/Makefile
ifdef CONFIG_READABLE_ASM
@@ -646,7 +648,7 @@ KBUILD_CFLAGS += $(call cc-option, -fno-
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)
CHECKFLAGS += $(NOSTDINC_FLAGS)
# warn about C99 declaration after statement

View File

@ -79,3 +79,4 @@ bugfix/m68k/atari-irqs.patch
bugfix/all/compiler-gcc-4-add-quirk-for-asm-goto-miscompilation-bug.patch
bugfix/all/crypto-ansi_cprng-Fix-off-by-one-error-in-non-block-.patch
features/all/mvsas-Recognise-device-subsystem-9485-9485-as-88SE94.patch
bugfix/all/kbuild-use-nostdinc-in-compile-tests.patch