]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
sparc: Don't add crtfastmath.o for -shared
authorRichard Biener <rguenther@suse.de>
Fri, 13 Jan 2023 07:54:33 +0000 (08:54 +0100)
committerRichard Biener <rguenther@suse.de>
Mon, 23 Jan 2023 12:34:29 +0000 (13:34 +0100)
Don't add crtfastmath.o for -shared to avoid altering the FP
environment when loading a shared library.

PR target/55522
* config/sparc/freebsd.h (ENDFILE_SPEC): Don't add crtfastmath.o
for -shared.
* config/sparc/linux.h (ENDFILE_SPEC): Likewise.
* config/sparc/linux64.h (ENDFILE_SPEC): Likewise.
* config/sparc/sp-elf.h (ENDFILE_SPEC): Likewise.
* config/sparc/sp64-elf.h (ENDFILE_SPEC): Likewise.

gcc/config/sparc/freebsd.h
gcc/config/sparc/linux.h
gcc/config/sparc/linux64.h
gcc/config/sparc/sp-elf.h
gcc/config/sparc/sp64-elf.h

index b1ae4ba40d2ad5299e7ea4e6bd78624a4eec20ee..f77203c9f0a226073eaf0713d849a63d08fdb4a4 100644 (file)
@@ -127,7 +127,7 @@ along with GCC; see the file COPYING3.  If not see
 
 #undef ENDFILE_SPEC
 #define ENDFILE_SPEC                                           \
-  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} "    \
+  "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} " \
   FBSD_ENDFILE_SPEC
 
 /* We use GNU ld so undefine this so that attribute((init_priority)) works.  */
index a1144da3f56afcec3b45d75dac25dd5b75230164..0e33b3cac2cf32cb0f4067104a4360d2c0c19a97 100644 (file)
@@ -30,7 +30,7 @@ along with GCC; see the file COPYING3.  If not see
 #undef  ENDFILE_SPEC
 #define ENDFILE_SPEC \
   GNU_USER_TARGET_ENDFILE_SPEC \
-  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
+  "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}"
 
 /* -mcpu=native handling only makes sense with compiler running on
    a SPARC chip.  */
index 80aa703c8d1666a432d20a6a8fea1ec2c22fb93b..f1cc0a19e493fb1e2eabc34c60c6183b1ee88bcc 100644 (file)
@@ -47,7 +47,7 @@ along with GCC; see the file COPYING3.  If not see
 #undef ENDFILE_SPEC
 #define ENDFILE_SPEC \
   GNU_USER_TARGET_ENDFILE_SPEC \
-  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
+  "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}"
 
 /* The default code model.  */
 #undef SPARC_DEFAULT_CMODEL
index fdd5c57e1fa314db9cb7b0b9e17a52eac88c9a8c..0d6a9af5dfe1c3ccfe998833bd34bccdb5c6f9d7 100644 (file)
@@ -32,7 +32,7 @@ along with GCC; see the file COPYING3.  If not see
 
 #undef ENDFILE_SPEC
 #define ENDFILE_SPEC \
-  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+  "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} \
    crtend.o%s crtn.o%s"
 
 /* Don't set the target flags, this is done by the linker script */
index 1f476cdf5f35207449fd6f6e69dfb5c7385c630c..11c95046448273d4992ef2f86e0b71b20b26fd27 100644 (file)
@@ -44,7 +44,7 @@ along with GCC; see the file COPYING3.  If not see
 
 #undef ENDFILE_SPEC
 #define ENDFILE_SPEC \
-  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+  "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} \
    crtend.o%s crtn.o%s"
 
 /* Use the default (for now).  */