From patchwork Thu Aug 28 12:59:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Brodkin X-Patchwork-Id: 383827 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id 05F5B140090 for ; Thu, 28 Aug 2014 22:59:34 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 1F6F1A0826; Thu, 28 Aug 2014 12:59:32 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id y_5Zq4P_Xq4t; Thu, 28 Aug 2014 12:59:31 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id B0E2EA02F3; Thu, 28 Aug 2014 12:59:30 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 5E28B1BFA34 for ; Thu, 28 Aug 2014 12:59:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 5A54589E58 for ; Thu, 28 Aug 2014 12:59:29 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4epemlGAyYQh for ; Thu, 28 Aug 2014 12:59:27 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from smtprelay.synopsys.com (smtprelay2.synopsys.com [198.182.60.111]) by hemlock.osuosl.org (Postfix) with ESMTPS id 4C65689A64 for ; Thu, 28 Aug 2014 12:59:27 +0000 (UTC) Received: from us02secmta2.synopsys.com (us02secmta2.synopsys.com [10.12.235.98]) by smtprelay.synopsys.com (Postfix) with ESMTP id 714CF10C0F14; Thu, 28 Aug 2014 05:59:24 -0700 (PDT) Received: from us02secmta2.internal.synopsys.com (us02secmta2.internal.synopsys.com [127.0.0.1]) by us02secmta2.internal.synopsys.com (Service) with ESMTP id 48D7D55F13; Thu, 28 Aug 2014 05:59:24 -0700 (PDT) Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by us02secmta2.internal.synopsys.com (Service) with ESMTP id 1F90B55F02; Thu, 28 Aug 2014 05:59:24 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 10C90DF3; Thu, 28 Aug 2014 05:59:24 -0700 (PDT) Received: from abrodkin-8560l.internal.synopsys.com (abrodkin-8560l.internal.synopsys.com [10.121.8.98]) by mailhost.synopsys.com (Postfix) with ESMTP id 18BC1DD0; Thu, 28 Aug 2014 05:59:21 -0700 (PDT) From: Alexey Brodkin To: buildroot@buildroot.org Date: Thu, 28 Aug 2014 16:59:18 +0400 Message-Id: <1409230758-14548-1-git-send-email-abrodkin@synopsys.com> X-Mailer: git-send-email 1.9.3 Cc: Thomas Petazzoni , Alexey Brodkin Subject: [Buildroot] [PATCH v2] gcc: explicitly use C{XX}FLAGS_FOR_TARGET instead of --enable-target-optspace X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net The gcc.mk file is passing --enable-target-optspace to gcc configure script, to ask for space-optimized (-Os) target libraries. However, passing this option has the effect of overriding any custom CFLAGS_FOR_TARGET or CXXFLAGS_FOR_TARGET values that may be passed. These are some situations when it is required to pass custom flags on buildong of libgcc: * Default flags "-g -Os" lead to build isses as with PowerPC on gcc 4.5 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43810) * Particular CPU requires specific instructions for HW support * Deep optimizations Signed-off-by: Alexey Brodkin Cc: Anton Kolesov Cc: Thomas Petazzoni Cc: Peter Korsgaard Cc: Gustavo Zacarias --- Compared to v1: 1) All changes are implemented in common part so applicable to all stages. 2) Comments doesn't contain separators that confuse Patchwork 3) Use TARGET_C{XX}FLAGS instead of pre-defined -O2 or -Os --- package/gcc/gcc.mk | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk index b344a14..95c15e2 100644 --- a/package/gcc/gcc.mk +++ b/package/gcc/gcc.mk @@ -111,12 +111,15 @@ HOST_GCC_COMMON_CONF_ENV = \ # Workaround until it's fixed in 4.5.4 or later ifeq ($(ARCH),powerpc) ifeq ($(findstring x4.5.,x$(GCC_VERSION)),x4.5.) -HOST_GCC_COMMON_CONF_OPT += --disable-target-optspace +TARGET_CFLAGS := $(subst -Os,,$(TARGET_CFLAGS)) +TARGET_CXXFLAGS := $(subst -Os,,$(TARGET_CXXFLAGS)) endif -else -HOST_GCC_COMMON_CONF_OPT += --enable-target-optspace endif +# Propagate options used for target software building to GCC target libs +HOST_GCC_COMMON_CONF_ENV += CFLAGS_FOR_TARGET="$(TARGET_CFLAGS)" +HOST_GCC_COMMON_CONF_ENV += CXXFLAGS_FOR_TARGET="$(TARGET_CXXFLAGS)" + # gcc 4.6.x quadmath requires wchar ifneq ($(BR2_TOOLCHAIN_BUILDROOT_WCHAR),y) HOST_GCC_COMMON_CONF_OPT += --disable-libquadmath