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 <phcoder@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Vladimir Serbinenko 2024-09-03 20:58:49 +03:00 committed by Daniel Kiper
parent f0710d2d8f
commit 648f2d16c0

View File

@ -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 if test "x$grub_cv_cc_mflush_func" = xyes; then
TARGET_CFLAGS="$TARGET_CFLAGS -mflush-func=grub_red_herring" TARGET_CFLAGS="$TARGET_CFLAGS -mflush-func=grub_red_herring"
fi 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 fi