LoongArch: Don't add crtfastmath.o for -shared
authorRichard Biener <rguenther@suse.de>
Fri, 13 Jan 2023 08:01:12 +0000 (09:01 +0100)
committerChenghua Xu <paul.hua.gm@gmail.com>
Fri, 27 Jan 2023 03:25:18 +0000 (11:25 +0800)
Don't add crtfastmath.o for -shared to avoid altering the FP
environment when loading a shared library.

PR target/55522
* config/loongarch/gnu-user.h (GNU_USER_TARGET_MATHFILE_SPEC):
Don't add crtfastmath.o for -shared.

gcc/config/loongarch/gnu-user.h

index fb7106f..aecaa02 100644 (file)
@@ -49,7 +49,7 @@ along with GCC; see the file COPYING3.  If not see
 /* Similar to standard Linux, but adding -ffast-math support.  */
 #undef GNU_USER_TARGET_MATHFILE_SPEC
 #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}}"
 
 #undef LIB_SPEC
 #define LIB_SPEC GNU_USER_TARGET_LIB_SPEC