From: liuhongt <hongtao.liu@intel.com>
To: gcc-patches@gcc.gnu.org
Cc: crazylht@gmail.com, hjl.tools@gmail.com, ubizjak@gmail.com
Subject: [PATCH V2 1/2] x86: Don't add crtfastmath.o for -shared
Date: Thu, 15 Dec 2022 14:21:36 +0800 [thread overview]
Message-ID: <20221215062137.3128845-1-hongtao.liu@intel.com> (raw)
In-Reply-To: <CAFULd4anr=QEb3ATQnhBYiMgEiZk_rz3ca_UOGndktAGpmxcpQ@mail.gmail.com>
Update in V2:
Split -shared change into a separate commit and add some documentation
for it.
Bootstrapped and regtested on x86_64-pc-linu-gnu{-m32,}.
Ok of trunk?
Don't add crtfastmath.o for -shared to avoid changing the MXCSR register
when loading a shared library. crtfastmath.o will be used only when
building executables.
PR target/55522
* config/i386/gnu-user-common.h (GNU_USER_TARGET_MATHFILE_SPEC):
Don't add crtfastmath.o for -shared.
* doc/invoke.texi (-shared): Add related documentation.
---
gcc/config/i386/gnu-user-common.h | 2 +-
gcc/doc/invoke.texi | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/gcc/config/i386/gnu-user-common.h b/gcc/config/i386/gnu-user-common.h
index cab9be2bfb7..9910cd64363 100644
--- a/gcc/config/i386/gnu-user-common.h
+++ b/gcc/config/i386/gnu-user-common.h
@@ -47,7 +47,7 @@ along with GCC; see the file COPYING3. If not see
/* Similar to standard GNU userspace, but adding -ffast-math support. */
#define GNU_USER_TARGET_MATHFILE_SPEC \
- "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+ "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} \
%{mpc32:crtprec32.o%s} \
%{mpc64:crtprec64.o%s} \
%{mpc80:crtprec80.o%s}"
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index cb40b38b73a..cba4f19f4f4 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -17656,7 +17656,8 @@ needs to build supplementary stub code for constructors to work. On
multi-libbed systems, @samp{gcc -shared} must select the correct support
libraries to link against. Failing to supply the correct flags may lead
to subtle defects. Supplying them in cases where they are not necessary
-is innocuous.}
+is innocuous. For x86, crtfastmath.o will not be added when
+@option{-shared} is specified. }
@item -shared-libgcc
@itemx -static-libgcc
--
2.27.0
next prev parent reply other threads:[~2022-12-15 6:23 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-14 2:18 [PATCH] [x86] x86: Don't add crtfastmath.o for -shared and add a new option -mdaz-ftz to enable FTZ and DAZ flags in MXCSR liuhongt
2022-12-14 8:08 ` Richard Biener
2022-12-14 8:16 ` Jakub Jelinek
2022-12-14 8:23 ` Richard Biener
2022-12-14 8:34 ` Liu, Hongtao
2022-12-14 8:52 ` Richard Biener
2022-12-14 9:07 ` Uros Bizjak
2022-12-15 6:21 ` liuhongt [this message]
2022-12-15 6:21 ` [PATCH V2 2/2] [x86] x86: Add " liuhongt
2022-12-15 7:39 ` Jakub Jelinek
2022-12-15 7:45 ` Hongtao Liu
2022-12-20 4:51 ` Hongtao Liu
2022-12-21 20:20 ` H.J. Lu
2022-12-21 22:35 ` Jakub Jelinek
2022-12-21 22:43 ` H.J. Lu
2022-12-21 22:46 ` Jakub Jelinek
2022-12-22 4:40 ` Hongtao Liu
2022-12-22 8:04 ` Uros Bizjak
2023-05-04 5:35 ` Hongtao Liu
2023-05-04 5:36 ` Hongtao Liu
2023-05-04 9:49 ` Richard Biener
2023-05-10 1:41 ` Hongtao Liu
2023-05-10 6:41 ` Richard Biener
2023-05-10 9:07 ` [PATCH] " liuhongt
2023-05-12 5:43 ` Hongtao Liu
2023-05-15 1:16 ` Hongtao Liu
2022-12-16 9:50 ` [PATCH V2 1/2] x86: Don't add crtfastmath.o for -shared Uros Bizjak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221215062137.3128845-1-hongtao.liu@intel.com \
--to=hongtao.liu@intel.com \
--cc=crazylht@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hjl.tools@gmail.com \
--cc=ubizjak@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).