From: Vladimir Serbinenko Date: Tue, 3 Sep 2024 17:58:49 +0000 (+0300) Subject: configure: Add -mno-gpopt option for mips and mipsel targets X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=648f2d16c0486465ead0186ed9a1187c559d72dd;p=thirdparty%2Fgrub.git configure: Add -mno-gpopt option for mips and mipsel targets Without it compiler generates GPREL16 references which do not work with our memory layout. Signed-off-by: Vladimir Serbinenko Reviewed-by: Daniel Kiper --- diff --git a/configure.ac b/configure.ac index fe5493246..458b8382b 100644 --- a/configure.ac +++ b/configure.ac @@ -802,6 +802,17 @@ if test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ; then if test "x$grub_cv_cc_mflush_func" = xyes; then TARGET_CFLAGS="$TARGET_CFLAGS -mflush-func=grub_red_herring" fi + + AC_CACHE_CHECK([whether -mno-gpopt works], [grub_cv_cc_mno_gpopt], [ + CFLAGS="$TARGET_CFLAGS -mno-gpopt -Werror" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], + [grub_cv_cc_mno_gpopt=yes], + [grub_cv_cc_mno_gpopt=no]) + ]) + + if test "x$grub_cv_cc_mno_gpopt" = xyes; then + TARGET_CFLAGS="$TARGET_CFLAGS -mno-gpopt" + fi fi