https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522

--- Comment #29 from Florian Weimer <fw at gcc dot gnu.org> ---
(In reply to H.J. Lu from comment #26)
> Created attachment 53686 [details]
> A patch not to add crtfastmath.o for -shared on x86

-  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+  "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} \

Works for me. It's also the change I would have mde.

--- Comment #30 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by hongtao Liu <liuho...@gcc.gnu.org>:

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

commit r13-4769-g88b531d0323fc1fc4173f1975d6a4f408a096f8b
Author: liuhongt <hongtao....@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.

Reply via email to