public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-4769] x86: Don't add crtfastmath.o for -shared
@ 2022-12-19  8:48 hongtao Liu
  0 siblings, 0 replies; only message in thread
From: hongtao Liu @ 2022-12-19  8:48 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:88b531d0323fc1fc4173f1975d6a4f408a096f8b

commit r13-4769-g88b531d0323fc1fc4173f1975d6a4f408a096f8b
Author: liuhongt <hongtao.liu@intel.com>
Date:   Thu Dec 15 09:38:08 2022 +0800

    x86: Don't add crtfastmath.o for -shared
    
    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.

Diff:
---
 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 c7e88e46e28..d8a20797603 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -17693,7 +17693,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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-19  8:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-19  8:48 [gcc r13-4769] x86: Don't add crtfastmath.o for -shared hongtao Liu

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).