]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Darwin: Suppress adding embedded rpaths for earlier OS versions.
authorIain Sandoe <iain@sandoe.co.uk>
Mon, 8 Jan 2024 17:00:18 +0000 (17:00 +0000)
committerIain Sandoe <iain@sandoe.co.uk>
Thu, 18 Jan 2024 14:22:16 +0000 (14:22 +0000)
When we have @rpath support by virtue of the OS version we're hosting on
we still need to omit those rpath entries when targeting < 10.5 (or the
linker will complain).  To do this we (maybe ab-)use a property of the
spec function expansion that a non-null return value can be used as the
true input to a second spec (whereas, unfortunately, we cannot pass specs
to the version function at present).

gcc/ChangeLog:

* config/darwin.h (DARWIN_RPATH_SPEC): Arrange for the %P spec
to be conditional on macosx-version-min.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/config/darwin.h

index e94a29c639cbde5c9599b06c18cc2c0f627d53a4..cb96d67b3b1bf58fc27ee74af0c2f25db0004fc2 100644 (file)
@@ -612,8 +612,7 @@ extern GTY(()) int darwin_ms_struct;
    director as one being loaded.  */
 #define DARWIN_RPATH_SPEC \
   "%:version-compare(>= 10.5 mmacosx-version-min= -rpath) \
-   %:version-compare(>= 10.5 mmacosx-version-min= @loader_path) \
-   %P "
+   %{%:version-compare(>= 10.5 mmacosx-version-min= @loader_path): %P }"
 #else
 #define DARWIN_RPATH_SPEC ""
 #endif