From patchwork Sat Dec 20 15:01:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Peter_K=C3=BCmmel?= X-Patchwork-Id: 423082 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id B00871400D5 for ; Sun, 21 Dec 2014 02:01:25 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id E6D3C91D00; Sat, 20 Dec 2014 15:01:24 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hClcWPIVqgdt; Sat, 20 Dec 2014 15:01:23 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id BED9891D70; Sat, 20 Dec 2014 15:01:23 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 3D5BF1BFA4B for ; Sat, 20 Dec 2014 15:01:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 385F491D00 for ; Sat, 20 Dec 2014 15:01:22 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gCenJDB3wdXE for ; Sat, 20 Dec 2014 15:01:21 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by whitealder.osuosl.org (Postfix) with ESMTPS id A76F791D0A for ; Sat, 20 Dec 2014 15:01:20 +0000 (UTC) Received: from xmint.fritz.box ([79.242.43.13]) by mail.gmx.com (mrgmx001) with ESMTPSA (Nemesis) id 0MEoGY-1Y9XJn1mxu-00G2aW; Sat, 20 Dec 2014 16:01:17 +0100 From: =?UTF-8?q?Peter=20K=C3=BCmmel?= To: buildroot@buildroot.org Date: Sat, 20 Dec 2014 16:01:09 +0100 Message-Id: <1419087669-2365-1-git-send-email-syntheticpp@gmx.net> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Provags-ID: V03:K0:xQ/10QoECB10KQEqiNOC6zzcuYDqLxL8aTA7sb3ICUa4jE6RdpO oo/ycpzzDmnZR8icoCmeOKSQVWa3Sg7iIUbOVeoDgr5Nc4Xz29tGtdfRxGTD5HhUCTS6lRS O8mB5hmU8K0ZtldKDT1DnIwdVGpuAX/iRSFeZdmJ1WOcpt5zzuP1iqpZwnM6ulIdu7iCqOf r40+UeL7YgIy8Q/VGb2LA== X-UI-Out-Filterresults: notjunk:1; Subject: [Buildroot] [PATCH 1/1] binutils, gcc: add support for GCC flag -flto X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Signed-off-by: Peter Kümmel --- package/binutils/Config.in | 5 +++++ package/binutils/binutils.mk | 8 ++++++++ package/gcc/Config.in.host | 6 ++++++ package/gcc/gcc.mk | 4 ++++ toolchain/toolchain-external/toolchain-external.mk | 3 +++ 5 files changed, 26 insertions(+) diff --git a/package/binutils/Config.in b/package/binutils/Config.in index 64d0a09..a5d2cc9 100644 --- a/package/binutils/Config.in +++ b/package/binutils/Config.in @@ -19,6 +19,11 @@ config BR2_PACKAGE_BINUTILS_TARGET http://www.gnu.org/software/binutils/ +config BR2_PACKAGE_BINUTILS_ENABLE_LTO + bool "Enable support for link-time-optimization" + help + Enable lto support. Allows passing a lto plugin to ar and ranlib. + endif comment "binutils needs a toolchain w/ wchar" diff --git a/package/binutils/binutils.mk b/package/binutils/binutils.mk index 9a9bb94..3916cad 100644 --- a/package/binutils/binutils.mk +++ b/package/binutils/binutils.mk @@ -96,5 +96,13 @@ BINUTILS_PRE_PATCH_HOOKS += BINUTILS_XTENSA_PRE_PATCH HOST_BINUTILS_PRE_PATCH_HOOKS += BINUTILS_XTENSA_PRE_PATCH endif +ifeq ($(BR2_PACKAGE_BINUTILS_ENABLE_LTO),y) +BINUTILS_CONF_OPTS += --enable-plugins --enable-lto +endif + +ifeq ($(BR2_GCC_ENABLE_LTO),y) +HOST_BINUTILS_CONF_OPTS += --enable-plugins --enable-lto +endif + $(eval $(autotools-package)) $(eval $(host-autotools-package)) diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host index 0750807..4e0c2ae 100644 --- a/package/gcc/Config.in.host +++ b/package/gcc/Config.in.host @@ -128,6 +128,12 @@ config BR2_GCC_ENABLE_TLS Enable the compiler to generate code for accessing thread local storage variables +config BR2_GCC_ENABLE_LTO + bool "Enable compiler link-time-optimization support" + help + Since version 4.5 GCC supports lto. Build GCC with lto support enabled. + Needed when -flto should be used. + config BR2_GCC_ENABLE_OPENMP bool "Enable compiler OpenMP support" depends on !BR2_PTHREADS_NONE && !BR2_avr32 && !BR2_arc && !BR2_microblaze diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk index cdd71aa..8eaa91d 100644 --- a/package/gcc/gcc.mk +++ b/package/gcc/gcc.mk @@ -127,6 +127,10 @@ else HOST_GCC_COMMON_CONF_OPTS += --disable-tls endif +ifeq ($(BR2_GCC_ENABLE_LTO),y) +HOST_GCC_COMMON_CONF_OPTS += --enable-plugins --enable-lto +endif + ifeq ($(BR2_GCC_ENABLE_LIBMUDFLAP),y) HOST_GCC_COMMON_CONF_OPTS += --enable-libmudflap else diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk index b07b16c..8baf561 100644 --- a/toolchain/toolchain-external/toolchain-external.mk +++ b/toolchain/toolchain-external/toolchain-external.mk @@ -643,6 +643,9 @@ define TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER for i in $(TOOLCHAIN_EXTERNAL_CROSS)*; do \ base=$${i##*/}; \ case "$$base" in \ + *-ar|*-ranlib|*-nm) \ + ln -sf $$(echo $$i | sed 's%^$(HOST_DIR)%../..%') .; \ + ;; \ *cc|*cc-*|*++|*++-*|*cpp) \ ln -sf ext-toolchain-wrapper $$base; \ ;; \