This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Don't build 32-bit libgomp with -march=i486 on x86-64


On Wed, Apr 20, 2016 at 07:56:16AM -0700, H.J. Lu wrote:
> On Wed, Apr 20, 2016 at 7:53 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> > 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" <hjl.tools@gmail.com>
> >> 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.
> 
> libgomp/configure.tgt has
> 
>    # Note that bare i386 is not included here.  We need cmpxchg.
>     i[456]86-*-linux*)
> config_path="linux/x86 linux posix"
> case " ${CC} ${CFLAGS} " in
>  *" -m64 "*|*" -mx32 "*)
>    ;;
>  *)
>    if test -z "$with_arch"; then
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> --with-arch overrides everything.  I just follow the same practice.
> 
>      XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
>    fi
> esac
> ;;

Yes, and even the -m32 practice is not good.
We should do a preprocessor and/or compile time test in each of these cases
to find out if the default needs to be tweaked and tweak only in that case.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]