From patchwork Wed Dec 27 14:50:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Stefan_Fr=C3=B6berg?= X-Patchwork-Id: 853188 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3z6G6x20QKz9s7h for ; Thu, 28 Dec 2017 01:52:56 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 2A9212A12A; Wed, 27 Dec 2017 14:52:55 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id I3lT2lLVQah9; Wed, 27 Dec 2017 14:52:54 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 0D13F2D4BA; Wed, 27 Dec 2017 14:52:54 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 0F4131C02F3 for ; Wed, 27 Dec 2017 14:52:53 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 0AFA62D4BA for ; Wed, 27 Dec 2017 14:52:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id geJGQYjz0Fvl for ; Wed, 27 Dec 2017 14:52:52 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.petroprogram.com (mail.petroprogram.com [194.89.34.74]) by silver.osuosl.org (Postfix) with ESMTPS id 3C51D2A12A for ; Wed, 27 Dec 2017 14:52:52 +0000 (UTC) Received: from localhost.localdomain (85-76-111-43-nat.elisa-mobile.fi [85.76.111.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: stefan.froberg@petroprogram.com) by mail.petroprogram.com (Postfix) with ESMTPSA id BD2B142F21; Wed, 27 Dec 2017 17:56:20 +0200 (EET) From: =?utf-8?q?Stefan_Fr=C3=B6berg?= To: buildroot@buildroot.org Date: Wed, 27 Dec 2017 16:50:03 +0200 Message-Id: <20171227145003.1669-1-stefan.froberg@petroprogram.com> X-Mailer: git-send-email 2.13.6 MIME-Version: 1.0 Subject: [Buildroot] [PATCH 1/1] gcc: Add support for --enable-default-pie configure option. X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Stefan_Fr=C3=B6berg?= Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" With this option GCC will make PIE binaries by default. To override this default behaviour, use -no-pie https://gcc.gnu.org/onlinedocs/gcc-6.2.0/gcc/Link-Options.html Signed-off-by: Stefan Fröberg --- package/gcc/Config.in.host | 10 ++++++++++ package/gcc/gcc.mk | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host index 70cce0a5c5..bf646fa07b 100644 --- a/package/gcc/Config.in.host +++ b/package/gcc/Config.in.host @@ -152,3 +152,13 @@ config BR2_GCC_ENABLE_GRAPHITE comment "graphite support needs gcc >= 5.x" depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_5 + +config BR2_GCC_ENABLE_DEFAULT_PIE + bool "Enable default PIE support" + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_6 + help + This option enables the GCC to make PIE + binaries by default. + +comment "default PIE support needs gcc >= 6.x" + depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_6 diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk index 27fc1e987c..0910fb3932 100644 --- a/package/gcc/gcc.mk +++ b/package/gcc/gcc.mk @@ -183,6 +183,10 @@ else HOST_GCC_COMMON_CONF_OPTS += --without-isl --without-cloog endif +ifeq ($(BR2_GCC_ENABLE_DEFAULT_PIE),y) +HOST_GCC_COMMON_CONF_OPTS += --enable-default-pie +endif + ifeq ($(BR2_arc)$(BR2_or1k),y) HOST_GCC_COMMON_DEPENDENCIES += host-flex host-bison endif