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

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Fri Aug 29 17:02:30 UTC 2014


Dear Alexey Brodkin,

On Thu, 28 Aug 2014 16:59:18 +0400, Alexey Brodkin wrote:

> @@ -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))

No. Remember that the namespace of variables is global in Buildroot. A
given package is clearly *not* allowed to change global variables such
as TARGET_CFLAGS and TARGET_CXXFLAGS. If you want to remove -Os just
for gcc, you should do:

GCC_TARGET_CFLAGS = $(TARGET_CFLAGS)

ifeq (powerpc ... your condition ...)
GCC_TARGET_CFLAGS = $(filter-out -Os,$(GCC_TARGET_CFLAGS))
endif

HOST_GCC_COMMON_CONF_ENV += CFLAGS_FOR_TARGET="$(GCC_TARGET_CFLAGS)"

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com



More information about the buildroot mailing list