diff --git a/arch/sh/Makefile b/arch/sh/Makefile index 1f409bf81809..3b2d8e232240 100644 --- a/arch/sh/Makefile +++ b/arch/sh/Makefile @@ -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 diff --git a/arch/sh/kernel/sh_ksyms_32.c b/arch/sh/kernel/sh_ksyms_32.c index d366a7443720..d998f4c795be 100644 --- a/arch/sh/kernel/sh_ksyms_32.c +++ b/arch/sh/kernel/sh_ksyms_32.c @@ -50,7 +50,10 @@ EXPORT_SYMBOL(__udelay); EXPORT_SYMBOL(__ndelay); EXPORT_SYMBOL(__const_udelay); -#define DECLARE_EXPORT(name) extern void name(void);EXPORT_SYMBOL(name) +#define DECLARE_EXPORT(name) \ + extern void name(void);EXPORT_SYMBOL(name) +#define MAYBE_DECLARE_EXPORT(name) \ + extern void name(void) __weak;EXPORT_SYMBOL(name) /* These symbols are generated by the compiler itself */ DECLARE_EXPORT(__udivsi3); @@ -109,10 +112,8 @@ DECLARE_EXPORT(__movmemSI12_i4); * compiler which include backported patches. */ DECLARE_EXPORT(__udiv_qrnnd_16); -#if !defined(CONFIG_CPU_SH2) -DECLARE_EXPORT(__sdivsi3_i4i); -DECLARE_EXPORT(__udivsi3_i4i); -#endif +MAYBE_DECLARE_EXPORT(__sdivsi3_i4i); +MAYBE_DECLARE_EXPORT(__udivsi3_i4i); #endif #else /* GCC 3.x */ DECLARE_EXPORT(__movstr_i4_even);