]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/sh/Makefile
sh: Fix FPU tuning on toolchains with mismatched multilib targets.
[linux-2.6-omap-h63xx.git] / arch / sh / Makefile
index 1f409bf81809b12af3300b0b3c4f49b2f94d2a34..3b2d8e2322403f1d79701fb947a71c84023b2b1c 100644 (file)
@@ -38,6 +38,22 @@ cflags-$(CONFIG_CPU_SH4A)            += $(call cc-option,-m4a,) \
                                           $(call cc-option,-m4a-nofpu,)
 cflags-$(CONFIG_CPU_SH5)               := $(call cc-option,-m5-32media-nofpu,)
 
+ifeq ($(cflags-y),)
+#
+# In the case where we are stuck with a compiler that has been uselessly
+# restricted to a particular ISA, a favourite default of newer GCCs when
+# extensive multilib targets are not provided, ensure we get the best fit
+# regarding FP generation. This is necessary to avoid references to FP
+# variants in libgcc where integer variants exist, which otherwise result
+# in link errors. This is intentionally stupid (albeit many orders of
+# magnitude less than GCC's default behaviour), as anything with a large
+# number of multilib targets better have been built correctly for
+# the target in mind.
+#
+cflags-y       += $(shell $(CC) $(KBUILD_CFLAGS) -print-multi-lib | \
+                    grep nofpu | sed q | sed -e 's/^/-/;s/;.*$$//')
+endif
+
 cflags-$(CONFIG_CPU_BIG_ENDIAN)                += -mb
 cflags-$(CONFIG_CPU_LITTLE_ENDIAN)     += -ml