From 032b5da1fc781bd3c23d9caa72fb09439e7f6f3a Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Thu, 13 Jul 2023 07:36:51 +0100 Subject: [PATCH] Darwin: Use -platform_version when available [PR110624]. Later versions of the static linker support a more flexible flag to describe the OS, OS version and SDK used to build the code. This replaces the functionality of '-mmacosx_version_min' (which is now deprecated, leading to the diagnostic described in the PR). We now use the platform_version flag when available which avoids the diagnostic. Signed-off-by: Iain Sandoe PR target/110624 gcc/ChangeLog: * config/darwin.h (DARWIN_PLATFORM_ID): New. (LINK_COMMAND_A): Use DARWIN_PLATFORM_ID to pass OS, OS version and SDK data to the static linker. --- gcc/config/darwin.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index 714d3d5cc0d1..1b538c73593a 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -276,6 +276,14 @@ extern GTY(()) int darwin_ms_struct; #define DARWIN_RDYNAMIC "%{rdynamic:%nrdynamic is not supported}" #endif +#if LD64_HAS_PLATFORM_VERSION +#define DARWIN_PLATFORM_ID \ + "%{mmacosx-version-min=*: -platform_version macos %* 0.0} " +#else +#define DARWIN_PLATFORM_ID \ + "%{mmacosx-version-min=*:-macosx_version_min %*} " +#endif + /* Code built with mdynamic-no-pic does not support PIE/PIC, so we disallow these combinations; we also ensure that the no_pie option is passed to ld64 on system versions that default to PIE when mdynamic-no-pic is given. @@ -351,7 +359,9 @@ extern GTY(()) int darwin_ms_struct; LINK_PLUGIN_SPEC \ "%{flto*:%