From 7963de4327888ab4ea205271b1421c4372a65c72 Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Mon, 29 Mar 2021 08:53:09 +0100
Subject: [PATCH] Darwin, Ada : Add loader path as a default rpath.

Signed-off-by: Kirill A. Korinsky <kirill@korins.ky>
---
 gcc/ada/gcc-interface/Makefile.in | 2 ++
 1 file changed, 2 insertions(+)

diff --git gcc/ada/gcc-interface/Makefile.in gcc/ada/gcc-interface/Makefile.in
index fd676b269ad..c92abccf1c7 100644
--- gcc/ada/gcc-interface/Makefile.in
+++ gcc/ada/gcc-interface/Makefile.in
@@ -788,6 +788,7 @@ gnatlib-shared-darwin:
 		$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
 		$(SO_OPTS) \
 		-Wl,-install_name,@rpath/libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
+		-Wl,-rpath,@loader_path \
 		$(MISCLIB)
 	cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \
                 | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -dynamiclib $(PICFLAG_FOR_TARGET) \
@@ -795,6 +796,7 @@ gnatlib-shared-darwin:
 		$(GNATRTL_TASKING_OBJS) \
 		$(SO_OPTS) \
 		-Wl,-install_name,@rpath/libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
+		-Wl,-rpath,@loader_path \
 		$(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)
 	cd $(RTSDIR); $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
 		libgnat$(soext)
-- 
2.42.1

