[PATCH, MPX runtime 1/2] Integrate MPX runtime library

Joseph Myers joseph@codesourcery.com
Fri Nov 21 23:49:00 GMT 2014


On Fri, 21 Nov 2014, Ilya Enkovich wrote:

> +# Disable libmpx on unsupported systems.
> +if test -d ${srcdir}/libmpx; then
> +    if test x$enable_libmpx = x; then
> +       AC_MSG_CHECKING([for libmpx support])
> +       if (srcdir=${srcdir}/libmpx; \
> +               . ${srcdir}/configure.tgt; \
> +               test "$LIBMPX_SUPPORTED" != "yes")
> +       then
> +           AC_MSG_RESULT([no])
> +           noconfigdirs="$noconfigdirs target-libmpx"
> +       else
> +           AC_MSG_RESULT([yes])
> +       fi
> +    fi
> +fi

Using this at toplevel you can only enable or disable for all multilibs - 
this code runs just once.  But:

> diff --git a/libmpx/configure.tgt b/libmpx/configure.tgt

> +LIBMPX_SUPPORTED=no
> +case "${target}" in
> +  x86_64-*-linux* | i?86-*-linux*)
> +	# X32 doesn't support MPX.
> +	echo "int i[sizeof (void *) == 4 ? 1 : -1] = { __x86_64__ };" > conftestx.c
> +	if ${CC} ${CFLAGS} -c -o conftestx.o conftestx.c > /dev/null 2>&1; then
> +		LIBMPX_SUPPORTED=no
> +	else
> +		LIBMPX_SUPPORTED=yes
> +	fi
> +	;;

Here you are testing something per-multilib.  Furthermore, using CC and 
CFLAGS here is wrong when used by toplevel configure, as at toplevel 
they'll relate to the host rather than the target.

So you need to separate the two tests of (a) might MPX be supported for 
some multilib on the target (usable at toplevel, not using CC or CFLAGS) 
and (b) is it supported for the present multilib.  Thus the libmpx 
directory will need configuring for all multilibs for supported targets.  
Then, if the particular multilib doesn't support it (i.e. is x32), you'll 
need to arrange for the directory not to build or install anything - much 
like the libquadmath directory gets configured in some cases where it 
doesn't build anything.

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Gcc-patches mailing list