public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 7/9] sparc: Don't add crtfastmath.o for -shared
@ 2023-01-13  8:01 Richard Biener
  2023-01-23 11:15 ` Eric Botcazou
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Biener @ 2023-01-13  8:01 UTC (permalink / raw)
  To: gcc-patches; +Cc: ebotcazou

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  | 2 +-
 gcc/config/sparc/linux.h    | 2 +-
 gcc/config/sparc/linux64.h  | 2 +-
 gcc/config/sparc/sp-elf.h   | 2 +-
 gcc/config/sparc/sp64-elf.h | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gcc/config/sparc/freebsd.h b/gcc/config/sparc/freebsd.h
index 73850a31f58..a5aa3679547 100644
--- a/gcc/config/sparc/freebsd.h
+++ b/gcc/config/sparc/freebsd.h
@@ -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.  */
diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
index 6a809e9092d..48386884d05 100644
--- a/gcc/config/sparc/linux.h
+++ b/gcc/config/sparc/linux.h
@@ -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.  */
diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
index d08a2ef96fe..4132cee4c8c 100644
--- a/gcc/config/sparc/linux64.h
+++ b/gcc/config/sparc/linux64.h
@@ -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
diff --git a/gcc/config/sparc/sp-elf.h b/gcc/config/sparc/sp-elf.h
index 53f03b951db..8bd2f54f05d 100644
--- a/gcc/config/sparc/sp-elf.h
+++ b/gcc/config/sparc/sp-elf.h
@@ -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 */
diff --git a/gcc/config/sparc/sp64-elf.h b/gcc/config/sparc/sp64-elf.h
index dc918c6ae24..866db10a343 100644
--- a/gcc/config/sparc/sp64-elf.h
+++ b/gcc/config/sparc/sp64-elf.h
@@ -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).  */
-- 
2.35.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 7/9] sparc: Don't add crtfastmath.o for -shared
  2023-01-13  8:01 [PATCH 7/9] sparc: Don't add crtfastmath.o for -shared Richard Biener
@ 2023-01-23 11:15 ` Eric Botcazou
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Botcazou @ 2023-01-23 11:15 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

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

OK, thanks.

-- 
Eric Botcazou



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 7/9] sparc: Don't add crtfastmath.o for -shared
@ 2023-01-23  9:00 Richard Biener
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2023-01-23  9:00 UTC (permalink / raw)
  To: gcc-patches; +Cc: ebotcazou

On Fri, 13 Jan 2023, Richard Biener wrote:

> Don't add crtfastmath.o for -shared to avoid altering the FP
> environment when loading a shared library.

Ping.

> 	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  | 2 +-
>  gcc/config/sparc/linux.h    | 2 +-
>  gcc/config/sparc/linux64.h  | 2 +-
>  gcc/config/sparc/sp-elf.h   | 2 +-
>  gcc/config/sparc/sp64-elf.h | 2 +-
>  5 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/gcc/config/sparc/freebsd.h b/gcc/config/sparc/freebsd.h
> index 73850a31f58..a5aa3679547 100644
> --- a/gcc/config/sparc/freebsd.h
> +++ b/gcc/config/sparc/freebsd.h
> @@ -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.  */
> diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
> index 6a809e9092d..48386884d05 100644
> --- a/gcc/config/sparc/linux.h
> +++ b/gcc/config/sparc/linux.h
> @@ -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.  */
> diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
> index d08a2ef96fe..4132cee4c8c 100644
> --- a/gcc/config/sparc/linux64.h
> +++ b/gcc/config/sparc/linux64.h
> @@ -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
> diff --git a/gcc/config/sparc/sp-elf.h b/gcc/config/sparc/sp-elf.h
> index 53f03b951db..8bd2f54f05d 100644
> --- a/gcc/config/sparc/sp-elf.h
> +++ b/gcc/config/sparc/sp-elf.h
> @@ -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 */
> diff --git a/gcc/config/sparc/sp64-elf.h b/gcc/config/sparc/sp64-elf.h
> index dc918c6ae24..866db10a343 100644
> --- a/gcc/config/sparc/sp64-elf.h
> +++ b/gcc/config/sparc/sp64-elf.h
> @@ -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).  */
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg,
Germany; GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman;
HRB 36809 (AG Nuernberg)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-23 11:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-13  8:01 [PATCH 7/9] sparc: Don't add crtfastmath.o for -shared Richard Biener
2023-01-23 11:15 ` Eric Botcazou
2023-01-23  9:00 Richard Biener

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