Expand external toolchain wrapper to custom flags
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sat, 31 Dec 2011 11:09:33 +0000 (12:09 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Thu, 1 Mar 2012 19:26:37 +0000 (20:26 +0100)
The BR2_TARGET_OPTIMIZATION flags were not used by the external
toolchain wrapper, which broke the multilib selection logic of
multilib external toolchains. It also simplifies the compilation of
external programs since all flags are properly passed automatically by
the toolchain wrapper.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
toolchain/toolchain-external/ext-tool.mk
toolchain/toolchain-external/ext-toolchain-wrapper.c

index eb8ed4f6b5d55f219eaa620c3a78feabe54fe9d1..dde6f22833d71a1e527651f9abee262dd01c5a32 100644 (file)
@@ -150,6 +150,14 @@ TOOLCHAIN_EXTERNAL_CFLAGS += -mabi=$(CC_TARGET_ABI_)
 TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_ABI='"$(CC_TARGET_ABI_)"'
 endif
 
+ifneq ($(BR2_TARGET_OPTIMIZATION),)
+TOOLCHAIN_EXTERNAL_CFLAGS += $(call qstrip,$(BR2_TARGET_OPTIMIZATION))
+# We create a list like '"-mfoo", "-mbar", "-mbarfoo"' so that each
+# flag is a separate argument when used in execv() by the external
+# toolchain wrapper.
+TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_ADDITIONAL_CFLAGS='$(foreach f,$(call qstrip,$(BR2_TARGET_OPTIMIZATION)),"$(f)",)'
+endif
+
 ifeq ($(BR2_SOFT_FLOAT),y)
 TOOLCHAIN_EXTERNAL_CFLAGS += -msoft-float
 TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_SOFTFLOAT=1
index cc404f3e947796cd06b711c626387aa640721a22..719f13bd164ecea73d5fd83639023ba0264f3ddf 100644 (file)
@@ -40,6 +40,9 @@ static char *predef_args[] = {
 #ifdef BR_VFPFLOAT
        "-mfpu=vfp",
 #endif /* BR_VFPFLOAT */
+#ifdef BR_ADDITIONAL_CFLAGS
+       BR_ADDITIONAL_CFLAGS
+#endif
 };
 
 static const char *get_basename(const char *name)