public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 1/9] aarch64: Don't add crtfastmath.o for -shared
@ 2023-01-13  7:59 Richard Biener
  2023-01-13 10:49 ` Richard Earnshaw
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Biener @ 2023-01-13  7:59 UTC (permalink / raw)
  To: gcc-patches; +Cc: richard.sandiford

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

	PR target/55522
	* config/aarch64/aarch64-elf-raw.h (ENDFILE_SPEC): Don't add
	crtfastmath.o for -shared.
	* config/aarch64/aarch64-freebsd.h (GNU_USER_TARGET_MATHFILE_SPEC):
	Likewise.
	* config/aarch64/aarch64-linux.h (GNU_USER_TARGET_MATHFILE_SPEC):
	Likewise.
---
 gcc/config/aarch64/aarch64-elf-raw.h | 2 +-
 gcc/config/aarch64/aarch64-freebsd.h | 2 +-
 gcc/config/aarch64/aarch64-linux.h   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/config/aarch64/aarch64-elf-raw.h b/gcc/config/aarch64/aarch64-elf-raw.h
index d4d820a9d54..fa5b4527ea0 100644
--- a/gcc/config/aarch64/aarch64-elf-raw.h
+++ b/gcc/config/aarch64/aarch64-elf-raw.h
@@ -25,7 +25,7 @@
 #define STARTFILE_SPEC " crti%O%s crtbegin%O%s crt0%O%s"
 #define ENDFILE_SPEC \
   " crtend%O%s crtn%O%s " \
-  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
+  "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}"
 
 #ifndef LINK_SPEC
 #define LINK_SPEC "%{h*}			\
diff --git a/gcc/config/aarch64/aarch64-freebsd.h b/gcc/config/aarch64/aarch64-freebsd.h
index 13beb3781b6..2cf9cf6f046 100644
--- a/gcc/config/aarch64/aarch64-freebsd.h
+++ b/gcc/config/aarch64/aarch64-freebsd.h
@@ -50,7 +50,7 @@
 #define LINK_SPEC FBSD_TARGET_LINK_SPEC AARCH64_ERRATA_LINK_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 ENDFILE_SPEC
 #define ENDFILE_SPEC \
diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
index 5e4553d79f5..61ed4067fc5 100644
--- a/gcc/config/aarch64/aarch64-linux.h
+++ b/gcc/config/aarch64/aarch64-linux.h
@@ -50,7 +50,7 @@
 #define LINK_SPEC LINUX_TARGET_LINK_SPEC AARCH64_ERRATA_LINK_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 ENDFILE_SPEC
 #define ENDFILE_SPEC   \
-- 
2.35.3


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

* Re: [PATCH 1/9] aarch64: Don't add crtfastmath.o for -shared
  2023-01-13  7:59 [PATCH 1/9] aarch64: Don't add crtfastmath.o for -shared Richard Biener
@ 2023-01-13 10:49 ` Richard Earnshaw
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Earnshaw @ 2023-01-13 10:49 UTC (permalink / raw)
  To: Richard Biener, gcc-patches; +Cc: richard.sandiford



On 13/01/2023 07:59, Richard Biener via Gcc-patches wrote:
> Don't add crtfastmath.o for -shared to avoid altering the FP
> environment when loading a shared library.
> 
> 	PR target/55522
> 	* config/aarch64/aarch64-elf-raw.h (ENDFILE_SPEC): Don't add
> 	crtfastmath.o for -shared.
> 	* config/aarch64/aarch64-freebsd.h (GNU_USER_TARGET_MATHFILE_SPEC):
> 	Likewise.
> 	* config/aarch64/aarch64-linux.h (GNU_USER_TARGET_MATHFILE_SPEC):
> 	Likewise.
> ---
>   gcc/config/aarch64/aarch64-elf-raw.h | 2 +-
>   gcc/config/aarch64/aarch64-freebsd.h | 2 +-
>   gcc/config/aarch64/aarch64-linux.h   | 2 +-
>   3 files changed, 3 insertions(+), 3 deletions(-)
> 

OK.

R.

> diff --git a/gcc/config/aarch64/aarch64-elf-raw.h b/gcc/config/aarch64/aarch64-elf-raw.h
> index d4d820a9d54..fa5b4527ea0 100644
> --- a/gcc/config/aarch64/aarch64-elf-raw.h
> +++ b/gcc/config/aarch64/aarch64-elf-raw.h
> @@ -25,7 +25,7 @@
>   #define STARTFILE_SPEC " crti%O%s crtbegin%O%s crt0%O%s"
>   #define ENDFILE_SPEC \
>     " crtend%O%s crtn%O%s " \
> -  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
> +  "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}}"
>   
>   #ifndef LINK_SPEC
>   #define LINK_SPEC "%{h*}			\
> diff --git a/gcc/config/aarch64/aarch64-freebsd.h b/gcc/config/aarch64/aarch64-freebsd.h
> index 13beb3781b6..2cf9cf6f046 100644
> --- a/gcc/config/aarch64/aarch64-freebsd.h
> +++ b/gcc/config/aarch64/aarch64-freebsd.h
> @@ -50,7 +50,7 @@
>   #define LINK_SPEC FBSD_TARGET_LINK_SPEC AARCH64_ERRATA_LINK_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 ENDFILE_SPEC
>   #define ENDFILE_SPEC \
> diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
> index 5e4553d79f5..61ed4067fc5 100644
> --- a/gcc/config/aarch64/aarch64-linux.h
> +++ b/gcc/config/aarch64/aarch64-linux.h
> @@ -50,7 +50,7 @@
>   #define LINK_SPEC LINUX_TARGET_LINK_SPEC AARCH64_ERRATA_LINK_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 ENDFILE_SPEC
>   #define ENDFILE_SPEC   \

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

end of thread, other threads:[~2023-01-13 10:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-13  7:59 [PATCH 1/9] aarch64: Don't add crtfastmath.o for -shared Richard Biener
2023-01-13 10:49 ` Richard Earnshaw

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