diff --git a/ChangeLog b/ChangeLog index 0c87f158c..fb67de1d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-11-23 Vladimir Serbinenko + + Don't add -mflush-func if it's not supported by compiler. + 2013-11-23 Vladimir Serbinenko Move common BIOS/coreboot memory map declarations to diff --git a/conf/Makefile.common b/conf/Makefile.common index 835aeeac5..9f0d1d6d5 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -10,9 +10,6 @@ if COND_mips_loongson CFLAGS_PLATFORM += -mexplicit-relocs CPPFLAGS_PLATFORM = -DUSE_ASCII_FALLBACK endif -if COND_mips - CFLAGS_PLATFORM += -mflush-func=grub_red_herring -endif if COND_sparc64_ieee1275 CFLAGS_PLATFORM += -mno-app-regs LDFLAGS_PLATFORM = -Wl,-melf64_sparc -mno-relax diff --git a/configure.ac b/configure.ac index cb12f2401..8619a676e 100644 --- a/configure.ac +++ b/configure.ac @@ -520,6 +520,21 @@ if test "x$grub_cv_cc_target_clang" = xno && test "x$target_cpu" = xi386 && test TARGET_CFLAGS="$TARGET_CFLAGS -mrtd -mregparm=3" fi +# on mips redirect cache flushing function to non-existant one. +if test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ; then + AC_CACHE_CHECK([whether -mflush-func=grub_red_herring works], [grub_cv_cc_mflush_func], [ + CFLAGS="$TARGET_CFLAGS -mflush-func=grub_red_herring -Werror" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], + [grub_cv_cc_mflush_func=yes], + [grub_cv_cc_mflush_func=no]) + ]) + + if test "x$grub_cv_cc_mflush_func" = xyes; then + TARGET_CFLAGS="$TARGET_CFLAGS -mflush-func=grub_red_herring" + fi +fi + + # Force no alignment to save space on i386. if test "x$target_cpu" = xi386; then AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [