Skip to content

Commit f8a1e06

Browse files
committed
Darwin, aarch64 : Ada fixes for hosted tools.
This will allow someone (with an existing Ada compiler on the platform - which can be provided by the experimental aarch64-darwin branch) - to build the host tools (gnatmake and friends) for a non-native cross. The existing provisions for iOS are OK for cross-compilation from an x86-64-darwin platform, but we need some adjustments so that these host tools can be built to run on aarch64-darwin. Signed-off-by: Iain Sandoe <[email protected]> gcc/ada/ * gcc-interface/Make-lang.in: Use iOS signal trampoline code for hosted Ada tools. * sigtramp-ios.c: Wrap the declarations in extern "C" when the code is built by a C++ compiler.
1 parent 834c874 commit f8a1e06

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

gcc/ada/gcc-interface/Make-lang.in

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,14 @@ endif
725725
# For unwind-pe.h
726726
CFLAGS-ada/raise-gcc.o += -I$(srcdir)/../libgcc -DEH_MECHANISM_$(EH_MECHANISM)
727727

728+
# Under aarch64 darwin, we need to include the iOS signal trampoline.
729+
730+
ifeq ($(strip $(filter-out aarch64 arm64 darwin%,$(host_cpu) $(host_os))),)
731+
EXTRA_HOST_OBJS=ada/sigtramp-ios.o
732+
else
733+
EXTRA_HOST_OBJS =
734+
endif
735+
728736
ada/libgnat/s-excmac.o: ada/libgnat/s-excmac.ads ada/libgnat/s-excmac.adb
729737

730738
ada/libgnat/s-excmac.ads: $(srcdir)/ada/libgnat/s-excmac__$(EH_MECHANISM).ads
@@ -738,16 +746,16 @@ ada/libgnat/s-excmac.adb: $(srcdir)/ada/libgnat/s-excmac__$(EH_MECHANISM).adb
738746
# Needs to be built with CC=gcc
739747
# Since the RTL should be built with the latest compiler, remove the
740748
# stamp target in the parent directory whenever gnat1 is rebuilt
741-
gnat1$(exeext): $(TARGET_ADA_SRCS) $(GNAT1_OBJS) $(ADA_BACKEND) libcommon-target.a \
742-
$(LIBDEPS) $(ada.prev)
749+
gnat1$(exeext): $(TARGET_ADA_SRCS) $(GNAT1_OBJS) $(ADA_BACKEND) $(EXTRA_HOST_OBJS) libcommon-target.a \
750+
$(EXTRA_HOST_OBJS) $(LIBDEPS) $(ada.prev)
743751
@$(call LINK_PROGRESS,$(INDEX.ada),start)
744-
+$(GCC_LLINK) -o $@ $(GNAT1_OBJS) $(ADA_BACKEND) $(CFLAGS) \
752+
+$(GCC_LLINK) -o $@ $(GNAT1_OBJS) $(ADA_BACKEND) $(EXTRA_HOST_OBJS) $(CFLAGS) \
745753
libcommon-target.a $(LIBS) $(SYSLIBS) $(BACKENDLIBS) $(GNATLIB)
746754
$(RM) stamp-gnatlib2-rts stamp-tools
747755
@$(call LINK_PROGRESS,$(INDEX.ada),end)
748756

749-
gnatbind$(exeext): ada/b_gnatb.o $(CONFIG_H) $(GNATBIND_OBJS) ggc-none.o libcommon-target.a $(LIBDEPS)
750-
+$(GCC_LINK) -o $@ $(CFLAGS) ada/b_gnatb.o $(GNATBIND_OBJS) ggc-none.o libcommon-target.a $(LIBS) $(SYSLIBS) $(GNATLIB)
757+
gnatbind$(exeext): ada/b_gnatb.o $(CONFIG_H) $(GNATBIND_OBJS) $(EXTRA_HOST_OBJS) ggc-none.o libcommon-target.a $(LIBDEPS)
758+
+$(GCC_LINK) -o $@ $(CFLAGS) ada/b_gnatb.o $(GNATBIND_OBJS) $(EXTRA_HOST_OBJS) ggc-none.o libcommon-target.a $(LIBS) $(SYSLIBS) $(GNATLIB)
751759

752760
# use target-gcc target-gnatmake target-gnatbind target-gnatlink
753761
gnattools: $(GCC_PARTS) $(CONFIG_H) prefix.o force

gcc/ada/sigtramp-ios.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@
7171

7272
/* sigtramp stub providing unwind info for common registers. */
7373

74+
#if defined(__cplusplus)
75+
extern "C" {
76+
#endif
77+
7478
extern void __gnat_sigtramp_common
7579
(int signo, void *siginfo, void *sigcontext,
7680
__sigtramphandler_t * handler);
@@ -87,6 +91,10 @@ void __gnat_sigtramp (int signo, void *si, void *ucontext,
8791
__gnat_sigtramp_common (signo, si, mcontext, handler);
8892
}
8993

94+
#if defined(__cplusplus)
95+
}
96+
#endif
97+
9098
/* asm string construction helpers. */
9199

92100
#define STR(TEXT) #TEXT

0 commit comments

Comments
 (0)