Since Xcode 15 beta 6, ld -v output differs from previous versions:

* macOS 13/Xcode 14:

  @(#)PROGRAM:ld  PROJECT:ld64-857.1

* macOS 14/Xcode 15:

  @(#)PROGRAM:ld  PROJECT:dyld-1015.1

configure cannot handle the new form, so LD64_VERSION isn't set.

This patch fixes this.  The autoconf manual states that sed doesn't
portably support alternation, so I'm using two separate expressions to
extract the version number.

Tested on x86_64-apple-darwin23.0.0.

Ok for trunk?


Note however that the new ld isn't yet usable to build gcc: for a
trivial testcase which amounts to

ld -dynamic -o conftest conftest.o libstdc++.a -lSystem -no_compact_unwind

it dies with an assertion failure.  I've filed a bug for this issue:

ld assertion failure in ld::AtomPlacement::findAtom (FB12978804)

Instead there's ld-classic which still works as usual.

        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2023-08-16  Rainer Orth  <r...@cebitec.uni-bielefeld.de>

        gcc:
        * configure.ac (gcc_cv_ld64_version): Allow for dyld in ld -v
        output.
        * configure: Regenerate.

# HG changeset patch
# Parent  97d64120b89e921db84ade7f8c75d9e18072d768
build: Allow for Xcode 15 ld -v output

diff --git a/gcc/configure.ac b/gcc/configure.ac
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -6263,7 +6263,8 @@ if test x"$ld64_flag" = x"yes"; then
     # If the version was not specified, try to find it.
     AC_MSG_CHECKING(linker version)
     if test x"${gcc_cv_ld64_version}" = x; then
-      gcc_cv_ld64_version=`$gcc_cv_ld -v 2>&1 | grep ld64 | sed s/.*ld64-// | awk '{print $1}'`
+      gcc_cv_ld64_version=`$gcc_cv_ld -v 2>&1 | $EGREP 'ld64|dyld' \
+      | sed -e 's/.*ld64-//' -e 's/.*dyld-//'| awk '{print $1}'`
     fi
     AC_MSG_RESULT($gcc_cv_ld64_version)
 

Reply via email to