From patchwork Tue May 10 11:44:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Whitcroft X-Patchwork-Id: 620573 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3r3y8V5wRZz9sXR; Tue, 10 May 2016 21:44:26 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1b065K-0004gR-Sf; Tue, 10 May 2016 11:44:18 +0000 Received: from mail-wm0-f42.google.com ([74.125.82.42]) by huckleberry.canonical.com with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.76) (envelope-from ) id 1b065C-0004fs-F2 for kernel-team@lists.ubuntu.com; Tue, 10 May 2016 11:44:10 +0000 Received: by mail-wm0-f42.google.com with SMTP id n129so174735126wmn.1 for ; Tue, 10 May 2016 04:44:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DLfEi0I0hQ6az5vLbdNmTfrJNS8njjrEVS82zfUO630=; b=gYScrA9PPvmkyMZw/AuXVlKAq1VodmMzDws3YpWWvTjyLlc4L4lN+n+2zVV7uW4R55 Eh3Y4Vm8LbUc4VjanNO6MNDaMZx6MrG1uGB3oPplf7mbSWGYrDpJVQ6lvPOHQNcOjhOV +0mSEXlJUk4uQNfwLT2abkYqR9sVAhEfFiheGfueLqEFyLjFkxrWjzA/AT2nQ+rQEFJ+ 013ezNiKROt9xND9MAfYgDsMAiuYCQZclqWkCoKVV/dnw2K/GWGMzhWorQm18vVf428D qjRexDx4LUcq76TVB1nbsi1v4CqiaQ/YZxAOHpXhGtD1+BZhhy93WZVLg9/lyQDD50nf xWQQ== X-Gm-Message-State: AOPr4FWGsAU+Was8mxZmYqdZLJH4jM+4DstsQvAmniu3HWowKD+4DYcRePPnKR3vjebx+E0K X-Received: by 10.194.240.230 with SMTP id wd6mr845821wjc.86.1462880649870; Tue, 10 May 2016 04:44:09 -0700 (PDT) Received: from localhost ([2001:470:6973:2:19bc:ef0c:e175:407e]) by smtp.gmail.com with ESMTPSA id iv1sm2066537wjb.34.2016.05.10.04.44.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 May 2016 04:44:09 -0700 (PDT) From: Andy Whitcroft To: kernel-team@lists.ubuntu.com Subject: [xenial/master-next 1/1] UBUNTU: SAUCE: (no-up) disable -pie when gcc has it enabled by default Date: Tue, 10 May 2016 12:44:04 +0100 Message-Id: <1462880644-16616-2-git-send-email-apw@canonical.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1462880644-16616-1-git-send-email-apw@canonical.com> References: <1462880644-16616-1-git-send-email-apw@canonical.com> Cc: Andy Whitcroft X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com From: Steve Beattie In Ubuntu 16.10, gcc's defaults have been set to build Position Independent Executables (PIE) on amd64 and ppc64le (gcc was configured this way for s390x in Ubuntu 16.04 LTS). This breaks the kernel build on amd64. The following patch disables pie for x86 builds (though not yet verified to work with gcc configured to build PIE by default i386 -- we're not planning to enable it for that architecture). The intent is for this patch to go upstream after expanding it to additional architectures where needed, but I wanted to ensure that we could build 16.10 kernels first. I've successfully built kernels and booted them with this patch applied using the 16.10 compiler. Patch is against yakkety.git, but also applies with minor movement (no fuzz) against current linus.git. Signed-off-by: Steve Beattie [apw@canonical.com: shifted up so works in arch/ --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index dda982c..f96b174 100644 --- a/Makefile +++ b/Makefile @@ -608,6 +608,12 @@ endif # $(dot-config) # Defaults to vmlinux, but the arch makefile usually adds further targets all: vmlinux +# 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) +KBUILD_CPPFLAGS += $(call cc-option, -fno-pie) + # The arch Makefile can set ARCH_{CPP,A,C}FLAGS to override the default # values of the respective KBUILD_* variables ARCH_CPPFLAGS :=