Darwin: Search for both shared and convenience libraries in each path. (#761)
authorIain Sandoe <iain@sandoe.co.uk>
Thu, 2 Feb 2023 11:42:46 +0000 (11:42 +0000)
committerGitHub <noreply@github.com>
Thu, 2 Feb 2023 11:42:46 +0000 (06:42 -0500)
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.

testsuite/lib/libffi.exp

index 7457af415f3d04fc14a33ef8a44ad7b469ff15c5..17d1ed595a9dcc30406d74b8dd78d00a0fd4dd52 100644 (file)
@@ -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