From patchwork Thu Oct 27 17:09:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 9399969 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 01E5560231 for ; Thu, 27 Oct 2016 17:09:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE2AE2A299 for ; Thu, 27 Oct 2016 17:09:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D109B2A2A8; Thu, 27 Oct 2016 17:09:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 441F42A299 for ; Thu, 27 Oct 2016 17:09:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934208AbcJ0RJJ (ORCPT ); Thu, 27 Oct 2016 13:09:09 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:35569 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933194AbcJ0RJI (ORCPT ); Thu, 27 Oct 2016 13:09:08 -0400 Received: by mail-oi0-f65.google.com with SMTP id n202so5583880oig.2; Thu, 27 Oct 2016 10:09:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=SPVHiWEQ2ug77HNhXE7bw71nbkeX97IzS3WTaceB20s=; b=Wu/TwwflBWhWX3cEzN+zqQJYN/Ykz8COLX9qPAz1ZfIb+dCw6HBfnQFzHxp4X3h0B/ qP3+Yg/iXph1I3eLdZMrY0tVvLnqw/86X9+ThpPul4pEKC1duiIYl1TaftcCBAb8lWB8 mulQI7RD6AiYDLyt03DtbRwCnAIYnq0hVPvZPykF+1fXQ33bf8ZR0+Q2/kCK2rnzyu5u TTNe6c51SPDEwtLQe0qnGiOuOb3kDEhgfGzaiIZSUYmW/lgodHqoek1HMJLDAXTeakrd YwNqk3pFck7BBtvSMub6AIFeQOgbXzf/JwkYwcdT9Ae0Y+o3ztFeB0R22Y2914nXXsrj qnQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=SPVHiWEQ2ug77HNhXE7bw71nbkeX97IzS3WTaceB20s=; b=ThRakW2T51xOuHL0n+BUlhLBClqe9uo4ON4fJxqmucmUVcwBonlefpsj8r5f/6TUYY 4E6t6dNRQfPYDXcFVP0PqMo1Ej4lVRkLaxLUcVodFelS2GHQz2W3bhH6ohys81K1VHv8 ut/Jwl91EM+dpcn/AVPdZIGs94B25ztn/0hYcr141mAXWbnLTHFKmiSQg4E9yLHdfXx0 8lowJVHIwa6TFGX+Vs1m853oAhhuZkZqcH5ZAK38Jih+AJUjW52YQldrXAtR3E+kew7F rQ/mzo60z4KHvnoHUKYetjfdNYOyt+EXpz7jZjeRx6AML920a2jkOWFPPULSO5Uf74Oi XWvw== X-Gm-Message-State: ABUngvdJxgwa7wuT9KPI1h1JIQYQhwHs8X2Eq2hyVkrna8OZUa4Pfn9oQKd5YHMce6ZTF7sWAa1ZutMIqaMt0w== X-Received: by 10.107.130.16 with SMTP id e16mr7412441iod.38.1477588147305; Thu, 27 Oct 2016 10:09:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.64.101.35 with HTTP; Thu, 27 Oct 2016 10:09:06 -0700 (PDT) In-Reply-To: <20161021111600.9417-1-bigeasy@linutronix.de> References: <20161021111600.9417-1-bigeasy@linutronix.de> From: Shuah Khan Date: Thu, 27 Oct 2016 11:09:06 -0600 Message-ID: Subject: Re: [RFC PATCH] kbuild: add -fno-PIE To: Sebastian Andrzej Siewior Cc: Michal Marek , linux-kbuild@vger.kernel.org, LKML , Ben Hutchings Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Oct 21, 2016 at 5:16 AM, Sebastian Andrzej Siewior wrote: > Debian started to build the gcc with --enable-default-pie by default so the > kernel build ends before it starts properly with: > |kernel/bounds.c:1:0: error: code model kernel does not support PIC mode > > Is this okay or do we want some kind of check to see if -fno-PIE is supported? > It is mentioned in the 4.4.7 gcc manpage is it is not *that* new :) > > Signed-off-by: Sebastian Andrzej Siewior > --- > Makefile | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/Makefile b/Makefile > index bf6e44a421df..97296d66b586 100644 > --- a/Makefile > +++ b/Makefile > @@ -398,7 +398,7 @@ KBUILD_CPPFLAGS := -D__KERNEL__ > KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ > -fno-strict-aliasing -fno-common \ > -Werror-implicit-function-declaration \ > - -Wno-format-security \ > + -Wno-format-security -fno-PIE \ > -std=gnu89 > > KBUILD_AFLAGS_KERNEL := > -- > 2.9.3 > Hi, I ran into this when I upgraded to Ubuntu 16.10. Ubuntu kernel team has a patch posted for Ubuntu kernels. The patch talks about needing have this work for other architectures. I applied part of the change from the original Ubuntu patch - https://patchwork.ozlabs.org/patch/616621/ Anyway, the following worked for me on x86-64 - both 4.8.4 and 4.9 thanks, -- Shuah --- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Makefile b/Makefile index 82a36ab..0a01ad1 100644 --- a/Makefile +++ b/Makefile @@ -651,6 +651,11 @@ ifneq ($(CONFIG_FRAME_WARN),0) KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN}) endif +# force no-pie for distro compilers that enable pie by default +KBUILD_CFLAGS += $(call cc-option, -fno-pie) +KBUILD_CFLAGS += $(call cc-option, -no-pie) +KBUILD_AFLAGS += $(call cc-option, -fno-pie) + # This selects the stack protector compiler flag. Testing it is delayed # until after .config has been reprocessed, in the prepare-compiler-check # target.