public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 0/2] libgcc: Make heap trampoline support dynamic [PR113403].
@ 2024-01-28 14:07 Iain Sandoe
  2024-01-28 14:07 ` [PATCH 1/2] " Iain Sandoe
  0 siblings, 1 reply; 9+ messages in thread
From: Iain Sandoe @ 2024-01-28 14:07 UTC (permalink / raw)
  To: gcc-patches; +Cc: jakub

This series follows Jakub's suggestion in the PR (for Linux in the first patch)
and handles Darwin-specific cases (in the second).

Sorry this has taken a while, the Darwin permutations had some glitches which
necessitated re-tests on several OS versions.

Tested on x86_64 (and aarch64) Darwin, x86_64, aarch64 Linux.
OK for trunk for patch 1 and the non-Darwin parts of patch2.
thanks,
Iain



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

* [PATCH 1/2] libgcc: Make heap trampoline support dynamic [PR113403].
  2024-01-28 14:07 [PATCH 0/2] libgcc: Make heap trampoline support dynamic [PR113403] Iain Sandoe
@ 2024-01-28 14:07 ` Iain Sandoe
  2024-01-28 14:07   ` [PATCH 2/2] " Iain Sandoe
                     ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Iain Sandoe @ 2024-01-28 14:07 UTC (permalink / raw)
  To: gcc-patches; +Cc: jakub

This removes the heap trampoline support functions from libgcc.a and
adds them to libgcc_eh.a.  They are also present in libgcc_s.

	PR libgcc/113403

libgcc/ChangeLog:

	* config/aarch64/t-heap-trampoline: Move the heap trampoline
	support functions from libgcc.a to libgcc_eh.a.
	* config/i386/t-heap-trampoline: Likewise.
---
 libgcc/config/aarch64/t-heap-trampoline | 3 ++-
 libgcc/config/i386/t-heap-trampoline    | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/libgcc/config/aarch64/t-heap-trampoline b/libgcc/config/aarch64/t-heap-trampoline
index b22480800b2..6468fb8704f 100644
--- a/libgcc/config/aarch64/t-heap-trampoline
+++ b/libgcc/config/aarch64/t-heap-trampoline
@@ -16,4 +16,5 @@
 # along with GCC; see the file COPYING3.  If not see
 # <http://www.gnu.org/licenses/>.
 
-LIB2ADD += $(srcdir)/config/aarch64/heap-trampoline.c
+LIB2ADDEH += $(srcdir)/config/aarch64/heap-trampoline.c
+LIB2ADDEHSHARED += $(srcdir)/config/aarch64/heap-trampoline.c
diff --git a/libgcc/config/i386/t-heap-trampoline b/libgcc/config/i386/t-heap-trampoline
index 613f635b1f6..728c1e26a92 100644
--- a/libgcc/config/i386/t-heap-trampoline
+++ b/libgcc/config/i386/t-heap-trampoline
@@ -16,4 +16,5 @@
 # along with GCC; see the file COPYING3.  If not see
 # <http://www.gnu.org/licenses/>.
 
-LIB2ADD += $(srcdir)/config/i386/heap-trampoline.c
+LIB2ADDEH += $(srcdir)/config/i386/heap-trampoline.c
+LIB2ADDEHSHARED += $(srcdir)/config/aarch64/heap-trampoline.c
-- 
2.39.2 (Apple Git-143)


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

* [PATCH 2/2] libgcc: Make heap trampoline support dynamic [PR113403].
  2024-01-28 14:07 ` [PATCH 1/2] " Iain Sandoe
@ 2024-01-28 14:07   ` Iain Sandoe
  2024-01-28 16:32     ` Jakub Jelinek
  2024-01-28 16:30   ` [PATCH 1/2] " Jakub Jelinek
  2024-01-31 11:59   ` [PATCH] libgcc: Fix up i386/t-heap-trampoline [PR113403] Jakub Jelinek
  2 siblings, 1 reply; 9+ messages in thread
From: Iain Sandoe @ 2024-01-28 14:07 UTC (permalink / raw)
  To: gcc-patches; +Cc: jakub

In order to handle system security constraints during GCC build
and test and that most platform versions cannot link to libgcc_eh
since the unwinder there is incompatible with the system one.

1. We make the support functions weak definitions.
2. We include them as a CRT for platform conditions that do not
   allow libgcc_eh.
3. We ensure that the weak symbols are exported from DSOs (which
   includes exes on Darwin) so that the dynamic linker will
   pick one instance (which avoids duplication of trampoline
   caches).

	PR libgcc/113403

gcc/ChangeLog:

	* config/darwin.h (DARWIN_SHARED_WEAK_ADDS, DARWIN_WEAK_CRTS): New.
	(REAL_LIBGCC_SPEC): Move weak CRT handling to separate spec.
	* config/i386/darwin.h (DARWIN_HEAP_T_LIB): New.
	* config/i386/darwin32-biarch.h (DARWIN_HEAP_T_LIB): New.
	* config/i386/darwin64-biarch.h (DARWIN_HEAP_T_LIB): New.
	* config/rs6000/darwin.h (DARWIN_HEAP_T_LIB): New.

libgcc/ChangeLog:

	* config.host: Build libheap_t.a for i686/x86_64 Darwin.
	* config/aarch64/heap-trampoline.c (HEAP_T_ATTR): New.
	(allocate_tramp_ctrl): Allow a target to build this as a weak def.
	(__gcc_nested_func_ptr_created): Likewise.
	* config/i386/heap-trampoline.c (HEAP_T_ATTR): New.
	(allocate_tramp_ctrl): Allow a target to build this as a weak def.
	(__gcc_nested_func_ptr_created): Likewise.
	* config/t-darwin: Build libheap_t.a (a CRT with heap trampoline
	support).
---
 gcc/config/darwin.h                     | 43 ++++++++++++++++---------
 gcc/config/i386/darwin.h                |  2 ++
 gcc/config/i386/darwin32-biarch.h       |  3 ++
 gcc/config/i386/darwin64-biarch.h       |  3 ++
 gcc/config/rs6000/darwin.h              |  3 ++
 libgcc/config.host                      |  7 ++--
 libgcc/config/aarch64/heap-trampoline.c |  8 +++++
 libgcc/config/i386/heap-trampoline.c    |  8 +++++
 libgcc/config/t-darwin                  | 13 ++++++++
 9 files changed, 72 insertions(+), 18 deletions(-)

diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index cb96d67b3b1..31019a0c49d 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -314,13 +314,17 @@ extern GTY(()) int darwin_ms_struct;
 # define DARWIN_RPATH_LINK \
 "%{!r:%{!nostdlib:%{!nodefaultrpaths:%(darwin_rpaths)}}}"
 # define DARWIN_SHARED_LIBGCC "-lgcc_s.1.1"
+# define DARWIN_SHARED_WEAK_ADDS " "
 #else
 # define DARWIN_RPATH_LINK ""
 # define DARWIN_SHARED_LIBGCC \
-"%:version-compare(!> 10.11 mmacosx-version-min= -lgcc_s.1.1) \
- %:version-compare(>= 10.11 mmacosx-version-min= -lemutls_w) "
+"%:version-compare(!> 10.11 mmacosx-version-min= -lgcc_s.1.1)"
+# define DARWIN_SHARED_WEAK_ADDS \
+"%{%:version-compare(>= 10.11 mmacosx-version-min= -lemutls_w): \
+ " DARWIN_HEAP_T_LIB "}"
 #endif
 
+
 /* We might elect to add a path even when this compiler does not use embedded
    run paths, so that we can use libraries from an alternate compiler that is
    using embedded runpaths.  */
@@ -398,7 +402,9 @@ extern GTY(()) int darwin_ms_struct;
     %{e*} %{r} \
     %{o*}%{!o:-o a.out} \
     %{!r:%{!nostdlib:%{!nostartfiles:%S}}} \
-    %{L*} %(link_libgcc) %o \
+    %{L*} %(link_libgcc) \
+    %{!r:%{!nostdlib:%{!nodefaultlibs: " DARWIN_WEAK_CRTS "}}} \
+    %o \
     %{!r:%{!nostdlib:%{!nodefaultlibs:\
       %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} \
       %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1): \
@@ -412,15 +418,15 @@ extern GTY(()) int darwin_ms_struct;
       %(link_ssp) \
       %:version-compare(>< 10.6 10.7 mmacosx-version-min= -ld10-uwfef) \
       %(link_gcc_c_sequence) \
-      %{!nodefaultexport:%{dylib|dynamiclib|bundle: \
-	%:version-compare(>= 10.11 asm_macosx_version_min= -U) \
-	%:version-compare(>= 10.11 asm_macosx_version_min= ___emutls_get_address) \
-	%:version-compare(>= 10.11 asm_macosx_version_min= -exported_symbol) \
-	%:version-compare(>= 10.11 asm_macosx_version_min= ___emutls_get_address) \
-	%:version-compare(>= 10.11 asm_macosx_version_min= -U) \
-	%:version-compare(>= 10.11 asm_macosx_version_min= ___emutls_register_common) \
-	%:version-compare(>= 10.11 asm_macosx_version_min= -exported_symbol) \
-	%:version-compare(>= 10.11 asm_macosx_version_min= ___emutls_register_common) \
+      %{!nodefaultexport: \
+	%{%:version-compare(>= 10.11 asm_macosx_version_min= -U): \
+	   ___emutls_get_address -exported_symbol ___emutls_get_address \
+	  -U ___emutls_register_common \
+	  -exported_symbol ___emutls_register_common \
+	  -U ___gcc_nested_func_ptr_created \
+	  -exported_symbol ___gcc_nested_func_ptr_created \
+	  -U ___gcc_nested_func_ptr_deleted \
+	  -exported_symbol ___gcc_nested_func_ptr_deleted \
       }} \
     }}}\
     %{!r:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} %{F*} "\
@@ -542,16 +548,21 @@ extern GTY(()) int darwin_ms_struct;
 #undef REAL_LIBGCC_SPEC
 #define REAL_LIBGCC_SPEC \
 "%{static-libgcc|static:						  \
-    %:version-compare(!> 10.6 mmacosx-version-min= -lgcc_eh)		  \
-    %:version-compare(>= 10.6 mmacosx-version-min= -lemutls_w);		  \
+    %:version-compare(!> 10.6 mmacosx-version-min= -lgcc_eh);		  \
    shared-libgcc|fexceptions|fobjc-exceptions|fgnu-runtime:		  \
    " DARWIN_SHARED_LIBGCC "						  \
     %:version-compare(!> 10.3.9 mmacosx-version-min= -lgcc_eh)		  \
     %:version-compare(>< 10.3.9 10.5 mmacosx-version-min= -lgcc_s.10.4)   \
-    %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5);	  \
-   : -lemutls_w								  \
+    %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5)	  \
   } -lgcc "
 
+#define DARWIN_WEAK_CRTS \
+"%{static-libgcc|static:						  \
+    %{%:version-compare(>= 10.6 mmacosx-version-min= -lemutls_w):	  \
+      " DARWIN_HEAP_T_LIB "} ;						  \
+   : -lemutls_w	" DARWIN_HEAP_T_LIB "					  \
+  }"
+
 /* We specify crt0.o as -lcrt0.o so that ld will search the library path.  */
 
 #undef  STARTFILE_SPEC
diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h
index b7814f7c42e..8e64b4e9b5f 100644
--- a/gcc/config/i386/darwin.h
+++ b/gcc/config/i386/darwin.h
@@ -119,6 +119,8 @@ along with GCC; see the file COPYING3.  If not see
 /* We default to x86_64 for single-arch builds, bi-arch overrides.  */
 #define DARWIN_ARCH_SPEC "x86_64"
 #define DARWIN_SUBARCH_SPEC DARWIN_ARCH_SPEC
+#undef DARWIN_HEAP_T_LIB
+#define DARWIN_HEAP_T_LIB " -lheapt_w "
 #endif
 
 #undef SUBTARGET_EXTRA_SPECS
diff --git a/gcc/config/i386/darwin32-biarch.h b/gcc/config/i386/darwin32-biarch.h
index 051ad12b425..2180f5a5352 100644
--- a/gcc/config/i386/darwin32-biarch.h
+++ b/gcc/config/i386/darwin32-biarch.h
@@ -27,6 +27,9 @@ along with GCC; see the file COPYING3.  If not see
 #undef  DARWIN_SUBARCH_SPEC
 #define DARWIN_SUBARCH_SPEC DARWIN_ARCH_SPEC
 
+#undef DARWIN_HEAP_T_LIB
+#define DARWIN_HEAP_T_LIB " %{m64:-lheapt_w}"
+
 #undef SUBTARGET_EXTRA_SPECS
 #define SUBTARGET_EXTRA_SPECS                                   \
   DARWIN_EXTRA_SPECS                                            \
diff --git a/gcc/config/i386/darwin64-biarch.h b/gcc/config/i386/darwin64-biarch.h
index 85436791a6c..620800749a8 100644
--- a/gcc/config/i386/darwin64-biarch.h
+++ b/gcc/config/i386/darwin64-biarch.h
@@ -28,6 +28,9 @@ along with GCC; see the file COPYING3.  If not see
 #undef  DARWIN_SUBARCH_SPEC
 #define DARWIN_SUBARCH_SPEC DARWIN_ARCH_SPEC
 
+#undef DARWIN_HEAP_T_LIB
+#define DARWIN_HEAP_T_LIB "%{!m32:-lheapt_w}"
+
 #undef SUBTARGET_EXTRA_SPECS
 #define SUBTARGET_EXTRA_SPECS                                   \
   DARWIN_EXTRA_SPECS                                            \
diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h
index b264284100f..e8b194982b4 100644
--- a/gcc/config/rs6000/darwin.h
+++ b/gcc/config/rs6000/darwin.h
@@ -113,6 +113,9 @@
   -lSystem								\
 }"
 
+#undef DARWIN_HEAP_T_LIB
+#define DARWIN_HEAP_T_LIB " "
+
 /* We want -fPIC by default, unless we're using -static to compile for
    the kernel or some such.  The "-faltivec" option should have been
    called "-maltivec" all along.  */
diff --git a/libgcc/config.host b/libgcc/config.host
index 017fbc7a06d..3e7d00f67aa 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -715,12 +715,15 @@ hppa*-*-netbsd*)
 i[34567]86-*-darwin*)
 	tmake_file="$tmake_file i386/t-crtpc t-crtfm i386/t-msabi"
 	tm_file="$tm_file i386/darwin-lib.h"
-	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
+	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o"
+	extra_parts="$extra_parts crtfastmath.o libheapt_w.a"
+	tmake_file="${tmake_file} i386/t-heap-trampoline"
 	;;
 x86_64-*-darwin*)
 	tmake_file="$tmake_file i386/t-crtpc t-crtfm i386/t-msabi"
 	tm_file="$tm_file i386/darwin-lib.h"
-	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
+	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o"
+	extra_parts="$extra_parts crtfastmath.o libheapt_w.a"
 	tmake_file="${tmake_file} i386/t-heap-trampoline"
 	;;
 i[34567]86-*-elfiamcu)
diff --git a/libgcc/config/aarch64/heap-trampoline.c b/libgcc/config/aarch64/heap-trampoline.c
index 2041fe6aa39..b463399c1e9 100644
--- a/libgcc/config/aarch64/heap-trampoline.c
+++ b/libgcc/config/aarch64/heap-trampoline.c
@@ -15,6 +15,12 @@
 #include <pthread.h>
 #endif
 
+/* HEAP_T_ATTR is provided to allow targets to build the exported functions
+   as weak definitions.  */
+#ifndef HEAP_T_ATTR
+#  define HEAP_T_ATTR
+#endif
+
 void *allocate_trampoline_page (void);
 int get_trampolines_per_page (void);
 struct tramp_ctrl_data *allocate_tramp_ctrl (struct tramp_ctrl_data *parent);
@@ -107,6 +113,7 @@ allocate_tramp_ctrl (struct tramp_ctrl_data *parent)
   return p;
 }
 
+HEAP_T_ATTR
 void
 __gcc_nested_func_ptr_created (void *chain, void *func, void **dst)
 {
@@ -154,6 +161,7 @@ __gcc_nested_func_ptr_created (void *chain, void *func, void **dst)
   *dst = &trampoline->insns;
 }
 
+HEAP_T_ATTR
 void
 __gcc_nested_func_ptr_deleted (void)
 {
diff --git a/libgcc/config/i386/heap-trampoline.c b/libgcc/config/i386/heap-trampoline.c
index 726cf55277a..4e069c458a7 100644
--- a/libgcc/config/i386/heap-trampoline.c
+++ b/libgcc/config/i386/heap-trampoline.c
@@ -15,6 +15,12 @@
 #include <pthread.h>
 #endif
 
+/* HEAP_T_ATTR is provided to allow targets to build the exported functions
+   as weak definitions.  */
+#ifndef HEAP_T_ATTR
+#  define HEAP_T_ATTR
+#endif
+
 void *allocate_trampoline_page (void);
 int get_trampolines_per_page (void);
 struct tramp_ctrl_data *allocate_tramp_ctrl (struct tramp_ctrl_data *parent);
@@ -107,6 +113,7 @@ allocate_tramp_ctrl (struct tramp_ctrl_data *parent)
   return p;
 }
 
+HEAP_T_ATTR
 void
 __gcc_nested_func_ptr_created (void *chain, void *func, void **dst)
 {
@@ -154,6 +161,7 @@ __gcc_nested_func_ptr_created (void *chain, void *func, void **dst)
   *dst = &trampoline->insns;
 }
 
+HEAP_T_ATTR
 void
 __gcc_nested_func_ptr_deleted (void)
 {
diff --git a/libgcc/config/t-darwin b/libgcc/config/t-darwin
index a3bb70c6a0a..0f65b54a230 100644
--- a/libgcc/config/t-darwin
+++ b/libgcc/config/t-darwin
@@ -51,5 +51,18 @@ LIB2ADDEH = $(srcdir)/unwind-dw2.c \
 # Do not build a shared unwind lib by default.
 LIBEHSOBJS=
 
+# Make heap trampoline helpers weak definitions so that we can merge them from
+# multiple DSOs.
+heap-trampoline.o: HOST_LIBGCC2_CFLAGS += \
+  -DHEAP_T_ATTR='__attribute__((__weak__,__visibility__("default")))'
+heap-trampoline_s.o: HOST_LIBGCC2_CFLAGS += \
+  -DHEAP_T_ATTR='__attribute__((__weak__,__visibility__("default")))'
+
+# Make a heap trampoline support CRT so that it can be linked optionally, use
+# the shared version so that we can link with DSOs.
+libheapt_w.a: heap-trampoline_s.o
+	$(AR_CREATE_FOR_TARGET) $@ $<
+	$(RANLIB_FOR_TARGET) $@
+
 # Symbols for all the sub-ports.
 SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/libgcc-libsystem.ver
-- 
2.39.2 (Apple Git-143)


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

* Re: [PATCH 1/2] libgcc: Make heap trampoline support dynamic [PR113403].
  2024-01-28 14:07 ` [PATCH 1/2] " Iain Sandoe
  2024-01-28 14:07   ` [PATCH 2/2] " Iain Sandoe
@ 2024-01-28 16:30   ` Jakub Jelinek
  2024-01-31 11:59   ` [PATCH] libgcc: Fix up i386/t-heap-trampoline [PR113403] Jakub Jelinek
  2 siblings, 0 replies; 9+ messages in thread
From: Jakub Jelinek @ 2024-01-28 16:30 UTC (permalink / raw)
  To: iain; +Cc: gcc-patches

On Sun, Jan 28, 2024 at 02:07:32PM +0000, Iain Sandoe wrote:
> This removes the heap trampoline support functions from libgcc.a and
> adds them to libgcc_eh.a.  They are also present in libgcc_s.
> 
> 	PR libgcc/113403
> 
> libgcc/ChangeLog:
> 
> 	* config/aarch64/t-heap-trampoline: Move the heap trampoline
> 	support functions from libgcc.a to libgcc_eh.a.
> 	* config/i386/t-heap-trampoline: Likewise.

LGTM.
I'd also default to -shared-libgcc when linking using gcc driver with
the new trampoline option in options unless -static-libgcc has been used,
but that can be done incrementally.

> diff --git a/libgcc/config/aarch64/t-heap-trampoline b/libgcc/config/aarch64/t-heap-trampoline
> index b22480800b2..6468fb8704f 100644
> --- a/libgcc/config/aarch64/t-heap-trampoline
> +++ b/libgcc/config/aarch64/t-heap-trampoline
> @@ -16,4 +16,5 @@
>  # along with GCC; see the file COPYING3.  If not see
>  # <http://www.gnu.org/licenses/>.
>  
> -LIB2ADD += $(srcdir)/config/aarch64/heap-trampoline.c
> +LIB2ADDEH += $(srcdir)/config/aarch64/heap-trampoline.c
> +LIB2ADDEHSHARED += $(srcdir)/config/aarch64/heap-trampoline.c
> diff --git a/libgcc/config/i386/t-heap-trampoline b/libgcc/config/i386/t-heap-trampoline
> index 613f635b1f6..728c1e26a92 100644
> --- a/libgcc/config/i386/t-heap-trampoline
> +++ b/libgcc/config/i386/t-heap-trampoline
> @@ -16,4 +16,5 @@
>  # along with GCC; see the file COPYING3.  If not see
>  # <http://www.gnu.org/licenses/>.
>  
> -LIB2ADD += $(srcdir)/config/i386/heap-trampoline.c
> +LIB2ADDEH += $(srcdir)/config/i386/heap-trampoline.c
> +LIB2ADDEHSHARED += $(srcdir)/config/aarch64/heap-trampoline.c
> -- 
> 2.39.2 (Apple Git-143)

	Jakub


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

* Re: [PATCH 2/2] libgcc: Make heap trampoline support dynamic [PR113403].
  2024-01-28 14:07   ` [PATCH 2/2] " Iain Sandoe
@ 2024-01-28 16:32     ` Jakub Jelinek
  0 siblings, 0 replies; 9+ messages in thread
From: Jakub Jelinek @ 2024-01-28 16:32 UTC (permalink / raw)
  To: iain; +Cc: gcc-patches

On Sun, Jan 28, 2024 at 02:07:33PM +0000, Iain Sandoe wrote:
> In order to handle system security constraints during GCC build
> and test and that most platform versions cannot link to libgcc_eh
> since the unwinder there is incompatible with the system one.
> 
> 1. We make the support functions weak definitions.
> 2. We include them as a CRT for platform conditions that do not
>    allow libgcc_eh.
> 3. We ensure that the weak symbols are exported from DSOs (which
>    includes exes on Darwin) so that the dynamic linker will
>    pick one instance (which avoids duplication of trampoline
>    caches).
> 
> 	PR libgcc/113403
> 
> gcc/ChangeLog:
> 
> 	* config/darwin.h (DARWIN_SHARED_WEAK_ADDS, DARWIN_WEAK_CRTS): New.
> 	(REAL_LIBGCC_SPEC): Move weak CRT handling to separate spec.
> 	* config/i386/darwin.h (DARWIN_HEAP_T_LIB): New.
> 	* config/i386/darwin32-biarch.h (DARWIN_HEAP_T_LIB): New.
> 	* config/i386/darwin64-biarch.h (DARWIN_HEAP_T_LIB): New.
> 	* config/rs6000/darwin.h (DARWIN_HEAP_T_LIB): New.
> 
> libgcc/ChangeLog:
> 
> 	* config.host: Build libheap_t.a for i686/x86_64 Darwin.
> 	* config/aarch64/heap-trampoline.c (HEAP_T_ATTR): New.
> 	(allocate_tramp_ctrl): Allow a target to build this as a weak def.
> 	(__gcc_nested_func_ptr_created): Likewise.
> 	* config/i386/heap-trampoline.c (HEAP_T_ATTR): New.
> 	(allocate_tramp_ctrl): Allow a target to build this as a weak def.
> 	(__gcc_nested_func_ptr_created): Likewise.
> 	* config/t-darwin: Build libheap_t.a (a CRT with heap trampoline
> 	support).

The non-darwin parts here (config.host, heap-trampoline.c) here are ok,
I don't know anything about Darwin to judge the rest and you're the
maintainer...

	Jakub


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

* [PATCH] libgcc: Fix up i386/t-heap-trampoline [PR113403]
  2024-01-28 14:07 ` [PATCH 1/2] " Iain Sandoe
  2024-01-28 14:07   ` [PATCH 2/2] " Iain Sandoe
  2024-01-28 16:30   ` [PATCH 1/2] " Jakub Jelinek
@ 2024-01-31 11:59   ` Jakub Jelinek
  2024-02-01  8:22     ` Jakub Jelinek
  2 siblings, 1 reply; 9+ messages in thread
From: Jakub Jelinek @ 2024-01-31 11:59 UTC (permalink / raw)
  To: iain; +Cc: gcc-patches

On Sun, Jan 28, 2024 at 02:07:32PM +0000, Iain Sandoe wrote:
> --- a/libgcc/config/aarch64/t-heap-trampoline
> +++ b/libgcc/config/aarch64/t-heap-trampoline
> @@ -16,4 +16,5 @@
>  # along with GCC; see the file COPYING3.  If not see
>  # <http://www.gnu.org/licenses/>.
>  
> -LIB2ADD += $(srcdir)/config/aarch64/heap-trampoline.c
> +LIB2ADDEH += $(srcdir)/config/aarch64/heap-trampoline.c
> +LIB2ADDEHSHARED += $(srcdir)/config/aarch64/heap-trampoline.c
> --- a/libgcc/config/i386/t-heap-trampoline
> +++ b/libgcc/config/i386/t-heap-trampoline
> @@ -16,4 +16,5 @@
>  # along with GCC; see the file COPYING3.  If not see
>  # <http://www.gnu.org/licenses/>.
>  
> -LIB2ADD += $(srcdir)/config/i386/heap-trampoline.c
> +LIB2ADDEH += $(srcdir)/config/i386/heap-trampoline.c
> +LIB2ADDEHSHARED += $(srcdir)/config/aarch64/heap-trampoline.c

I'm seeing
../../../libgcc/shared-object.mk:14: warning: overriding recipe for target 'heap-trampoline.o'
../../../libgcc/shared-object.mk:14: warning: ignoring old recipe for target 'heap-trampoline.o'
../../../libgcc/shared-object.mk:17: warning: overriding recipe for target 'heap-trampoline_s.o'
../../../libgcc/shared-object.mk:17: warning: ignoring old recipe for target 'heap-trampoline_s.o'

Shouldn't we go with following patch?
I can test it on x86_64-linux and i686-linux, but can't test it e.g. on
Darwin easily.

2024-01-31  Jakub Jelinek  <jakub@redhat.com>

	* config/i386/t-heap-trampoline: Add to LIB2ADDEHSHARED
	i386/heap-trampoline.c rather than aarch64/heap-trampoline.c.

--- libgcc/config/i386/t-heap-trampoline.jj	2024-01-31 10:46:36.491743132 +0100
+++ libgcc/config/i386/t-heap-trampoline	2024-01-31 12:55:59.779101625 +0100
@@ -17,4 +17,4 @@
 # <http://www.gnu.org/licenses/>.
 
 LIB2ADDEH += $(srcdir)/config/i386/heap-trampoline.c
-LIB2ADDEHSHARED += $(srcdir)/config/aarch64/heap-trampoline.c
+LIB2ADDEHSHARED += $(srcdir)/config/i386/heap-trampoline.c

	Jakub


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

* Re: [PATCH] libgcc: Fix up i386/t-heap-trampoline [PR113403]
  2024-01-31 11:59   ` [PATCH] libgcc: Fix up i386/t-heap-trampoline [PR113403] Jakub Jelinek
@ 2024-02-01  8:22     ` Jakub Jelinek
  2024-02-01 19:58       ` Iain Sandoe
  0 siblings, 1 reply; 9+ messages in thread
From: Jakub Jelinek @ 2024-02-01  8:22 UTC (permalink / raw)
  To: iain, gcc-patches

On Wed, Jan 31, 2024 at 12:59:27PM +0100, Jakub Jelinek wrote:
> On Sun, Jan 28, 2024 at 02:07:32PM +0000, Iain Sandoe wrote:
> > --- a/libgcc/config/aarch64/t-heap-trampoline
> > +++ b/libgcc/config/aarch64/t-heap-trampoline
> > @@ -16,4 +16,5 @@
> >  # along with GCC; see the file COPYING3.  If not see
> >  # <http://www.gnu.org/licenses/>.
> >  
> > -LIB2ADD += $(srcdir)/config/aarch64/heap-trampoline.c
> > +LIB2ADDEH += $(srcdir)/config/aarch64/heap-trampoline.c
> > +LIB2ADDEHSHARED += $(srcdir)/config/aarch64/heap-trampoline.c
> > --- a/libgcc/config/i386/t-heap-trampoline
> > +++ b/libgcc/config/i386/t-heap-trampoline
> > @@ -16,4 +16,5 @@
> >  # along with GCC; see the file COPYING3.  If not see
> >  # <http://www.gnu.org/licenses/>.
> >  
> > -LIB2ADD += $(srcdir)/config/i386/heap-trampoline.c
> > +LIB2ADDEH += $(srcdir)/config/i386/heap-trampoline.c
> > +LIB2ADDEHSHARED += $(srcdir)/config/aarch64/heap-trampoline.c
> 
> I'm seeing
> ../../../libgcc/shared-object.mk:14: warning: overriding recipe for target 'heap-trampoline.o'
> ../../../libgcc/shared-object.mk:14: warning: ignoring old recipe for target 'heap-trampoline.o'
> ../../../libgcc/shared-object.mk:17: warning: overriding recipe for target 'heap-trampoline_s.o'
> ../../../libgcc/shared-object.mk:17: warning: ignoring old recipe for target 'heap-trampoline_s.o'
> 
> Shouldn't we go with following patch?
> I can test it on x86_64-linux and i686-linux, but can't test it e.g. on
> Darwin easily.
> 
> 2024-01-31  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* config/i386/t-heap-trampoline: Add to LIB2ADDEHSHARED
> 	i386/heap-trampoline.c rather than aarch64/heap-trampoline.c.

Bootstrapped/regtested on x86_64-linux and i686-linux successfully.

	Jakub


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

* Re: [PATCH] libgcc: Fix up i386/t-heap-trampoline [PR113403]
  2024-02-01  8:22     ` Jakub Jelinek
@ 2024-02-01 19:58       ` Iain Sandoe
  2024-02-01 20:03         ` Jakub Jelinek
  0 siblings, 1 reply; 9+ messages in thread
From: Iain Sandoe @ 2024-02-01 19:58 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: GCC Patches



> On 1 Feb 2024, at 08:22, Jakub Jelinek <jakub@redhat.com> wrote:
> 
> On Wed, Jan 31, 2024 at 12:59:27PM +0100, Jakub Jelinek wrote:
>> On Sun, Jan 28, 2024 at 02:07:32PM +0000, Iain Sandoe wrote:
>>> --- a/libgcc/config/aarch64/t-heap-trampoline
>>> +++ b/libgcc/config/aarch64/t-heap-trampoline
>>> @@ -16,4 +16,5 @@
>>> # along with GCC; see the file COPYING3.  If not see
>>> # <http://www.gnu.org/licenses/>.
>>> 
>>> -LIB2ADD += $(srcdir)/config/aarch64/heap-trampoline.c
>>> +LIB2ADDEH += $(srcdir)/config/aarch64/heap-trampoline.c
>>> +LIB2ADDEHSHARED += $(srcdir)/config/aarch64/heap-trampoline.c
>>> --- a/libgcc/config/i386/t-heap-trampoline
>>> +++ b/libgcc/config/i386/t-heap-trampoline
>>> @@ -16,4 +16,5 @@
>>> # along with GCC; see the file COPYING3.  If not see
>>> # <http://www.gnu.org/licenses/>.
>>> 
>>> -LIB2ADD += $(srcdir)/config/i386/heap-trampoline.c
>>> +LIB2ADDEH += $(srcdir)/config/i386/heap-trampoline.c
>>> +LIB2ADDEHSHARED += $(srcdir)/config/aarch64/heap-trampoline.c
>> 
>> I'm seeing
>> ../../../libgcc/shared-object.mk:14: warning: overriding recipe for target 'heap-trampoline.o'
>> ../../../libgcc/shared-object.mk:14: warning: ignoring old recipe for target 'heap-trampoline.o'
>> ../../../libgcc/shared-object.mk:17: warning: overriding recipe for target 'heap-trampoline_s.o'
>> ../../../libgcc/shared-object.mk:17: warning: ignoring old recipe for target 'heap-trampoline_s.o'
>> 
>> Shouldn't we go with following patch?
>> I can test it on x86_64-linux and i686-linux, but can't test it e.g. on
>> Darwin easily.
>> 
>> 2024-01-31  Jakub Jelinek  <jakub@redhat.com>
>> 
>> 	* config/i386/t-heap-trampoline: Add to LIB2ADDEHSHARED
>> 	i386/heap-trampoline.c rather than aarch64/heap-trampoline.c.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux successfully.

Thanks, looks silly pasto that somehow managed to survive default testing
options.

Tested x86_64-darwin (along with the warning suppression patch) and
tested for ftrampoline-impl={heap,stack} and {static,shared}-libgcc.

thanks
Iain


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

* Re: [PATCH] libgcc: Fix up i386/t-heap-trampoline [PR113403]
  2024-02-01 19:58       ` Iain Sandoe
@ 2024-02-01 20:03         ` Jakub Jelinek
  0 siblings, 0 replies; 9+ messages in thread
From: Jakub Jelinek @ 2024-02-01 20:03 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: GCC Patches

On Thu, Feb 01, 2024 at 07:58:29PM +0000, Iain Sandoe wrote:
> Thanks, looks silly pasto that somehow managed to survive default testing
> options.
> 
> Tested x86_64-darwin (along with the warning suppression patch) and
> tested for ftrampoline-impl={heap,stack} and {static,shared}-libgcc.

Thanks.  This pasto looks obvious to me and for the other one Richi said it
is obvious, so I'll commit both to trunk now.

	Jakub


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

end of thread, other threads:[~2024-02-01 20:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-28 14:07 [PATCH 0/2] libgcc: Make heap trampoline support dynamic [PR113403] Iain Sandoe
2024-01-28 14:07 ` [PATCH 1/2] " Iain Sandoe
2024-01-28 14:07   ` [PATCH 2/2] " Iain Sandoe
2024-01-28 16:32     ` Jakub Jelinek
2024-01-28 16:30   ` [PATCH 1/2] " Jakub Jelinek
2024-01-31 11:59   ` [PATCH] libgcc: Fix up i386/t-heap-trampoline [PR113403] Jakub Jelinek
2024-02-01  8:22     ` Jakub Jelinek
2024-02-01 19:58       ` Iain Sandoe
2024-02-01 20:03         ` Jakub Jelinek

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