* [PATCH] Don't build 32-bit libgomp with -march=i486 on x86-64
@ 2016-04-19 15:08 H.J. Lu
2016-04-20 14:43 ` H.J. Lu
0 siblings, 1 reply; 6+ messages in thread
From: H.J. Lu @ 2016-04-19 15:08 UTC (permalink / raw)
To: gcc-patches
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.
Tested on x86-64. OK for trunk?
H.J.
---
PR target/70454
* configure.tgt (XCFLAGS): Don't add -march=i486 to compile
32-bit target library on x86-64.
---
libgomp/configure.tgt | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/libgomp/configure.tgt b/libgomp/configure.tgt
index 77e73f0..a36acc5 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
+ # Since 64-bit arch > i486, we can use the same -march= to build
+ # both 32-bit and 64-bit target libraries.
;;
# Note that sparcv7 and sparcv8 is not included here. We need cas.
--
2.5.5
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Don't build 32-bit libgomp with -march=i486 on x86-64
2016-04-19 15:08 [PATCH] Don't build 32-bit libgomp with -march=i486 on x86-64 H.J. Lu
@ 2016-04-20 14:43 ` H.J. Lu
2016-04-20 14:53 ` Jakub Jelinek
0 siblings, 1 reply; 6+ messages in thread
From: H.J. Lu @ 2016-04-20 14:43 UTC (permalink / raw)
To: GCC Patches, Uros Bizjak
[-- Attachment #1: Type: text/plain, Size: 502 bytes --]
On Tue, Apr 19, 2016 at 8:08 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> 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.
>
> Tested on x86-64. OK for trunk?
>
> H.J.
> ---
> PR target/70454
> * configure.tgt (XCFLAGS): Don't add -march=i486 to compile
> 32-bit target library on x86-64.
Here is the updated patch. Tested on x86-64. OK for trunk?
--
H.J.
[-- Attachment #2: 0002-Don-t-build-32-bit-libgomp-with-march-i486-on-x86-64.patch --]
[-- Type: text/x-patch, Size: 1341 bytes --]
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.
---
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Don't build 32-bit libgomp with -march=i486 on x86-64
2016-04-20 14:43 ` H.J. Lu
@ 2016-04-20 14:53 ` Jakub Jelinek
2016-04-20 14:56 ` H.J. Lu
2016-04-20 15:16 ` H.J. Lu
0 siblings, 2 replies; 6+ messages in thread
From: Jakub Jelinek @ 2016-04-20 14:53 UTC (permalink / raw)
To: H.J. Lu; +Cc: GCC Patches, Uros Bizjak
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.
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Don't build 32-bit libgomp with -march=i486 on x86-64
2016-04-20 14:53 ` Jakub Jelinek
@ 2016-04-20 14:56 ` H.J. Lu
2016-04-25 10:03 ` Jakub Jelinek
2016-04-20 15:16 ` H.J. Lu
1 sibling, 1 reply; 6+ messages in thread
From: H.J. Lu @ 2016-04-20 14:56 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: GCC Patches, Uros Bizjak
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
;;
--
H.J.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Don't build 32-bit libgomp with -march=i486 on x86-64
2016-04-20 14:56 ` H.J. Lu
@ 2016-04-25 10:03 ` Jakub Jelinek
0 siblings, 0 replies; 6+ messages in thread
From: Jakub Jelinek @ 2016-04-25 10:03 UTC (permalink / raw)
To: H.J. Lu; +Cc: GCC Patches, Uros Bizjak
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Don't build 32-bit libgomp with -march=i486 on x86-64
2016-04-20 14:53 ` Jakub Jelinek
2016-04-20 14:56 ` H.J. Lu
@ 2016-04-20 15:16 ` H.J. Lu
1 sibling, 0 replies; 6+ messages in thread
From: H.J. Lu @ 2016-04-20 15:16 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: GCC Patches, Uros Bizjak
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.
> 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.
>
That is a better approach. However it isn't how it is handled for
Linux/x86. Should we rewrite the whole -march= stuff for 32-bit
Linux/x86 run-time, independent of Linux/x86 or Linux/x86-64?
--
H.J.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-04-25 10:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-19 15:08 [PATCH] Don't build 32-bit libgomp with -march=i486 on x86-64 H.J. Lu
2016-04-20 14:43 ` H.J. Lu
2016-04-20 14:53 ` Jakub Jelinek
2016-04-20 14:56 ` H.J. Lu
2016-04-25 10:03 ` Jakub Jelinek
2016-04-20 15:16 ` H.J. Lu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).