aboutsummaryrefslogtreecommitdiff
path: root/gcc/configure.ac
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2020-12-13 17:21:16 +0000
committerIain Sandoe <iain@sandoe.co.uk>2021-07-05 20:40:45 +0100
commit3b5e8ee4f1ecc6d407f391695f65960bcbd63cff (patch)
tree56c6da96a8fef14fde6e9e57f9d06ae33c8b2e58 /gcc/configure.ac
parentbe8749f939a933bca6de19d9cf1a510d5954c2fa (diff)
downloadgcc-3b5e8ee4f1ecc6d407f391695f65960bcbd63cff.zip
gcc-3b5e8ee4f1ecc6d407f391695f65960bcbd63cff.tar.gz
gcc-3b5e8ee4f1ecc6d407f391695f65960bcbd63cff.tar.bz2
Darwin, configury : Allow for specification and detection of dsymutil.
In order to enable DWARF versions > 2 we need a sufficiently modern version of dsymutil (in addition to the assembler / linker). This allows the user to configure a different path from the installed one. In addition, there are several sources of dsymutil so we differentiate these in order to be get accurate version information. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> gcc/ChangeLog: * configure.ac: Handle --with-dsymutil in the same way as we do for the assembler and linker. (DEFAULT_DSYMUTIL): New. Extract the type and version for the dsymutil configured or found by the default searches. * config.in: Regenerated. * configure: Regenerated. * collect2.c (do_dsymutil): Handle locating dsymutil in the same way as for the assembler and linker. * config/darwin.h (DSYMUTIL): Delete. * gcc.c: Report a configured dsymutil correctly. * exec-tool.in: Allow for dsymutil. ChangeLog: * Makefile.def: Add dsymutil defs. * Makefile.in: Regenerated. * Makefile.tpl: Add dsymutil to flags. * configure: Regenerated. * configure.ac: Add dsymutil to target and build recipes.
Diffstat (limited to 'gcc/configure.ac')
-rw-r--r--gcc/configure.ac96
1 files changed, 94 insertions, 2 deletions
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 7008939..26da073 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -316,8 +316,14 @@ gnu_ld_flag="$with_gnu_ld",
gnu_ld_flag=no)
case $target in
- *darwin*) ld64_flag=yes;; # Darwin can only use a ld64-compatible linker.
- *) ld64_flag=no;;
+ *darwin*)
+ ld64_flag=yes # Darwin can only use a ld64-compatible linker.
+ dsymutil_flag=yes # Darwin uses dsymutil to link debug.
+ ;;
+ *)
+ ld64_flag=no
+ dsymutil_flag=no
+ ;;
esac
# With pre-defined ld
@@ -353,6 +359,31 @@ AC_ARG_WITH(demangler-in-ld,
demangler_in_ld="$with_demangler_in_ld",
demangler_in_ld=yes)
+# Allow the user to specify a dsymutil executable (used on Darwin only, so far)
+AC_ARG_WITH(dsymutil,
+[AS_HELP_STRING([--with-dsymutil], [arrange to use the specified dsymutil (full pathname)])],
+DEFAULT_DSYMUTIL="$with_dsymutil")
+
+dsymutil_vers=
+if test x"${DEFAULT_DSYMUTIL+set}" = x"set"; then
+ if test ! -x "$DEFAULT_DSYMUTIL"; then
+ AC_MSG_ERROR([cannot execute: $DEFAULT_DSYMUTIL: check --with-dsymutil or env. var. DEFAULT_DSYMUTIL])
+ else
+ if dsymutil_vers=`$DEFAULT_DSYMUTIL -v /dev/null 2>&1`; then
+ dsymutil_flag=yes
+ fi
+ fi
+ AC_DEFINE_UNQUOTED(DEFAULT_DSYMUTIL,"$DEFAULT_DSYMUTIL",
+ [Define to enable the use of a default debug linker.])
+fi
+
+AC_MSG_CHECKING([whether a default dsymutil was specified])
+if test x"${DEFAULT_DSYMUTIL+set}" = x"set"; then
+ AC_MSG_RESULT([yes ($DEFAULT_DSYMUTIL)])
+else
+ AC_MSG_RESULT(no)
+fi
+
# ----------------------
# Find default assembler
# ----------------------
@@ -2852,6 +2883,27 @@ else
AC_MSG_RESULT($gcc_cv_otool)
fi
+# Figure out the dsymutil we will use.
+AS_VAR_SET_IF(gcc_cv_dsymutil,, [
+if test -x "$DEFAULT_DSYMUTIL"; then
+ gcc_cv_dsymutil="$DEFAULT_DSYMUTIL"
+elif test -x dsymutil$build_exeext; then
+ gcc_cv_dsymutil=./dsymutil$build_exeext
+elif ( set dummy $DSYMUTIL_FOR_TARGET; test -x $[2] ); then
+ gcc_cv_dsymutil=$DSYMUTIL_FOR_TARGET
+elif ( set dummy $DSYMUTIL; test -x $[2] ); then
+ gcc_cv_dsymutil=$DSYMUTIL
+else
+ AC_PATH_PROG(gcc_cv_dsymutil, $DSYMUTIL_FOR_TARGET)
+fi])
+
+ORIGINAL_DSYMUTIL_FOR_TARGET=$gcc_cv_dsymutil
+AC_SUBST(ORIGINAL_DSYMUTIL_FOR_TARGET)
+case "$ORIGINAL_DSYMUTIL_FOR_TARGET" in
+ ./dsymutil | ./dsymutil$build_exeext) ;;
+ *) AC_CONFIG_FILES(dsymutil:exec-tool.in, [chmod +x dsymutil]) ;;
+esac
+
# Figure out what assembler alignment features are present.
gcc_GAS_CHECK_FEATURE([.balign and .p2align], gcc_cv_as_balign_and_p2align,
[2,6,0],,
@@ -6240,6 +6292,46 @@ if test x"$ld64_flag" = x"yes"; then
[Define to 1 if ld64 supports '-export_dynamic'.])
fi
+if test x"$dsymutil_flag" = x"yes"; then
+
+ # If the user specified a dsymutil path, then we will already have the
+ # version string, otherwise, pick it up.
+ if test x"$gcc_cv_dsymutil" = x; then
+ AC_MSG_WARN([dsymutil is a required tool for this system, but not found])
+ dsymutil_vers="tool unspecified"
+ elif test x"$dsymutil_vers" = x; then
+ dsymutil_vers=`$gcc_cv_dsymutil -v /dev/null 2>&1`
+ fi
+
+ dsymutil_temp=`echo $dsymutil_vers | sed 1q`
+ AC_MSG_CHECKING(dsymutil version "$dsymutil_temp")
+ if echo $dsymutil_temp | grep dwarfutils- > /dev/null; then
+ dsymutil_kind=DWARFUTILS
+ dsymutil_vers=`echo $dsymutil_temp | sed 's/.*dwarfutils-\([[0-9\.]]*\).*/\1/'`
+ elif echo $dsymutil_temp | grep clang- > /dev/null; then
+ dsymutil_kind=CLANG
+ dsymutil_vers=`echo $dsymutil_temp | sed 's/.*clang-\([[0-9\.]]*\).*/\1/'`
+ elif echo $dsymutil_temp | grep 'LLVM version ' > /dev/null; then
+ dsymutil_kind=LLVM
+ dsymutil_vers=`echo $dsymutil_temp | sed 's/.*LLVM\ version\ \([[0-9\.]]*\).*/\1/'`
+ else
+ dsymutil_kind=UNKNOWN
+ dsymutil_vers="0.0"
+ fi
+ dsymutil_major=`expr "$dsymutil_vers" : '\([[0-9]]*\)'`
+ dsymutil_minor=`expr "$dsymutil_vers" : '[[0-9]]*\.\([[0-9]]*\)'`
+ dsymutil_tiny=`expr "$dsymutil_vers" : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
+ if test x"${dsymutil_minor}" = x; then
+ dsymutil_minor=0
+ fi
+ if test x"${dsymutil_tiny}" = x; then
+ dsymutil_tiny=0
+ fi
+ AC_DEFINE_UNQUOTED(DSYMUTIL_VERSION, [$dsymutil_kind,${dsymutil_major},${dsymutil_minor},${dsymutil_tiny}],
+ [Define to the dsymutil version.])
+ AC_MSG_RESULT($dsymutil_vers : $dsymutil_kind ${dsymutil_major} ${dsymutil_minor} ${dsymutil_tiny} )
+fi
+
case $target_os in
win32 | pe | cygwin* | mingw32*)
AC_MSG_CHECKING(broken PE linker dwarf5 support)