mips64: ensure that either n64 or n32 ABI are set

Set the ABI to n64 or n32, in that order, in case the compiler is capable
but it is configured for o32 by default.

Patch by Stefan Maksimovic.
This commit is contained in:
Petar Jovanovic 2019-11-26 11:51:28 +00:00
parent 132681dc19
commit 7a1647df5e
2 changed files with 41 additions and 0 deletions

View File

@ -47,3 +47,7 @@ Limitations
then 4.6.1 due to a bug in the toolchain.
- Older GCC may have issues with some inline assembly blocks. Get a toolchain
based on newer GCC versions, if possible.
- Systems with a mips64 cpu having only o32 libraries will misconfigure in case
no appropriate architecture flag is specified during configure time.
Be sure to set either mips32 or mips32r2 as the target architecture in that
case.

View File

@ -1946,6 +1946,43 @@ AC_MSG_RESULT([yes])
AC_MSG_RESULT([no])
])
# We enter the code block below in the following case:
# Target architecture is set to mips64, the desired abi
# was not specified and the compiler's default abi setting
# is neither n32 nor n64.
# Probe for and set the abi to either n64 or n32, in that order,
# which is required for a mips64 build of valgrind.
if test "$ARCH_MAX" = "mips64" -a "x$VGCONF_ABI" = "x"; then
safe_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -mabi=64 -Werror"
AC_MSG_CHECKING([if gcc is n64 capable])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
return 0;
]])], [
VGCONF_ABI=64
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS
if test "x$VGCONF_ABI" = "x"; then
safe_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -mabi=n32 -Werror"
AC_MSG_CHECKING([if gcc is n32 capable])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
return 0;
]])], [
VGCONF_ABI=N32
FLAG_M64="-march=mips64r2 -mabi=n32"
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS
fi
fi
AM_CONDITIONAL([VGCONF_HAVE_ABI],
[test x$VGCONF_ABI != x])
AC_SUBST(VGCONF_ABI)