On Wed, Apr 20, 2016 at 07:43:27AM -0700, H.J. Lu wrote:
> From 12c6ddcf67593ed7137764ca74043f1a9c2d8fda Mon Sep 17 00:00:00 2001
> From: "H.J. Lu" <[email protected]>
> Date: Wed, 30 Mar 2016 05:56:08 -0700
> Subject: [PATCH 2/3] Don't build 32-bit libgomp with -march=i486 on x86-64
>
> Gcc uses the same -march= for both -m32 and -m64 on x86-64 unless
> --with-arch-32= is used. There is no need for -march=i486 to compile
> 32-bit libgomp on x86-64.
>
> PR target/70454
> * configure.tgt (XCFLAGS): Don't add -march=i486 to compile
> 32-bit target library on x86-64.
That is wrong. It could be --with-arch-32=i386 build.
If you really want to find out the ISA reliably, just run ${CC} ${CFLAGS} -E -dD
-xc /dev/null and get through all the cases, or try to compile a testcase
with some __atomic* builtin in it and see if it results in a call or not.
> ---
> libgomp/configure.tgt | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/libgomp/configure.tgt b/libgomp/configure.tgt
> index 77e73f0..c290080 100644
> --- a/libgomp/configure.tgt
> +++ b/libgomp/configure.tgt
> @@ -79,16 +79,10 @@ if test x$enable_linux_futex = xyes; then
> esac
> ;;
>
> - # Similar jiggery-pokery for x86_64 multilibs, except here we
> - # can't rely on the --with-arch configure option, since that
> - # applies to the 64-bit side.
> x86_64-*-linux*)
> config_path="linux/x86 linux posix"
> - case " ${CC} ${CFLAGS} " in
> - *" -m32 "*)
> - XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic"
> - ;;
> - esac
> + # x86_64 compiler passes -march=x86_64 by default when building
> + # 32bit target libraries.
> ;;
>
> # Note that sparcv7 and sparcv8 is not included here. We need cas.
> --
> 2.5.5
>
Jakub