[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#841500: gcc-6: Unable to compile upstream kernel with previous .config



On Thu, 27 Oct 2016 01:23:14 -0700 Andres Freund <andres@anarazel.de> wrote:
On 2016-10-27 06:25:00 +0000, Niels Thykier wrote:
> I believe it is possible to compile the kernel with gcc-5.  I hope you
> will consider that an acceptable workaround for you in the interim while
> we solve #841419.

It's quite possible to compile the kernel with a newer gcc as well, you
just need to add the necessary CFLAGs. In my build script I've adjusted
things to:
time make -j8 KCPPFLAGS="-fno-pic -Wno-pointer-sign"
and the kernel compiles and runs normally again.



Thanks.

Does this patch solve also the stack-protector compilation issue? And why is -Wno-pointer-sign needed?

Attached is the upstream currently proposed patch (borrowed from LKML). WFM !

--eric
--- linux/Makefile~	2016-10-27 21:59:02.777575151 +0200
+++ linux/Makefile	2016-10-27 22:00:46.014577729 +0200
@@ -615,6 +615,7 @@
 ARCH_CFLAGS :=
 include arch/$(SRCARCH)/Makefile
 
+KBUILD_CFLAGS += $(call cc-option,-fno-pie,)
 KBUILD_CFLAGS	+= $(call cc-option,-fno-delete-null-pointer-checks,)
 KBUILD_CFLAGS	+= $(call cc-disable-warning,maybe-uninitialized,)
 
--- linux/scripts/gcc-x86_64-has-stack-protector.sh~	2016-06-24 19:18:38.000000000 +0200
+++ linux/scripts/gcc-x86_64-has-stack-protector.sh	2016-10-27 22:01:36.685581816 +0200
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-echo "int foo(void) { char X[200]; return 3; }" | $* -S -x c -c -O0 -mcmodel=kernel -fstack-protector - -o - 2> /dev/null | grep -q "%gs"
+echo "int foo(void) { char X[200]; return 3; }" | $* -S -x c -c -O0 -mcmodel=kernel -fno-pie -fstack-protector - -o - 2> /dev/null | grep -q "%gs"
 if [ "$?" -eq "0" ] ; then
 	echo y
 else

Reply to: