Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753234AbcKOQIQ (ORCPT ); Tue, 15 Nov 2016 11:08:16 -0500 Received: from mx2.suse.de ([195.135.220.15]:34497 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750776AbcKOQIN (ORCPT ); Tue, 15 Nov 2016 11:08:13 -0500 Date: Tue, 15 Nov 2016 17:08:09 +0100 From: Michal Marek To: Borislav Petkov Cc: Sebastian Andrzej Siewior , linux-kbuild@vger.kernel.org, Ben Hutchings , x86-ml , lkml , +@pd.tnic Subject: Re: [PATCH -v1.1] kbuild: Steal gcc's pie from the very beginning Message-ID: <20161115160809.GA18830@sepie.suse.cz> References: <20161114185130.30641-1-bp@alien8.de> <20161114201457.qsevfvn465otwfvz@linutronix.de> <20161114204529.sqn6z2bockmhxpfz@pd.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161114204529.sqn6z2bockmhxpfz@pd.tnic> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1428 Lines: 36 On Mon, Nov 14, 2016 at 09:45:29PM +0100, Borislav Petkov wrote: > From: Borislav Petkov > Date: Mon, 14 Nov 2016 19:41:31 +0100 > Subject: [PATCH] kbuild: Steal gcc's pie from the very beginning > > 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 > Cc: stable@vger.kernel.org > Cc: Ben Hutchings > Cc: Michal Marek > Cc: Sebastian Andrzej Siewior Thanks, applied to kbuild.git#rc-fixes. Michal