From: Petar Jovanovic Date: Tue, 26 Nov 2019 11:51:28 +0000 (+0000) Subject: mips64: ensure that either n64 or n32 ABI are set X-Git-Tag: VALGRIND_3_16_0~199 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a1647df5e5cc1b065eb69e9960b785d7173c642;p=thirdparty%2Fvalgrind.git 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. --- diff --git a/README.mips b/README.mips index 311ab21379..0df334ae29 100644 --- a/README.mips +++ b/README.mips @@ -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. diff --git a/configure.ac b/configure.ac index 78c21f58bf..8e73d8ddb7 100755 --- a/configure.ac +++ b/configure.ac @@ -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)