Commit 7effe99955b228ae828d06fa8d07dc546ef67b1a

Iain Sandoe 2023-02-02T11:42:46

Darwin: Search for both shared and convenience libraries in each path. (#761) For several Darwin linker versions, the default behaviour is to first traverse the set of library paths, looking for shared libraries, and then a second time looking for archives. This means that if the library is configured --disable-shared the installed system version /usr/lib/libffi.dylib will be found before the archive under test. Using the linker option '-search-paths-first' alters the strategy to search each path for dylib and then archive before moving on to the next.

1
2
3
4
5
6
7
8
9
10
11
12
diff --git a/testsuite/lib/libffi.exp b/testsuite/lib/libffi.exp
index 7457af4..17d1ed5 100644
--- a/testsuite/lib/libffi.exp
+++ b/testsuite/lib/libffi.exp
@@ -380,6 +380,7 @@ proc libffi_target_compile { source dest type options } {
 	 || [istarget "*-*-darwin2*"] } {
 	# lappend options "additional_flags=-Wl,-allow_stack_execute"
         lappend options "additional_flags=-Wno-unused-command-line-argument"
+        lappend options "additional_flags=-Wl,-search_paths_first"
     }
 
     # If you're building the compiler with --prefix set to a place