[Buildroot] [PATCH v2] gcc: explicitly use C{XX}FLAGS_FOR_TARGET instead of --enable-target-optspace

Alexey Brodkin Alexey.Brodkin at synopsys.com
Thu Aug 28 12:59:18 UTC 2014

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
 * Particular CPU requires specific instructions for HW support
 * Deep optimizations

Signed-off-by: Alexey Brodkin <abrodkin at synopsys.com>

Cc: Anton Kolesov <akolesov at synopsys.com>
Cc: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
Cc: Peter Korsgaard <peter at korsgaard.com>
Cc: Gustavo Zacarias <gustavo at zacarias.com.ar>
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
-HOST_GCC_COMMON_CONF_OPT += --enable-target-optspace
+# Propagate options used for target software building to GCC target libs
 # gcc 4.6.x quadmath requires wchar
 HOST_GCC_COMMON_CONF_OPT += --disable-libquadmath

More information about the buildroot mailing list