]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
kbuild: Steal gcc's pie from the very beginning
authorBorislav Petkov <bp@suse.de>
Mon, 14 Nov 2016 18:41:31 +0000 (19:41 +0100)
committerLuis Henriques <luis.henriques@canonical.com>
Tue, 6 Dec 2016 16:53:54 +0000 (16:53 +0000)
commit288780856c2f0227f12d5a5eb6a6e91d4279ddba
tree21c12438e95ec580cb52f146bd59278470daffe8
parentc2546e5e540712f3e3bdf63290f5e67bc72cc7e0
kbuild: Steal gcc's pie from the very beginning

BugLink: http://bugs.launchpad.net/bugs/1645453
commit c6a385539175ebc603da53aafb7753d39089f32e upstream.

So Sebastian turned off the PIE for kernel builds but that was too late
- Kbuild.include already uses KBUILD_CFLAGS and trying to disable gcc
options with, say cc-disable-warning, fails:

  gcc -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs
  ...
  -Wno-sign-compare -fno-asynchronous-unwind-tables -Wframe-address -c -x c /dev/null -o .31392.tmp
  /dev/null:1:0: error: code model kernel does not support PIC mode

because that returns an error and we can't disable the warning. For
example in this case:

KBUILD_CFLAGS   += $(call cc-disable-warning,frame-address,)

which leads to gcc issuing all those warnings again.

So let's turn off PIE/PIC at the earliest possible moment, when we
declare KBUILD_CFLAGS so that cc-disable-warning picks it up too.

Also, we need the $(call cc-option ...) because -fno-PIE is supported
since gcc v3.4 and our lowest supported gcc version is 3.2 right now.

Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Michal Marek <mmarek@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Makefile