[pushed] libgcc, Darwin: Add missing build dependencies.

Message ID 20211217101546.46849-1-iain@sandoe.co.uk
State Committed
Commit 574c09da48a5a0ff4c32dd4577eaf65bac8c94a0
Headers
Series [pushed] libgcc, Darwin: Add missing build dependencies. |

Commit Message

Iain Sandoe Dec. 17, 2021, 10:15 a.m. UTC
  There was a race condition where the link for the new shared EH library
(only used on earlier Darwin) could fail because the new crts had not been
copied to the gcc directory.  This can cause a build failure (although
currently only seen on powerpc-darwin).

Fixed by adding specific dependency on the crts and on the multi target.
We also add the declaration header for the Darwin10 unwinder shim to the
powerpc cases, since we build that there for Rosetta use.

tested on i686, x86_64 and on several cycles of powerpc-darwin, pushed
to master, thanks,
Iain

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

libgcc/ChangeLog:

	* config.host: Add shim declaration header to powerpc*-darwin builds.
	* config/rs6000/t-darwin-ehs: Remove dependency on the powerpc end
	file.
	* config/t-darwin-ehs: Add dependencies to the shared unwinder
	objects.
	* config/t-slibgcc-darwin: Add extra_parts to the dependencies for
	the shared EH lib.  Add all-multi to the dependencies for the
	libgcc_s.1.dylib redirections.
---
 libgcc/config.host                | 4 ++++
 libgcc/config/rs6000/t-darwin-ehs | 4 +---
 libgcc/config/t-darwin-ehs        | 3 +++
 libgcc/config/t-slibgcc-darwin    | 8 ++++----
 4 files changed, 12 insertions(+), 7 deletions(-)
  

Patch

diff --git a/libgcc/config.host b/libgcc/config.host
index 1bac57c82ae..ad0cdb284c7 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -1140,10 +1140,14 @@  powerpc-*-darwin*)
 	  md_unwind_header=rs6000/darwin-unwind.h
 	  ;;
 	esac
+	# We build the darwin10 EH shim for Rosetta (running on x86 machines).
+	tm_file="$tm_file i386/darwin-lib.h"
 	tmake_file="$tmake_file rs6000/t-ppc64-fp rs6000/t-ibm-ldouble"
 	extra_parts="$extra_parts crt2.o crt3_2.o libef_ppc.a dw_ppc.o"
 	;;
 powerpc64-*-darwin*)
+	# We build the darwin10 EH shim for Rosetta (running on x86 machines).
+	tm_file="$tm_file i386/darwin-lib.h"
 	tmake_file="$tmake_file rs6000/t-darwin64 rs6000/t-ibm-ldouble"
 	extra_parts="$extra_parts crt2.o crt3_2.o libef_ppc.a dw_ppc.o"
 	;;
diff --git a/libgcc/config/rs6000/t-darwin-ehs b/libgcc/config/rs6000/t-darwin-ehs
index 3047f53cb70..42f521411af 100644
--- a/libgcc/config/rs6000/t-darwin-ehs
+++ b/libgcc/config/rs6000/t-darwin-ehs
@@ -1,5 +1,3 @@ 
 # We need the save_world code for the EH library.
 
-LIBEHSOBJS +=  darwin-world_s.o
-
-$(LIBEHSOBJS): libef_ppc.a
+LIBEHSOBJS += darwin-world_s.o
diff --git a/libgcc/config/t-darwin-ehs b/libgcc/config/t-darwin-ehs
index 8481898d98a..95275023dac 100644
--- a/libgcc/config/t-darwin-ehs
+++ b/libgcc/config/t-darwin-ehs
@@ -2,3 +2,6 @@ 
 # libgcc_s.1 on systems that used the unwinder in libgcc_s.
 
 LIBEHSOBJS = unwind-dw2_s.o unwind-dw2-fde-darwin_s.o unwind-c_s.o
+
+unwind-dw2_s.o: gthr-default.h md-unwind-support.h
+$(LIBEHSOBJS): libgcc_tm.h
diff --git a/libgcc/config/t-slibgcc-darwin b/libgcc/config/t-slibgcc-darwin
index 7349b87468a..a8f69666a82 100644
--- a/libgcc/config/t-slibgcc-darwin
+++ b/libgcc/config/t-slibgcc-darwin
@@ -59,9 +59,8 @@  ifneq ($(LIBEHSOBJS),)
 EHS_INSTNAME = libgcc_ehs.$(SHLIB_SOVERSION)$(SHLIB_EXT)
 
 # multilib build for a shared EH lib.
-$(LIBEHSOBJS): libgcc_tm.h
 
-libgcc_ehs$(SHLIB_EXT): $(LIBEHSOBJS)
+libgcc_ehs$(SHLIB_EXT): $(LIBEHSOBJS) $(extra-parts)
 	mkdir -p $(MULTIDIR)
 	$(CC) $(LIBGCC2_CFLAGS) $(LDFLAGS) -dynamiclib -nodefaultlibs \
 	-install_name $(SHLIB_INSTALL_DIR)/$(EHS_INSTNAME) \
@@ -113,7 +112,8 @@  libgcc_ehs.$(SHLIB_SOVERSION)$(SHLIB_EXT): all-multi libgcc_ehs$(SHLIB_EXT)
 	rm libgcc_ehs.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T*
 
 
-libgcc_s.1.dylib: libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT) libgcc_ehs.$(SHLIB_SOVERSION)$(SHLIB_EXT)
+libgcc_s.1.dylib: all-multi libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT) \
+		  libgcc_ehs.$(SHLIB_SOVERSION)$(SHLIB_EXT)
 	MLIBS=`$(CC) --print-multi-lib | sed -e 's/;.*$$//'` ; \
 	for mlib in $$MLIBS ; do \
 	  cp ../$${mlib}/libgcc/$${mlib}/libgcc_s$(SHLIB_EXT)  \
@@ -134,7 +134,7 @@  libgcc_s.1.dylib: libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT) libgcc_ehs.$(SHLIB_SOV
 
 else
 
-libgcc_s.1.dylib: libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)
+libgcc_s.1.dylib: all-multi libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)
 	MLIBS=`$(CC) --print-multi-lib | sed -e 's/;.*$$//'` ; \
 	for mlib in $$MLIBS ; do \
 	  cp ../$${mlib}/libgcc/$${mlib}/libgcc_s$(SHLIB_EXT)  \