[gcc r11-11343] configure, Darwin: Check ld64 support for -platform-version.
Iain D Sandoe
iains@gcc.gnu.org
Tue Apr 23 14:12:46 GMT 2024
https://gcc.gnu.org/g:4b263d5d06494774bc72f85b1206e1dc2c8fbd15
commit r11-11343-g4b263d5d06494774bc72f85b1206e1dc2c8fbd15
Author: Iain Sandoe <iain@sandoe.co.uk>
Date: Fri Nov 12 17:03:09 2021 +0000
configure, Darwin: Check ld64 support for -platform-version.
Newer versions of ld64 allow specifiying the OS target (e.g.
macos or ios) the version and the SDK version all in a single
command. This checks the availability of the command for the
current toolchain.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:
* config.in: Regenerate.
* configure: Regenerate.
* configure.ac: Test ld64 for -platform-version support.
(cherry picked from commit d3cc82dc9cc2d4f1021fc5d4c1463c3a14fc6795)
Diff:
---
gcc/config.in | 6 ++++++
gcc/configure | 21 ++++++++++++++++++++-
gcc/configure.ac | 16 +++++++++++++++-
3 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/gcc/config.in b/gcc/config.in
index 048bf52e8c2..982c453ca36 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -2207,6 +2207,12 @@
#endif
+/* Define to 1 if ld64 supports '-platform_version'. */
+#ifndef USED_FOR_TARGET
+#undef LD64_HAS_PLATFORM_VERSION
+#endif
+
+
/* Define to ld64 version. */
#ifndef USED_FOR_TARGET
#undef LD64_VERSION
diff --git a/gcc/configure b/gcc/configure
index 3a9d5e269d1..0b9c7451231 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -30698,6 +30698,7 @@ if test x"$ld64_flag" = x"yes"; then
# Set defaults for possibly untestable items.
gcc_cv_ld64_export_dynamic=0
+ gcc_cv_ld64_platform_version=0
if test "$build" = "$host"; then
darwin_try_test=1
@@ -30721,9 +30722,12 @@ $as_echo_n "checking ld64 specified version... " >&6; }
gcc_cv_ld64_major=`echo "$gcc_cv_ld64_version" | sed -e 's/\..*//'`
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_ld64_major" >&5
$as_echo "$gcc_cv_ld64_major" >&6; }
- if test "$gcc_cv_ld64_major" -ge 236; then
+ if test "$gcc_cv_ld64_major" -ge 236; then
gcc_cv_ld64_export_dynamic=1
fi
+ if test "$gcc_cv_ld64_major" -ge 512; then
+ gcc_cv_ld64_platform_version=1
+ fi
elif test -x "$gcc_cv_ld" -a "$darwin_try_test" -eq 1; then
# If the version was not specified, try to find it.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking linker version" >&5
@@ -30742,6 +30746,15 @@ $as_echo_n "checking linker for -export_dynamic support... " >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_ld64_export_dynamic" >&5
$as_echo "$gcc_cv_ld64_export_dynamic" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker for -platform_version support" >&5
+$as_echo_n "checking linker for -platform_version support... " >&6; }
+ gcc_cv_ld64_platform_version=1
+ if $gcc_cv_ld -platform_version macos 10.5 0.0 < /dev/null 2>&1 | grep 'unknown option' > /dev/null; then
+ gcc_cv_ld64_platform_version=0
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_ld64_platform_version" >&5
+$as_echo "$gcc_cv_ld64_platform_version" >&6; }
fi
if test x"${gcc_cv_ld64_version}" != x; then
@@ -30757,6 +30770,12 @@ cat >>confdefs.h <<_ACEOF
#define LD64_HAS_EXPORT_DYNAMIC $gcc_cv_ld64_export_dynamic
_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define LD64_HAS_PLATFORM_VERSION $gcc_cv_ld64_platform_version
+_ACEOF
+
fi
if test x"$dsymutil_flag" = x"yes"; then
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 1e54494c535..2bf0e8a12b7 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -6351,6 +6351,7 @@ if test x"$ld64_flag" = x"yes"; then
# Set defaults for possibly untestable items.
gcc_cv_ld64_export_dynamic=0
+ gcc_cv_ld64_platform_version=0
if test "$build" = "$host"; then
darwin_try_test=1
@@ -6372,9 +6373,12 @@ if test x"$ld64_flag" = x"yes"; then
AC_MSG_CHECKING(ld64 specified version)
gcc_cv_ld64_major=`echo "$gcc_cv_ld64_version" | sed -e 's/\..*//'`
AC_MSG_RESULT($gcc_cv_ld64_major)
- if test "$gcc_cv_ld64_major" -ge 236; then
+ if test "$gcc_cv_ld64_major" -ge 236; then
gcc_cv_ld64_export_dynamic=1
fi
+ if test "$gcc_cv_ld64_major" -ge 512; then
+ gcc_cv_ld64_platform_version=1
+ fi
elif test -x "$gcc_cv_ld" -a "$darwin_try_test" -eq 1; then
# If the version was not specified, try to find it.
AC_MSG_CHECKING(linker version)
@@ -6389,6 +6393,13 @@ if test x"$ld64_flag" = x"yes"; then
gcc_cv_ld64_export_dynamic=0
fi
AC_MSG_RESULT($gcc_cv_ld64_export_dynamic)
+
+ AC_MSG_CHECKING(linker for -platform_version support)
+ gcc_cv_ld64_platform_version=1
+ if $gcc_cv_ld -platform_version macos 10.5 0.0 < /dev/null 2>&1 | grep 'unknown option' > /dev/null; then
+ gcc_cv_ld64_platform_version=0
+ fi
+ AC_MSG_RESULT($gcc_cv_ld64_platform_version)
fi
if test x"${gcc_cv_ld64_version}" != x; then
@@ -6398,6 +6409,9 @@ if test x"$ld64_flag" = x"yes"; then
AC_DEFINE_UNQUOTED(LD64_HAS_EXPORT_DYNAMIC, $gcc_cv_ld64_export_dynamic,
[Define to 1 if ld64 supports '-export_dynamic'.])
+
+ AC_DEFINE_UNQUOTED(LD64_HAS_PLATFORM_VERSION, $gcc_cv_ld64_platform_version,
+ [Define to 1 if ld64 supports '-platform_version'.])
fi
if test x"$dsymutil_flag" = x"yes"; then
More information about the Gcc-cvs
mailing list