summaryrefslogtreecommitdiffstats
path: root/arch/sh/Makefile
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2008-11-26 04:21:36 +0900
committerPaul Mundt <lethal@linux-sh.org>2008-12-22 18:43:49 +0900
commit5dd614761f05f56b93c94541aa92e6449920516c (patch)
tree2cd59165b427209ad31c85cf6e091bc3a69438a5 /arch/sh/Makefile
parent624c6a6750c502981d92de4579647fe2549451dd (diff)
downloadlinux-stable-5dd614761f05f56b93c94541aa92e6449920516c.tar.gz
linux-stable-5dd614761f05f56b93c94541aa92e6449920516c.tar.bz2
linux-stable-5dd614761f05f56b93c94541aa92e6449920516c.zip
sh: Re-add support for best fit ISA tuning if none is available.
This was removed in the libgcc integration, but there are still some compilers that need this. We also relax the rules on the ISA tuning in the cases where there are no matches for the CPU tuning and adopt the -any default, which matches the intent of the isa-y target list. This compensates for mismatches where binutils supports a wide array of targets whilst the compiler is much more restricted. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/Makefile')
-rw-r--r--arch/sh/Makefile25
1 files changed, 20 insertions, 5 deletions
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index fac1567b2afb..ad0096151781 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -35,11 +35,21 @@ cflags-$(CONFIG_CPU_SH4A) += $(call cc-option,-m4a,) \
cflags-$(CONFIG_CPU_SH4AL_DSP) += $(call cc-option,-m4al,)
cflags-$(CONFIG_CPU_SH5) := $(call cc-option,-m5-32media-nofpu,)
-cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mb
-cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -ml
-
-cflags-y += $(call cc-option,-mno-fdpic)
-
+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 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/;.*$$//')
+# At this point, anything goes.
+isaflags-y := $(call as-option,-Wa$(comma)-isa=any,)
+else
#
# -Wa,-isa= tuning implies -Wa,-dsp for the versions of binutils that
# support it, while -Wa,-dsp by itself limits the range of usable opcodes
@@ -52,7 +62,12 @@ isaflags-y := $(call as-option,-Wa$(comma)-isa=$(isa-y),)
isaflags-$(CONFIG_SH_DSP) := \
$(call as-option,-Wa$(comma)-isa=$(isa-y),-Wa$(comma)-dsp)
+endif
+
+cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mb
+cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -ml
+cflags-y += $(call cc-option,-mno-fdpic)
cflags-y += $(isaflags-y) -ffreestanding
cflags-$(CONFIG_MORE_COMPILE_OPTIONS) += \