toolchain: ARM: Fix option conflict with multiarch
authorBoris Krasnovskiy <borkra@gmail.com>
Thu, 21 Mar 2019 03:00:51 +0000 (23:00 -0400)
committerChristian Lamparter <chunkeey@gmail.com>
Mon, 25 Mar 2019 20:19:05 +0000 (21:19 +0100)
This problem exposed when compiling glibc, but applicable across the
board. gcc compiles runtime libraries for all supported architectures,
unless otherwise specified, and later selects applicable library based
-m[arch,cpu,*] options, thus these options should not be passed to gcc
as they break the compilation process.

Signed-off-by: Boris Krasnovskiy <borkra@gmail.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
[modified so it only touches ARM - I'm too chicken, changed authors email]

toolchain/gcc/common.mk

index 6e8767f707b7927b95a01ed66dde4da70ed71fee..6e0edfb36a21061e9d39f90e49bf0b6bfb689085 100644 (file)
@@ -170,6 +170,11 @@ ifeq ($(CONFIG_arm),y)
                --with-fpu=$(word 2, $(subst +, ",$(CONFIG_CPU_TYPE))) \
                --with-float=hard
   endif
+
+  # Do not let TARGET_CFLAGS get poisoned by extra CPU optimization flags
+  # that do not belong here. The cpu,fpu type should be specified via
+  # --with-cpu and --with-fpu for ARM and not CFLAGS.
+  TARGET_CFLAGS:=$(filter-out -m%,$(call qstrip,$(TARGET_CFLAGS)))
 endif
 
 ifeq ($(CONFIG_TARGET_x86)$(CONFIG_USE_GLIBC)$(CONFIG_INSTALL_GCCGO),yyy)