From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1698) id EB4ED3858C53; Thu, 14 Apr 2022 05:20:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EB4ED3858C53 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Iain D Sandoe To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-9852] Darwin, configury : Allow for specification and detection of dsymutil. X-Act-Checkin: gcc X-Git-Author: Iain Sandoe X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: d744051777cc9fe5ea14b6f480e6eea6092c7b29 X-Git-Newrev: 10abab4127b41f59f293a45cfdf647855e7724d6 Message-Id: <20220414052034.EB4ED3858C53@sourceware.org> Date: Thu, 14 Apr 2022 05:20:34 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Apr 2022 05:20:35 -0000 https://gcc.gnu.org/g:10abab4127b41f59f293a45cfdf647855e7724d6 commit r11-9852-g10abab4127b41f59f293a45cfdf647855e7724d6 Author: Iain Sandoe Date: Sun Dec 13 17:21:16 2020 +0000 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. Backported from commits 3b5e8ee4f1ecc6d407f391695f65960bcbd63cff and b019b28ebd65462a092c96d95e9e356c8bb39b78 Signed-off-by: Iain Sandoe 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. * doc/install.texi: Document --with-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. Diff: --- Makefile.def | 1 + Makefile.in | 10 ++ Makefile.tpl | 9 ++ configure | 413 +++++++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 6 + gcc/collect2.c | 40 ++++- gcc/config.in | 12 ++ gcc/config/darwin.h | 2 - gcc/configure | 166 ++++++++++++++++++++- gcc/configure.ac | 96 +++++++++++- gcc/doc/install.texi | 4 + gcc/exec-tool.in | 8 + gcc/gcc.c | 5 + 13 files changed, 761 insertions(+), 11 deletions(-) diff --git a/Makefile.def b/Makefile.def index df8ccfb24c3..7c33a3b1e8c 100644 --- a/Makefile.def +++ b/Makefile.def @@ -292,6 +292,7 @@ flags_to_pass = { flag= CFLAGS_FOR_TARGET ; }; flags_to_pass = { flag= CPPFLAGS_FOR_TARGET ; }; flags_to_pass = { flag= CXXFLAGS_FOR_TARGET ; }; flags_to_pass = { flag= DLLTOOL_FOR_TARGET ; }; +flags_to_pass = { flag= DSYMUTIL_FOR_TARGET ; }; flags_to_pass = { flag= FLAGS_FOR_TARGET ; }; flags_to_pass = { flag= GFORTRAN_FOR_TARGET ; }; flags_to_pass = { flag= GOC_FOR_TARGET ; }; diff --git a/Makefile.in b/Makefile.in index 047be0255e2..0329a5d780b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -159,6 +159,7 @@ BUILD_EXPORTS = \ GDC="$(GDC_FOR_BUILD)"; export GDC; \ GDCFLAGS="$(GDCFLAGS_FOR_BUILD)"; export GDCFLAGS; \ DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \ + DSYMUTIL="$(DSYMUTIL_FOR_BUILD)"; export DSYMUTIL; \ LD="$(LD_FOR_BUILD)"; export LD; \ LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \ NM="$(NM_FOR_BUILD)"; export NM; \ @@ -200,6 +201,7 @@ HOST_EXPORTS = \ CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \ DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + DSYMUTIL="$(DSYMUTIL)"; export DSYMUTIL; \ LD="$(LD)"; export LD; \ LDFLAGS="$(STAGE1_LDFLAGS) $(LDFLAGS)"; export LDFLAGS; \ NM="$(NM)"; export NM; \ @@ -212,6 +214,7 @@ HOST_EXPORTS = \ READELF="$(READELF)"; export READELF; \ AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \ AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \ + DSYMUTIL_FOR_TARGET="$(DSYMUTIL_FOR_TARGET)"; export DSYMUTIL_FOR_TARGET; \ GCC_FOR_TARGET="$(GCC_FOR_TARGET)"; export GCC_FOR_TARGET; \ LD_FOR_TARGET="$(LD_FOR_TARGET)"; export LD_FOR_TARGET; \ NM_FOR_TARGET="$(NM_FOR_TARGET)"; export NM_FOR_TARGET; \ @@ -294,6 +297,7 @@ BASE_TARGET_EXPORTS = \ GOC="$(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GOC; \ GDC="$(GDC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GDC; \ DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ + DSYMUTIL="$(DSYMUTIL_FOR_TARGET)"; export DSYMUTIL; \ LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \ LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \ @@ -356,6 +360,7 @@ CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@ CXX_FOR_BUILD = @CXX_FOR_BUILD@ DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@ +DSYMUTIL_FOR_BUILD = @DSYMUTIL_FOR_BUILD@ GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@ GOC_FOR_BUILD = @GOC_FOR_BUILD@ GDC_FOR_BUILD = @GDC_FOR_BUILD@ @@ -406,6 +411,7 @@ AR_FLAGS = rc CC = @CC@ CXX = @CXX@ DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ LD = @LD@ LIPO = @LIPO@ NM = @NM@ @@ -596,6 +602,7 @@ GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ GOC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GOC_FOR_TARGET@ GDC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GDC_FOR_TARGET@ DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@ +DSYMUTIL_FOR_TARGET=@DSYMUTIL_FOR_TARGET@ LD_FOR_TARGET=@LD_FOR_TARGET@ LIPO_FOR_TARGET=@LIPO_FOR_TARGET@ @@ -814,6 +821,7 @@ BASE_FLAGS_TO_PASS = \ "CPPFLAGS_FOR_TARGET=$(CPPFLAGS_FOR_TARGET)" \ "CXXFLAGS_FOR_TARGET=$(CXXFLAGS_FOR_TARGET)" \ "DLLTOOL_FOR_TARGET=$(DLLTOOL_FOR_TARGET)" \ + "DSYMUTIL_FOR_TARGET=$(DSYMUTIL_FOR_TARGET)" \ "FLAGS_FOR_TARGET=$(FLAGS_FOR_TARGET)" \ "GFORTRAN_FOR_TARGET=$(GFORTRAN_FOR_TARGET)" \ "GOC_FOR_TARGET=$(GOC_FOR_TARGET)" \ @@ -889,6 +897,7 @@ EXTRA_HOST_FLAGS = \ 'CC=$(CC)' \ 'CXX=$(CXX)' \ 'DLLTOOL=$(DLLTOOL)' \ + 'DSYMUTIL=$(DSYMUTIL)' \ 'GFORTRAN=$(GFORTRAN)' \ 'GOC=$(GOC)' \ 'GDC=$(GDC)' \ @@ -947,6 +956,7 @@ EXTRA_TARGET_FLAGS = \ $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ 'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \ 'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \ + 'DSYMUTIL=$$(DSYMUTIL_FOR_TARGET)' \ 'GFORTRAN=$$(GFORTRAN_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ 'GOC=$$(GOC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ 'GOCFLAGS=$$(GOCFLAGS_FOR_TARGET)' \ diff --git a/Makefile.tpl b/Makefile.tpl index 6e0337fb48f..bffd85bd68e 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -162,6 +162,7 @@ BUILD_EXPORTS = \ GDC="$(GDC_FOR_BUILD)"; export GDC; \ GDCFLAGS="$(GDCFLAGS_FOR_BUILD)"; export GDCFLAGS; \ DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \ + DSYMUTIL="$(DSYMUTIL_FOR_BUILD)"; export DSYMUTIL; \ LD="$(LD_FOR_BUILD)"; export LD; \ LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \ NM="$(NM_FOR_BUILD)"; export NM; \ @@ -203,6 +204,7 @@ HOST_EXPORTS = \ CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \ DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ + DSYMUTIL="$(DSYMUTIL)"; export DSYMUTIL; \ LD="$(LD)"; export LD; \ LDFLAGS="$(STAGE1_LDFLAGS) $(LDFLAGS)"; export LDFLAGS; \ NM="$(NM)"; export NM; \ @@ -215,6 +217,7 @@ HOST_EXPORTS = \ READELF="$(READELF)"; export READELF; \ AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \ AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \ + DSYMUTIL_FOR_TARGET="$(DSYMUTIL_FOR_TARGET)"; export DSYMUTIL_FOR_TARGET; \ GCC_FOR_TARGET="$(GCC_FOR_TARGET)"; export GCC_FOR_TARGET; \ LD_FOR_TARGET="$(LD_FOR_TARGET)"; export LD_FOR_TARGET; \ NM_FOR_TARGET="$(NM_FOR_TARGET)"; export NM_FOR_TARGET; \ @@ -297,6 +300,7 @@ BASE_TARGET_EXPORTS = \ GOC="$(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GOC; \ GDC="$(GDC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GDC; \ DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ + DSYMUTIL="$(DSYMUTIL_FOR_TARGET)"; export DSYMUTIL; \ LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \ LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \ @@ -359,6 +363,7 @@ CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@ CXX_FOR_BUILD = @CXX_FOR_BUILD@ DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@ +DSYMUTIL_FOR_BUILD = @DSYMUTIL_FOR_BUILD@ GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@ GOC_FOR_BUILD = @GOC_FOR_BUILD@ GDC_FOR_BUILD = @GDC_FOR_BUILD@ @@ -409,6 +414,7 @@ AR_FLAGS = rc CC = @CC@ CXX = @CXX@ DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ LD = @LD@ LIPO = @LIPO@ NM = @NM@ @@ -519,6 +525,7 @@ GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ GOC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GOC_FOR_TARGET@ GDC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GDC_FOR_TARGET@ DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@ +DSYMUTIL_FOR_TARGET=@DSYMUTIL_FOR_TARGET@ LD_FOR_TARGET=@LD_FOR_TARGET@ LIPO_FOR_TARGET=@LIPO_FOR_TARGET@ @@ -644,6 +651,7 @@ EXTRA_HOST_FLAGS = \ 'CC=$(CC)' \ 'CXX=$(CXX)' \ 'DLLTOOL=$(DLLTOOL)' \ + 'DSYMUTIL=$(DSYMUTIL)' \ 'GFORTRAN=$(GFORTRAN)' \ 'GOC=$(GOC)' \ 'GDC=$(GDC)' \ @@ -702,6 +710,7 @@ EXTRA_TARGET_FLAGS = \ $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ 'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \ 'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \ + 'DSYMUTIL=$$(DSYMUTIL_FOR_TARGET)' \ 'GFORTRAN=$$(GFORTRAN_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ 'GOC=$$(GOC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ 'GOCFLAGS=$$(GOCFLAGS_FOR_TARGET)' \ diff --git a/configure b/configure index 090357612bf..831a377a71e 100755 --- a/configure +++ b/configure @@ -609,6 +609,7 @@ OBJCOPY_FOR_TARGET NM_FOR_TARGET LIPO_FOR_TARGET LD_FOR_TARGET +DSYMUTIL_FOR_TARGET DLLTOOL_FOR_TARGET AS_FOR_TARGET AR_FOR_TARGET @@ -629,6 +630,7 @@ RANLIB NM LIPO LD +DSYMUTIL DLLTOOL AS AR @@ -649,6 +651,7 @@ LDFLAGS_FOR_BUILD GDC_FOR_BUILD GOC_FOR_BUILD GFORTRAN_FOR_BUILD +DSYMUTIL_FOR_BUILD DLLTOOL_FOR_BUILD CXX_FOR_BUILD CXXFLAGS_FOR_BUILD @@ -853,6 +856,7 @@ target_configargs AR AS DLLTOOL +DSYMUTIL LD LIPO NM @@ -873,6 +877,7 @@ GDC_FOR_TARGET AR_FOR_TARGET AS_FOR_TARGET DLLTOOL_FOR_TARGET +DSYMUTIL_FOR_TARGET LD_FOR_TARGET LIPO_FOR_TARGET NM_FOR_TARGET @@ -1636,6 +1641,7 @@ Some influential environment variables: AR AR for the host AS AS for the host DLLTOOL DLLTOOL for the host + DSYMUTIL DSYMUTIL for the host LD LD for the host LIPO LIPO for the host NM NM for the host @@ -1665,6 +1671,8 @@ Some influential environment variables: AS for the target DLLTOOL_FOR_TARGET DLLTOOL for the target + DSYMUTIL_FOR_TARGET + DSYMUTIL for the target LD_FOR_TARGET LD for the target LIPO_FOR_TARGET @@ -4093,6 +4101,7 @@ if test "${build}" != "${host}" ; then AS_FOR_BUILD=${AS_FOR_BUILD-as} CC_FOR_BUILD=${CC_FOR_BUILD-gcc} CXX_FOR_BUILD=${CXX_FOR_BUILD-g++} + DSYMUTIL_FOR_BUILD=${DSYMUTIL_FOR_BUILD-dsymutil} GFORTRAN_FOR_BUILD=${GFORTRAN_FOR_BUILD-gfortran} GOC_FOR_BUILD=${GOC_FOR_BUILD-gccgo} GDC_FOR_BUILD=${GDC_FOR_BUILD-gdc} @@ -4107,6 +4116,7 @@ else AS_FOR_BUILD="\$(AS)" CC_FOR_BUILD="\$(CC)" CXX_FOR_BUILD="\$(CXX)" + DSYMUTIL_FOR_BUILD="\$(DSYMUTIL)" GFORTRAN_FOR_BUILD="\$(GFORTRAN)" GOC_FOR_BUILD="\$(GOC)" GDC_FOR_BUILD="\$(GDC)" @@ -9888,6 +9898,7 @@ done + # Generate default definitions for YACC, M4, LEX and other programs that run # on the build machine. These are used if the Makefile can't locate these # programs in objdir. @@ -10720,6 +10731,147 @@ fi +if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL=$DSYMUTIL +elif test -n "$ac_cv_prog_DSYMUTIL"; then + DSYMUTIL=$ac_cv_prog_DSYMUTIL +fi + +if test -n "$ac_cv_prog_DSYMUTIL"; then + for ncn_progname in dsymutil; do + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DSYMUTIL="${ncn_progname}" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +$as_echo "$DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + done +fi + +for ncn_progname in dsymutil; do + if test -n "$ncn_tool_prefix"; then + # Extract the first word of "${ncn_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_tool_prefix}${ncn_progname}; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DSYMUTIL="${ncn_tool_prefix}${ncn_progname}" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +$as_echo "$DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi + if test -z "$ac_cv_prog_DSYMUTIL" && test $build = $host ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DSYMUTIL="${ncn_progname}" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +$as_echo "$DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi + test -n "$ac_cv_prog_DSYMUTIL" && break +done + +if test -z "$ac_cv_prog_DSYMUTIL" ; then + set dummy dsymutil + if test $build = $host ; then + DSYMUTIL="$2" + else + DSYMUTIL="${ncn_tool_prefix}$2" + fi +fi + + + if test -n "$LD"; then ac_cv_prog_LD=$LD elif test -n "$ac_cv_prog_LD"; then @@ -13950,6 +14102,236 @@ fi +if test -z "$ac_cv_path_DSYMUTIL_FOR_TARGET" ; then + if test -n "$with_build_time_tools"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dsymutil in $with_build_time_tools" >&5 +$as_echo_n "checking for dsymutil in $with_build_time_tools... " >&6; } + if test -x $with_build_time_tools/dsymutil; then + DSYMUTIL_FOR_TARGET=`cd $with_build_time_tools && pwd`/dsymutil + ac_cv_path_DSYMUTIL_FOR_TARGET=$DSYMUTIL_FOR_TARGET + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_DSYMUTIL_FOR_TARGET" >&5 +$as_echo "$ac_cv_path_DSYMUTIL_FOR_TARGET" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + elif test $build != $host && test $have_gcc_for_target = yes; then + DSYMUTIL_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=dsymutil` + test $DSYMUTIL_FOR_TARGET = dsymutil && DSYMUTIL_FOR_TARGET= + test -n "$DSYMUTIL_FOR_TARGET" && ac_cv_path_DSYMUTIL_FOR_TARGET=$DSYMUTIL_FOR_TARGET + fi +fi +if test -z "$ac_cv_path_DSYMUTIL_FOR_TARGET" && test -n "$gcc_cv_tool_dirs"; then + # Extract the first word of "dsymutil", so it can be a program name with args. +set dummy dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_DSYMUTIL_FOR_TARGET+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $DSYMUTIL_FOR_TARGET in + [\\/]* | ?:[\\/]*) + ac_cv_path_DSYMUTIL_FOR_TARGET="$DSYMUTIL_FOR_TARGET" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $gcc_cv_tool_dirs +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_DSYMUTIL_FOR_TARGET="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +DSYMUTIL_FOR_TARGET=$ac_cv_path_DSYMUTIL_FOR_TARGET +if test -n "$DSYMUTIL_FOR_TARGET"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL_FOR_TARGET" >&5 +$as_echo "$DSYMUTIL_FOR_TARGET" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_DSYMUTIL_FOR_TARGET" ; then + + +if test -n "$DSYMUTIL_FOR_TARGET"; then + ac_cv_prog_DSYMUTIL_FOR_TARGET=$DSYMUTIL_FOR_TARGET +elif test -n "$ac_cv_prog_DSYMUTIL_FOR_TARGET"; then + DSYMUTIL_FOR_TARGET=$ac_cv_prog_DSYMUTIL_FOR_TARGET +fi + +if test -n "$ac_cv_prog_DSYMUTIL_FOR_TARGET"; then + for ncn_progname in dsymutil; do + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DSYMUTIL_FOR_TARGET+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DSYMUTIL_FOR_TARGET"; then + ac_cv_prog_DSYMUTIL_FOR_TARGET="$DSYMUTIL_FOR_TARGET" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DSYMUTIL_FOR_TARGET="${ncn_progname}" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DSYMUTIL_FOR_TARGET=$ac_cv_prog_DSYMUTIL_FOR_TARGET +if test -n "$DSYMUTIL_FOR_TARGET"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL_FOR_TARGET" >&5 +$as_echo "$DSYMUTIL_FOR_TARGET" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + done +fi + +if test -z "$ac_cv_prog_DSYMUTIL_FOR_TARGET" && test -n "$with_build_time_tools"; then + for ncn_progname in dsymutil; do + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ncn_progname} in $with_build_time_tools" >&5 +$as_echo_n "checking for ${ncn_progname} in $with_build_time_tools... " >&6; } + if test -x $with_build_time_tools/${ncn_progname}; then + ac_cv_prog_DSYMUTIL_FOR_TARGET=$with_build_time_tools/${ncn_progname} + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + break + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + done +fi + +if test -z "$ac_cv_prog_DSYMUTIL_FOR_TARGET"; then + for ncn_progname in dsymutil; do + if test -n "$ncn_target_tool_prefix"; then + # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DSYMUTIL_FOR_TARGET+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DSYMUTIL_FOR_TARGET"; then + ac_cv_prog_DSYMUTIL_FOR_TARGET="$DSYMUTIL_FOR_TARGET" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DSYMUTIL_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DSYMUTIL_FOR_TARGET=$ac_cv_prog_DSYMUTIL_FOR_TARGET +if test -n "$DSYMUTIL_FOR_TARGET"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL_FOR_TARGET" >&5 +$as_echo "$DSYMUTIL_FOR_TARGET" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi + if test -z "$ac_cv_prog_DSYMUTIL_FOR_TARGET" && test $build = $target ; then + # Extract the first word of "${ncn_progname}", so it can be a program name with args. +set dummy ${ncn_progname}; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DSYMUTIL_FOR_TARGET+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DSYMUTIL_FOR_TARGET"; then + ac_cv_prog_DSYMUTIL_FOR_TARGET="$DSYMUTIL_FOR_TARGET" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DSYMUTIL_FOR_TARGET="${ncn_progname}" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DSYMUTIL_FOR_TARGET=$ac_cv_prog_DSYMUTIL_FOR_TARGET +if test -n "$DSYMUTIL_FOR_TARGET"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL_FOR_TARGET" >&5 +$as_echo "$DSYMUTIL_FOR_TARGET" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi + test -n "$ac_cv_prog_DSYMUTIL_FOR_TARGET" && break + done +fi + +if test -z "$ac_cv_prog_DSYMUTIL_FOR_TARGET" ; then + set dummy dsymutil + if test $build = $target ; then + DSYMUTIL_FOR_TARGET="$2" + else + DSYMUTIL_FOR_TARGET="${ncn_target_tool_prefix}$2" + fi +else + DSYMUTIL_FOR_TARGET="$ac_cv_prog_DSYMUTIL_FOR_TARGET" +fi + +else + DSYMUTIL_FOR_TARGET=$ac_cv_path_DSYMUTIL_FOR_TARGET +fi + + + + if test -z "$ac_cv_path_LD_FOR_TARGET" ; then if test -n "$with_build_time_tools"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld in $with_build_time_tools" >&5 @@ -16738,6 +17120,37 @@ $as_echo "pre-installed" >&6; } fi fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the target dsymutil" >&5 +$as_echo_n "checking where to find the target dsymutil... " >&6; } +if test "x${build}" != "x${host}" ; then + if expr "x$DSYMUTIL_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + ac_dir=`dirname $DSYMUTIL_FOR_TARGET` + { $as_echo "$as_me:${as_lineno-$LINENO}: result: pre-installed in $ac_dir" >&5 +$as_echo "pre-installed in $ac_dir" >&6; } + else + # Canadian cross, just use what we found + { $as_echo "$as_me:${as_lineno-$LINENO}: result: pre-installed" >&5 +$as_echo "pre-installed" >&6; } + fi +else + if expr "x$DSYMUTIL_FOR_TARGET" : "x/" > /dev/null; then + # We already found the complete path + ac_dir=`dirname $DSYMUTIL_FOR_TARGET` + { $as_echo "$as_me:${as_lineno-$LINENO}: result: pre-installed in $ac_dir" >&5 +$as_echo "pre-installed in $ac_dir" >&6; } + elif test "x$target" = "x$host"; then + # We can use an host tool + DSYMUTIL_FOR_TARGET='$(DSYMUTIL)' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: host tool" >&5 +$as_echo "host tool" >&6; } + else + # We need a cross tool + { $as_echo "$as_me:${as_lineno-$LINENO}: result: pre-installed" >&5 +$as_echo "pre-installed" >&6; } + fi +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the target gcc" >&5 $as_echo_n "checking where to find the target gcc... " >&6; } if test "x${build}" != "x${host}" ; then diff --git a/configure.ac b/configure.ac index d6d4bd9bf01..74d98109994 100644 --- a/configure.ac +++ b/configure.ac @@ -1348,6 +1348,7 @@ if test "${build}" != "${host}" ; then AS_FOR_BUILD=${AS_FOR_BUILD-as} CC_FOR_BUILD=${CC_FOR_BUILD-gcc} CXX_FOR_BUILD=${CXX_FOR_BUILD-g++} + DSYMUTIL_FOR_BUILD=${DSYMUTIL_FOR_BUILD-dsymutil} GFORTRAN_FOR_BUILD=${GFORTRAN_FOR_BUILD-gfortran} GOC_FOR_BUILD=${GOC_FOR_BUILD-gccgo} GDC_FOR_BUILD=${GDC_FOR_BUILD-gdc} @@ -1362,6 +1363,7 @@ else AS_FOR_BUILD="\$(AS)" CC_FOR_BUILD="\$(CC)" CXX_FOR_BUILD="\$(CXX)" + DSYMUTIL_FOR_BUILD="\$(DSYMUTIL)" GFORTRAN_FOR_BUILD="\$(GFORTRAN)" GOC_FOR_BUILD="\$(GOC)" GDC_FOR_BUILD="\$(GDC)" @@ -3390,6 +3392,7 @@ AC_SUBST(CFLAGS_FOR_BUILD) AC_SUBST(CXXFLAGS_FOR_BUILD) AC_SUBST(CXX_FOR_BUILD) AC_SUBST(DLLTOOL_FOR_BUILD) +AC_SUBST(DSYMUTIL_FOR_BUILD) AC_SUBST(GFORTRAN_FOR_BUILD) AC_SUBST(GOC_FOR_BUILD) AC_SUBST(GDC_FOR_BUILD) @@ -3469,6 +3472,7 @@ esac NCN_STRICT_CHECK_TOOLS(AR, ar) NCN_STRICT_CHECK_TOOLS(AS, as) NCN_STRICT_CHECK_TOOLS(DLLTOOL, dlltool) +NCN_STRICT_CHECK_TOOLS(DSYMUTIL, dsymutil) NCN_STRICT_CHECK_TOOLS(LD, ld) NCN_STRICT_CHECK_TOOLS(LIPO, lipo) NCN_STRICT_CHECK_TOOLS(NM, nm) @@ -3508,6 +3512,7 @@ NCN_STRICT_CHECK_TARGET_TOOLS(GDC_FOR_TARGET, gdc) ACX_CHECK_INSTALLED_TARGET_TOOL(AR_FOR_TARGET, ar) ACX_CHECK_INSTALLED_TARGET_TOOL(AS_FOR_TARGET, as) ACX_CHECK_INSTALLED_TARGET_TOOL(DLLTOOL_FOR_TARGET, dlltool) +ACX_CHECK_INSTALLED_TARGET_TOOL(DSYMUTIL_FOR_TARGET, dsymutil) ACX_CHECK_INSTALLED_TARGET_TOOL(LD_FOR_TARGET, ld) ACX_CHECK_INSTALLED_TARGET_TOOL(LIPO_FOR_TARGET, lipo) ACX_CHECK_INSTALLED_TARGET_TOOL(NM_FOR_TARGET, nm) @@ -3533,6 +3538,7 @@ GCC_TARGET_TOOL(c++ for libstdc++, RAW_CXX_FOR_TARGET, CXX, [gcc/xgcc -shared-libgcc -B$$r/$(HOST_SUBDIR)/gcc -nostdinc++ -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs], c++) GCC_TARGET_TOOL(dlltool, DLLTOOL_FOR_TARGET, DLLTOOL, [binutils/dlltool]) +GCC_TARGET_TOOL(dsymutil, DSYMUTIL_FOR_TARGET, DSYMUTIL) GCC_TARGET_TOOL(gcc, GCC_FOR_TARGET, , [gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/]) GCC_TARGET_TOOL(gfortran, GFORTRAN_FOR_TARGET, GFORTRAN, [gcc/gfortran -B$$r/$(HOST_SUBDIR)/gcc/], fortran) diff --git a/gcc/collect2.c b/gcc/collect2.c index 0c8af29879d..75658d75daf 100644 --- a/gcc/collect2.c +++ b/gcc/collect2.c @@ -3044,15 +3044,49 @@ process_args (int *argcp, char **argv) { static void do_dsymutil (const char *output_file) { - const char *dsymutil = DSYMUTIL + 1; + const char *dsymutil = 0; struct pex_obj *pex; - char **real_argv = XCNEWVEC (char *, 3); + char **real_argv = XCNEWVEC (char *, verbose ? 4 : 3); const char ** argv = CONST_CAST2 (const char **, char **, real_argv); +/* For cross-builds search the PATH using target-qualified name if we + have not already found a suitable dsymutil. In practice, all modern + versions of dsymutil handle all supported archs, however the approach + here is consistent with the way other installations work (and one can + always symlink a multitarget dsymutil with a target-specific name). */ + const char *dsname = "dsymutil"; +#ifdef CROSS_DIRECTORY_STRUCTURE + const char *qname = concat (target_machine, "-", dsname, NULL); +#else + const char *qname = dsname; +#endif +#ifdef DEFAULT_DSYMUTIL + /* Configured default takes priority. */ + if (dsymutil == 0 && access (DEFAULT_DSYMUTIL, X_OK) == 0) + dsymutil = DEFAULT_DSYMUTIL; + if (dsymutil == 0) +#endif +#ifdef DSYMUTIL + /* Followed by one supplied in the target header, somewhat like the + REAL_XX_NAME used elsewhere. */ + dsymutil = find_a_file (&cpath, DSYMUTIL, X_OK); + if (dsymutil == 0) + dsymutil = find_a_file (&path, DSYMUTIL, X_OK); + if (dsymutil == 0) +#endif + dsymutil = find_a_file (&cpath, dsname, X_OK); + if (dsymutil == 0) + dsymutil = find_a_file (&path, qname, X_OK); argv[0] = dsymutil; argv[1] = output_file; - argv[2] = (char *) 0; + if (verbose) + { + argv[2] = "-v"; + argv[3] = (char *) 0; + } + else + argv[2] = (char *) 0; pex = collect_execute (dsymutil, real_argv, NULL, NULL, PEX_LAST | PEX_SEARCH, false, NULL); diff --git a/gcc/config.in b/gcc/config.in index 2de5a463315..048bf52e8c2 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -55,6 +55,12 @@ #endif +/* Define to enable the use of a default debug linker. */ +#ifndef USED_FOR_TARGET +#undef DEFAULT_DSYMUTIL +#endif + + /* Define to enable the use of a default linker. */ #ifndef USED_FOR_TARGET #undef DEFAULT_LINKER @@ -94,6 +100,12 @@ #endif +/* Define to the dsymutil version. */ +#ifndef USED_FOR_TARGET +#undef DSYMUTIL_VERSION +#endif + + /* Define 0/1 if static analyzer feature is enabled. */ #ifndef USED_FOR_TARGET #undef ENABLE_ANALYZER diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index d2b2c141c8e..8d5d56da81f 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -240,8 +240,6 @@ extern GTY(()) int darwin_ms_struct; DARWIN_NOCOMPACT_UNWIND \ "}}}}}}} %&1`; then + dsymutil_flag=yes + fi + fi + +cat >>confdefs.h <<_ACEOF +#define DEFAULT_DSYMUTIL "$DEFAULT_DSYMUTIL" +_ACEOF + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a default dsymutil was specified" >&5 +$as_echo_n "checking whether a default dsymutil was specified... " >&6; } +if test x"${DEFAULT_DSYMUTIL+set}" = x"set"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes ($DEFAULT_DSYMUTIL)" >&5 +$as_echo "yes ($DEFAULT_DSYMUTIL)" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + # ---------------------- # Find default assembler # ---------------------- @@ -19392,7 +19437,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 19395 "configure" +#line 19440 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -19498,7 +19543,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 19501 "configure" +#line 19546 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -23396,6 +23441,71 @@ else $as_echo "$gcc_cv_otool" >&6; } fi +# Figure out the dsymutil we will use. +if ${gcc_cv_dsymutil+:} false; then : + +else + +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 + # Extract the first word of "$DSYMUTIL_FOR_TARGET", so it can be a program name with args. +set dummy $DSYMUTIL_FOR_TARGET; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_gcc_cv_dsymutil+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $gcc_cv_dsymutil in + [\\/]* | ?:[\\/]*) + ac_cv_path_gcc_cv_dsymutil="$gcc_cv_dsymutil" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_gcc_cv_dsymutil="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +gcc_cv_dsymutil=$ac_cv_path_gcc_cv_dsymutil +if test -n "$gcc_cv_dsymutil"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_dsymutil" >&5 +$as_echo "$gcc_cv_dsymutil" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +fi + +ORIGINAL_DSYMUTIL_FOR_TARGET=$gcc_cv_dsymutil + +case "$ORIGINAL_DSYMUTIL_FOR_TARGET" in + ./dsymutil | ./dsymutil$build_exeext) ;; + *) ac_config_files="$ac_config_files dsymutil:exec-tool.in" + ;; +esac + # Figure out what assembler alignment features are present. { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler flags" >&5 $as_echo_n "checking assembler flags... " >&6; } @@ -30640,6 +30750,52 @@ _ACEOF 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: dsymutil is a required tool for this system, but not found" >&5 +$as_echo "$as_me: WARNING: dsymutil is a required tool for this system, but not found" >&2;} + 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` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking dsymutil version \"$dsymutil_temp\"" >&5 +$as_echo_n "checking dsymutil version \"$dsymutil_temp\"... " >&6; } + 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 + +cat >>confdefs.h <<_ACEOF +#define DSYMUTIL_VERSION $dsymutil_kind,${dsymutil_major},${dsymutil_minor},${dsymutil_tiny} +_ACEOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dsymutil_vers : $dsymutil_kind ${dsymutil_major} ${dsymutil_minor} ${dsymutil_tiny} " >&5 +$as_echo "$dsymutil_vers : $dsymutil_kind ${dsymutil_major} ${dsymutil_minor} ${dsymutil_tiny} " >&6; } +fi + case $target_os in win32 | pe | cygwin* | mingw32*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking broken PE linker dwarf5 support" >&5 @@ -33342,6 +33498,7 @@ do "as") CONFIG_FILES="$CONFIG_FILES as:exec-tool.in" ;; "collect-ld") CONFIG_FILES="$CONFIG_FILES collect-ld:exec-tool.in" ;; "nm") CONFIG_FILES="$CONFIG_FILES nm:exec-tool.in" ;; + "dsymutil") CONFIG_FILES="$CONFIG_FILES dsymutil:exec-tool.in" ;; "clearcap.map") CONFIG_LINKS="$CONFIG_LINKS clearcap.map:${srcdir}/config/$clearcap_map" ;; "$all_outputs") CONFIG_FILES="$CONFIG_FILES $all_outputs" ;; "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; @@ -33976,6 +34133,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} "as":F) chmod +x as ;; "collect-ld":F) chmod +x collect-ld ;; "nm":F) chmod +x nm ;; + "dsymutil":F) chmod +x dsymutil ;; "default":C) case ${CONFIG_HEADERS} in *auto-host.h:config.in*) diff --git a/gcc/configure.ac b/gcc/configure.ac index de913f6dcd4..56554d057f7 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 # ---------------------- @@ -2834,6 +2865,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],, @@ -6336,6 +6388,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) diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 7a9e041d2ce..14035fb9cf3 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -1046,6 +1046,10 @@ but for the linker. Same as @uref{#with-as,,@option{--with-as}} but for the linker. +@item --with-dsymutil=@var{pathname} +Same as @uref{#with-as,,@option{--with-as}} +but for the debug linker (only used on Darwin platforms so far). + @item --with-stabs Specify that stabs debugging information should be used instead of whatever format the host normally diff --git a/gcc/exec-tool.in b/gcc/exec-tool.in index 9884601c13e..c206a254d51 100644 --- a/gcc/exec-tool.in +++ b/gcc/exec-tool.in @@ -25,6 +25,7 @@ ORIGINAL_LD_BFD_FOR_TARGET="@ORIGINAL_LD_BFD_FOR_TARGET@" ORIGINAL_LD_GOLD_FOR_TARGET="@ORIGINAL_LD_GOLD_FOR_TARGET@" ORIGINAL_PLUGIN_LD_FOR_TARGET="@ORIGINAL_PLUGIN_LD_FOR_TARGET@" ORIGINAL_NM_FOR_TARGET="@ORIGINAL_NM_FOR_TARGET@" +ORIGINAL_DSYMUTIL_FOR_TARGET="@ORIGINAL_DSYMUTIL_FOR_TARGET@" exeext=@host_exeext@ fast_install=@enable_fast_install@ objdir=@objdir@ @@ -71,6 +72,13 @@ case "$invoked" in prog=nm-new$exeext dir=binutils ;; + dsymutil) + original=$ORIGINAL_DSYMUTIL_FOR_TARGET + # We do not build this in tree - but still want to be able to execute + # a configured version from the build dir. + prog= + dir= + ;; esac case "$original" in diff --git a/gcc/gcc.c b/gcc/gcc.c index 8ba410c9e17..0af888c7d78 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -3056,6 +3056,11 @@ find_a_file (const struct path_prefix *pprefix, const char *name, int mode, return xstrdup (DEFAULT_LINKER); #endif +#ifdef DEFAULT_DSYMUTIL + if (! strcmp (name, "dsymutil") && access (DEFAULT_DSYMUTIL, mode) == 0) + return xstrdup (DEFAULT_DSYMUTIL); +#endif + /* Determine the filename to execute (special case for absolute paths). */ if (IS_ABSOLUTE_PATH (name))