From 2e1ecf54f22bb44a6ab898abb76ad44760d5045c Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Fri, 28 Aug 2020 19:09:45 +0100 Subject: [PATCH] Darwin, Arm64 : Ada fixes for hosted tools. The existing provisions for iOS would be OK for cross-compilation but we need some adjustments so that hosted tools can be built for the platform. (cherry picked from commit dc6ab7b6a685a965f57ee828cae21c1f8a47ee53) Signed-off-by: Kirill A. Korinsky --- gcc/ada/gcc-interface/Make-lang.in | 16 ++++++++++++---- gcc/ada/sigtramp-ios.c | 8 ++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git gcc/ada/gcc-interface/Make-lang.in gcc/ada/gcc-interface/Make-lang.in index acbe2b877ca..9ca91576e9a 100644 --- gcc/ada/gcc-interface/Make-lang.in +++ gcc/ada/gcc-interface/Make-lang.in @@ -655,6 +655,14 @@ endif # For unwind-pe.h CFLAGS-ada/raise-gcc.o += -I$(srcdir)/../libgcc -DEH_MECHANISM_$(EH_MECHANISM) +# Under aarch64 darwin, we need to include the rtl signal trampoline. + +ifeq ($(strip $(filter-out aarch64 arm64 darwin%,$(host_cpu) $(host_os))),) + EXTRA_HOST_OBJS=ada/sigtramp-ios.o +else + EXTRA_HOST_OBJS = +endif + ada/libgnat/s-excmac.o: ada/libgnat/s-excmac.ads ada/libgnat/s-excmac.adb ada/libgnat/s-excmac.ads: $(srcdir)/ada/libgnat/s-excmac__$(EH_MECHANISM).ads @@ -668,13 +676,13 @@ ada/libgnat/s-excmac.adb: $(srcdir)/ada/libgnat/s-excmac__$(EH_MECHANISM).adb # Needs to be built with CC=gcc # Since the RTL should be built with the latest compiler, remove the # stamp target in the parent directory whenever gnat1 is rebuilt -gnat1$(exeext): $(TARGET_ADA_SRCS) $(GNAT1_OBJS) $(ADA_BACKEND) libcommon-target.a $(LIBDEPS) - +$(GCC_LLINK) -o $@ $(GNAT1_OBJS) $(ADA_BACKEND) \ +gnat1$(exeext): $(TARGET_ADA_SRCS) $(GNAT1_OBJS) $(ADA_BACKEND) libcommon-target.a $(LIBDEPS) $(EXTRA_HOST_OBJS) + +$(GCC_LLINK) -o $@ $(GNAT1_OBJS) $(ADA_BACKEND) $(EXTRA_HOST_OBJS) \ libcommon-target.a $(LIBS) $(SYSLIBS) $(BACKENDLIBS) $(CFLAGS) $(RM) stamp-gnatlib2-rts stamp-tools -gnatbind$(exeext): ada/b_gnatb.o $(CONFIG_H) $(GNATBIND_OBJS) ggc-none.o libcommon-target.a $(LIBDEPS) - +$(GCC_LINK) -o $@ ada/b_gnatb.o $(GNATBIND_OBJS) ggc-none.o libcommon-target.a $(LIBS) $(SYSLIBS) $(CFLAGS) +gnatbind$(exeext): ada/b_gnatb.o $(CONFIG_H) $(GNATBIND_OBJS) $(EXTRA_HOST_OBJS) ggc-none.o libcommon-target.a $(LIBDEPS) + +$(GCC_LINK) -o $@ ada/b_gnatb.o $(GNATBIND_OBJS) $(EXTRA_HOST_OBJS) ggc-none.o libcommon-target.a $(LIBS) $(SYSLIBS) $(CFLAGS) # use target-gcc target-gnatmake target-gnatbind target-gnatlink gnattools: $(GCC_PARTS) $(CONFIG_H) prefix.o force diff --git gcc/ada/sigtramp-ios.c gcc/ada/sigtramp-ios.c index de04c1adb04..43276e9863f 100644 --- gcc/ada/sigtramp-ios.c +++ gcc/ada/sigtramp-ios.c @@ -71,6 +71,10 @@ /* sigtramp stub providing unwind info for common registers. */ +#if defined(__cplusplus) +extern "C" { +#endif + extern void __gnat_sigtramp_common (int signo, void *siginfo, void *sigcontext, __sigtramphandler_t * handler); @@ -87,6 +91,10 @@ void __gnat_sigtramp (int signo, void *si, void *ucontext, __gnat_sigtramp_common (signo, si, mcontext, handler); } +#if defined(__cplusplus) +} +#endif + /* asm string construction helpers. */ #define STR(TEXT) #TEXT -- 2.42.1