From 38b69262a97f1c852028f85fd6a2c1c5281a2dae Mon Sep 17 00:00:00 2001 From: iains Date: Tue, 25 Jun 2019 20:11:11 +0000 Subject: [PATCH] [Darwin, PPC] Move the out of line register save/restore to an endfile. We have been including this in libgcc, which means that we have to append -lgcc even when using shared libgcc. In preparation for revision of libgcc split this into an endfile. gcc/ 2019-06-25 Iain Sandoe * config/rs6000/darwin.h (ENDFILE_SPEC): New. libgcc/ 2019-06-25 Iain Sandoe * config.host: Add libef_ppc.a to the extra files for powerpc-darwin. * config/rs6000/t-darwin: (PPC_ENDFILE_SRC, PPC_ENDFILE_OBJS): New. Build objects for the out of line save/restore register functions so that they can be used for any supported Darwin version. * config/t-darwin: Default the build Darwin version to Darwin8 (MacOS 10.4). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@272659 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++- gcc/config/rs6000/darwin.h | 5 +++++ libgcc/ChangeLog | 9 ++++++++ libgcc/config/rs6000/t-darwin | 42 ++++++++++++++++++++++++++++------- libgcc/config/t-darwin | 2 +- 5 files changed, 54 insertions(+), 10 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7dfd12dc4268..9d8d109ca0fe 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,8 @@ -2019-06-24 Bill Seurer +2019-06-25 Iain Sandoe + + * config/rs6000/darwin.h (ENDFILE_SPEC): New. + +2019-06-25 Bill Seurer * config/rs6000/rs6000.c (stack_info, rs6000_pic_labelno, savres_routine_syms, savres_routine_name, morestack_ref, diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h index 705dd7fdd945..fcc4354b2d0b 100644 --- a/gcc/config/rs6000/darwin.h +++ b/gcc/config/rs6000/darwin.h @@ -132,6 +132,11 @@ extern int darwin_emit_picsym_stub; #define DARWIN_CRT2_SPEC \ "%{!m64:%:version-compare(!> 10.4 mmacosx-version-min= crt2.o%s)}" +/* The PPC regs save/restore functions are leaves and could, conceivably + be used by the tm destructor. */ +#undef ENDFILE_SPEC +#define ENDFILE_SPEC TM_DESTRUCTOR "-lef_ppc" + #undef SUBTARGET_EXTRA_SPECS #define SUBTARGET_EXTRA_SPECS \ DARWIN_EXTRA_SPECS \ diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index a5896155bb49..a6e8c202b9d6 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,12 @@ +2019-06-25 Iain Sandoe + + * config.host: Add libef_ppc.a to the extra files for powerpc-darwin. + * config/rs6000/t-darwin: (PPC_ENDFILE_SRC, PPC_ENDFILE_OBJS): New. + Build objects for the out of line save/restore register functions + so that they can be used for any supported Darwin version. + * config/t-darwin: Default the build Darwin version to Darwin8 + (MacOS 10.4). + 2019-06-25 Martin Liska * libgcov-driver-system.c (replace_filename_variables): Do not diff --git a/libgcc/config/rs6000/t-darwin b/libgcc/config/rs6000/t-darwin index 61da0bdf13a7..0c238b7a7e83 100644 --- a/libgcc/config/rs6000/t-darwin +++ b/libgcc/config/rs6000/t-darwin @@ -3,23 +3,49 @@ DARWIN_EXTRA_CRT_BUILD_CFLAGS = -mlongcall -mmacosx-version-min=10.4 crt2.o: $(srcdir)/config/rs6000/darwin-crt2.c $(crt_compile) $(DARWIN_EXTRA_CRT_BUILD_CFLAGS) -c $< +# The outlined register save/restore functions need to run anywhere, and +# they must be leaf functions suitable for use in an endfile. + +PPC_ENDFILE_SRC = \ + $(srcdir)/config/rs6000/darwin-gpsave.S \ + $(srcdir)/config/rs6000/darwin-fpsave.S \ + $(srcdir)/config/rs6000/darwin-vecsave.S + +PPC_ENDFILE_OBJS = \ + darwin-gpsave.o \ + darwin-fpsave.o \ + darwin-vecsave.o + +darwin-gpsave.o: $(srcdir)/config/rs6000/darwin-gpsave.S + $(crt_compile) -mmacosx-version-min=10.1 -c $< + +darwin-fpsave.o: $(srcdir)/config/rs6000/darwin-fpsave.S + $(crt_compile) -mmacosx-version-min=10.1 -c $< + +darwin-vecsave.o: $(srcdir)/config/rs6000/darwin-vecsave.S + $(crt_compile) -mmacosx-version-min=10.1 -c $< + +# We build these into a library, so that they are only linked as needed and not +# forced into every object. + +libef_ppc.a: $(PPC_ENDFILE_OBJS) + $(AR_CREATE_FOR_TARGET) $@ $(PPC_ENDFILE_OBJS) + $(RANLIB_FOR_TARGET) $@ + LIB2ADD = $(srcdir)/config/rs6000/darwin-tramp.S \ $(srcdir)/config/darwin-64.c \ - $(srcdir)/config/rs6000/darwin-fpsave.S \ - $(srcdir)/config/rs6000/darwin-gpsave.S \ $(srcdir)/config/rs6000/darwin-world.S \ $(srcdir)/config/rs6000/ppc64-fp.c -LIB2ADD_ST = \ - $(srcdir)/config/rs6000/darwin-vecsave.S - # The .S files above are designed to run on all processors, even though # they use AltiVec instructions. # -Wa is used because -force_cpusubtype_ALL doesn't work with -dynamiclib. -# -mmacosx-version-min=10.4 is used to provide compatibility for code from -# earlier OSX versions. -HOST_LIBGCC2_CFLAGS += -Wa,-force_cpusubtype_ALL -mmacosx-version-min=10.4 +HOST_LIBGCC2_CFLAGS += -Wa,-force_cpusubtype_ALL + +# Although the default for 10.4 is G3, we need the unwinder to be built +# with vector support so that the "save/rest_world" outlined functions are +# correctly invoked. unwind-dw2_s.o: HOST_LIBGCC2_CFLAGS += -maltivec unwind-dw2.o: HOST_LIBGCC2_CFLAGS += -maltivec diff --git a/libgcc/config/t-darwin b/libgcc/config/t-darwin index 8340ea2bfe4b..2fcb712a0602 100644 --- a/libgcc/config/t-darwin +++ b/libgcc/config/t-darwin @@ -1,6 +1,6 @@ # Set this as a minimum (unless overriden by arch t-files) since it's a # reasonable lowest common denominator that works for all our archs. -HOST_LIBGCC2_CFLAGS += -mmacosx-version-min=10.5 +HOST_LIBGCC2_CFLAGS += -mmacosx-version-min=10.4 crt3.o: $(srcdir)/config/darwin-crt3.c $(crt_compile) $(DARWIN_EXTRA_CRT_BUILD_CFLAGS) -c $< -- 2.39.2