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.
This commit is contained in:
Iain Sandoe 2021-11-12 17:03:09 +00:00
parent bd5159bdd4
commit d3cc82dc9c
3 changed files with 41 additions and 2 deletions

View File

@ -2226,6 +2226,12 @@
#endif #endif
/* Define to 1 if ld64 supports '-platform_version'. */
#ifndef USED_FOR_TARGET
#undef LD64_HAS_PLATFORM_VERSION
#endif
/* Define to ld64 version. */ /* Define to ld64 version. */
#ifndef USED_FOR_TARGET #ifndef USED_FOR_TARGET
#undef LD64_VERSION #undef LD64_VERSION

21
gcc/configure vendored
View File

@ -30398,6 +30398,7 @@ if test x"$ld64_flag" = x"yes"; then
# Set defaults for possibly untestable items. # Set defaults for possibly untestable items.
gcc_cv_ld64_export_dynamic=0 gcc_cv_ld64_export_dynamic=0
gcc_cv_ld64_platform_version=0
if test "$build" = "$host"; then if test "$build" = "$host"; then
darwin_try_test=1 darwin_try_test=1
@ -30421,9 +30422,12 @@ $as_echo_n "checking ld64 specified version... " >&6; }
gcc_cv_ld64_major=`echo "$gcc_cv_ld64_version" | sed -e 's/\..*//'` 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 "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_ld64_major" >&5
$as_echo "$gcc_cv_ld64_major" >&6; } $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 gcc_cv_ld64_export_dynamic=1
fi 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 elif test -x "$gcc_cv_ld" -a "$darwin_try_test" -eq 1; then
# If the version was not specified, try to find it. # If the version was not specified, try to find it.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking linker version" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker version" >&5
@ -30442,6 +30446,15 @@ $as_echo_n "checking linker for -export_dynamic support... " >&6; }
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_ld64_export_dynamic" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_ld64_export_dynamic" >&5
$as_echo "$gcc_cv_ld64_export_dynamic" >&6; } $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 fi
if test x"${gcc_cv_ld64_version}" != x; then if test x"${gcc_cv_ld64_version}" != x; then
@ -30457,6 +30470,12 @@ cat >>confdefs.h <<_ACEOF
#define LD64_HAS_EXPORT_DYNAMIC $gcc_cv_ld64_export_dynamic #define LD64_HAS_EXPORT_DYNAMIC $gcc_cv_ld64_export_dynamic
_ACEOF _ACEOF
cat >>confdefs.h <<_ACEOF
#define LD64_HAS_PLATFORM_VERSION $gcc_cv_ld64_platform_version
_ACEOF
fi fi
if test x"$dsymutil_flag" = x"yes"; then if test x"$dsymutil_flag" = x"yes"; then

View File

@ -6253,6 +6253,7 @@ if test x"$ld64_flag" = x"yes"; then
# Set defaults for possibly untestable items. # Set defaults for possibly untestable items.
gcc_cv_ld64_export_dynamic=0 gcc_cv_ld64_export_dynamic=0
gcc_cv_ld64_platform_version=0
if test "$build" = "$host"; then if test "$build" = "$host"; then
darwin_try_test=1 darwin_try_test=1
@ -6274,9 +6275,12 @@ if test x"$ld64_flag" = x"yes"; then
AC_MSG_CHECKING(ld64 specified version) AC_MSG_CHECKING(ld64 specified version)
gcc_cv_ld64_major=`echo "$gcc_cv_ld64_version" | sed -e 's/\..*//'` gcc_cv_ld64_major=`echo "$gcc_cv_ld64_version" | sed -e 's/\..*//'`
AC_MSG_RESULT($gcc_cv_ld64_major) 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 gcc_cv_ld64_export_dynamic=1
fi 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 elif test -x "$gcc_cv_ld" -a "$darwin_try_test" -eq 1; then
# If the version was not specified, try to find it. # If the version was not specified, try to find it.
AC_MSG_CHECKING(linker version) AC_MSG_CHECKING(linker version)
@ -6291,6 +6295,13 @@ if test x"$ld64_flag" = x"yes"; then
gcc_cv_ld64_export_dynamic=0 gcc_cv_ld64_export_dynamic=0
fi fi
AC_MSG_RESULT($gcc_cv_ld64_export_dynamic) 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 fi
if test x"${gcc_cv_ld64_version}" != x; then if test x"${gcc_cv_ld64_version}" != x; then
@ -6300,6 +6311,9 @@ if test x"$ld64_flag" = x"yes"; then
AC_DEFINE_UNQUOTED(LD64_HAS_EXPORT_DYNAMIC, $gcc_cv_ld64_export_dynamic, AC_DEFINE_UNQUOTED(LD64_HAS_EXPORT_DYNAMIC, $gcc_cv_ld64_export_dynamic,
[Define to 1 if ld64 supports '-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 fi
if test x"$dsymutil_flag" = x"yes"; then if test x"$dsymutil_flag" = x"yes"; then