From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id dEMqBbbNlWrURRgAWB0awg (envelope-from ) for ; Mon, 31 Aug 2026 14:53:42 -0400 Received: by simark.ca (Postfix, from userid 112) id E02AE1E167; Mon, 31 Aug 2026 14:53:41 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 035101E033 for ; Mon, 31 Aug 2026 14:53:38 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EB7AB4BA798D for ; Mon, 31 Aug 2026 18:53:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EB7AB4BA798D Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 821654BA2E29 for ; Mon, 31 Aug 2026 18:53:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 821654BA2E29 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 821654BA2E29 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788202386; cv=none; b=RwSwC2hwdJ+MH3vfoDEurfH5L5wPIOD/pi5F3n1UfRU5MVeGJeYP8zWAhlG8xltFjXbvWo83UX7/QRevrtYgaVmMYp0CQFD1T3z9GHHQUYE/UigSupXe6acBIE94e8Urg+s/1gKH5ZcWHLINu4PL2wqQdKwRK6FWR5q+z+B4cZ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788202386; c=relaxed/simple; bh=blXxMJnJ4fIq5rn82/M4tqT/RMHOgi8KP4wS2c83zyk=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=nnVyfbsB8JKyK57sytBh0UK6YFa9J9L+UtG3RFrLSSKi7mK419H2skYmftls46Koa6sNb2KCA3135IWokICLq1gU5G7TBU2ccMUvGj1DR9Vncw+vUe/tcnuMvGbtQA+guR3ViRbBeRdG9uWhKffUufFma4Sa7zpgHAafYqiAS2Q= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 821654BA2E29 Received: by simark.ca (Postfix) id 2565F1E166; Mon, 31 Aug 2026 14:53:05 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 2/7] gdb, gdbserver: require gcc-style dependency generation, drop the depcomp fallback Date: Mon, 31 Aug 2026 14:51:41 -0400 Message-ID: <20260831185300.572297-3-simon.marchi@efficios.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260831185300.572297-1-simon.marchi@efficios.com> References: <20260831185300.572297-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org gdb/Makefile.in and gdbserver/Makefile.in have similar code to do manual gcc3-style dependency tracking, or fallback to the depcomp tool for other dependency tracking modes. I believe that in this day and age, we can assume that all compilers we support know about gcc3-style dependency tracking. Obviously, gcc and clang both know about it. The other compilers I am aware of (I don't even know if they can build GDB) are Intel icc and IBM XL, and they both appear to have known about it for a while. I therefore propose to get rid of the fallback, which results in simpler Makefiles. In both directories, remove the depcomp fallback branch and merge the gcc3 definitions into the base COMPILE.post and POSTCOMPILE definitions. The DEPMODE and depcomp variables are not needed anymore. Remove the ZW_PROG_COMPILER_DEPENDENCIES calls in the configure.ac files, which were used to probe for the supported dependency mechanisme and substitute @CCDEPMODE@. ZW_CREATE_DEPDIR is still needed: it is what creates the top-level dependency directory from config.status. It also sets the DEPDIR variable indirectly, via AM_SET_DEPDIR. Change-Id: I2e0a42156af571e7147c83852fc9536b50af7c2e --- gdb/Makefile.in | 30 +++--------- gdb/configure | 101 +---------------------------------------- gdb/configure.ac | 1 - gdbserver/Makefile.in | 30 +++--------- gdbserver/configure | 98 --------------------------------------- gdbserver/configure.ac | 2 - 6 files changed, 16 insertions(+), 246 deletions(-) diff --git a/gdb/Makefile.in b/gdb/Makefile.in index c6bfc2949fcc..5741ee5e2e92 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -103,9 +103,7 @@ CXX = @CXX@ CXX_DIALECT = @CXX_DIALECT@ # Dependency tracking information. -DEPMODE = @CCDEPMODE@ DEPDIR = @DEPDIR@ -depcomp = $(SHELL) $(srcdir)/../depcomp # Directory containing source files. srcdir = @srcdir@ @@ -114,11 +112,14 @@ top_srcdir = @top_srcdir@ include $(srcdir)/silent-rules.mk -# Note that these are overridden by GNU make-specific code below if -# GNU make is used. The overrides implement dependency tracking. +# Note that we put the dependencies into a .Tpo file, then move them into +# place if the compile succeeds. We need this because gcc does not +# atomically write the dependency output file. COMPILE.pre = $(CXX) -x c++ $(CXX_DIALECT) -COMPILE.post = -c -o $@ -POSTCOMPILE = @true +COMPILE.post = -c -o $@ \ + -MT $@ -MMD -MP -MF $(@D)/$(DEPDIR)/$(basename $(@F)).Tpo +POSTCOMPILE = @mv $(@D)/$(DEPDIR)/$(basename $(@F)).Tpo \ + $(@D)/$(DEPDIR)/$(basename $(@F)).Po # CXXFLAGS is at the very end on purpose, so that user-supplied flags can # override internal flags. @@ -2828,23 +2829,6 @@ all_gdbtk_cflags = $(IDE_CFLAGS) $(ITCL_CFLAGS) \ # Dependency tracking. # -ifeq ($(DEPMODE),depmode=gcc3) -# Note that we put the dependencies into a .Tpo file, then move them -# into place if the compile succeeds. We need this because gcc does -# not atomically write the dependency output file. -override COMPILE.post = -c -o $@ -MT $@ -MMD -MP \ - -MF $(@D)/$(DEPDIR)/$(basename $(@F)).Tpo -override POSTCOMPILE = @mv $(@D)/$(DEPDIR)/$(basename $(@F)).Tpo \ - $(@D)/$(DEPDIR)/$(basename $(@F)).Po -else -override COMPILE.pre = source='$<' object='$@' libtool=no \ - DEPDIR=$(DEPDIR) $(DEPMODE) $(depcomp) \ - $(CXX) -x c++ $(CXX_DIALECT) -# depcomp handles atomicity for us, so we don't need a postcompile -# step. -override POSTCOMPILE = -endif - # A list of all the objects we might care about in this build, for # dependency tracking. all_object_files = gdb.o $(LIBGDB_OBS) gdbtk/generic/gdbtk-main.o diff --git a/gdb/configure b/gdb/configure index 7dc7781cb09f..94cc893a8715 100755 --- a/gdb/configure +++ b/gdb/configure @@ -795,7 +795,6 @@ SET_MAKE PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG -CCDEPMODE DEPDIR am__leading_dot LTLIBXXHASH @@ -11878,7 +11877,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11881 "configure" +#line 11880 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11984,7 +11983,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11987 "configure" +#line 11986 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -22700,102 +22699,6 @@ DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depdir" -depcc="$CC" am_compiler_list= - -am_depcomp=$ac_aux_dir/depcomp -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - for depmode in $am_compiler_list; do - if test $depmode = none; then break; fi - - $as_echo "$as_me:$LINENO: trying $depmode" >&5 - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "include sub/conftest.Po" > confmf - - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - depcmd="depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c" - echo "| $depcmd" | sed -e 's/ */ /g' >&5 - if env $depcmd > conftest.err 2>&1 && - grep sub/conftst6.h sub/conftest.Po >>conftest.err 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po >>conftest.err 2>&1 && - ${MAKE-make} -s -f confmf >>conftest.err 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - $as_echo "$as_me:$LINENO: success" >&5 - break - fi - fi - $as_echo "$as_me:$LINENO: failure, diagnostics are:" >&5 - sed -e 's/^/| /' < conftest.err >&5 - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } -if test x${am_cv_CC_dependencies_compiler_type-none} = xnone -then as_fn_error $? "no usable dependency style found" "$LINENO" 5 -else CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - -fi - # Since the first call to PKG_CHECK_MODULES may not happen (is guarded by # a condition), we must call PKG_PROG_PKG_CONFIG explicitly to probe for diff --git a/gdb/configure.ac b/gdb/configure.ac index c70aa30fc96a..d8b2498f415b 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -61,7 +61,6 @@ GDB_AC_COMMON # Dependency checking. ZW_CREATE_DEPDIR -ZW_PROG_COMPILER_DEPENDENCIES([CC]) # Since the first call to PKG_CHECK_MODULES may not happen (is guarded by # a condition), we must call PKG_PROG_PKG_CONFIG explicitly to probe for diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in index e45c89dc321d..b06e0b86e45b 100644 --- a/gdbserver/Makefile.in +++ b/gdbserver/Makefile.in @@ -48,9 +48,7 @@ AR_FLAGS = rc STRIP = @STRIP@ # Dependency tracking information. -DEPMODE = @CCDEPMODE@ DEPDIR = @DEPDIR@ -depcomp = $(SHELL) $(srcdir)/../depcomp # Directory containing source files. Don't clean up the spacing, # this exact string is matched for by the "configure" script. @@ -63,11 +61,14 @@ top_builddir = . include $(srcdir)/../gdb/silent-rules.mk -# Note that these are overridden by GNU make-specific code below if -# GNU make is used. The overrides implement dependency tracking. +# Note that we put the dependencies into a .Tpo file, then move them into +# place if the compile succeeds. We need this because gcc does not +# atomically write the dependency output file. COMPILE.pre = $(CXX) $(CXX_DIALECT) -COMPILE.post = -c -o $@ -POSTCOMPILE = @true +COMPILE.post = -c -o $@ \ + -MT $@ -MMD -MP -MF $(@D)/$(DEPDIR)/$(basename $(@F)).Tpo +POSTCOMPILE = @mv $(@D)/$(DEPDIR)/$(basename $(@F)).Tpo \ + $(@D)/$(DEPDIR)/$(basename $(@F)).Po INCLUDE_SERVER_H = -include $(srcdir)/server.h @@ -596,23 +597,6 @@ gdbreplay.o: gdbreplay.cc # Dependency tracking. # -ifeq ($(DEPMODE),depmode=gcc3) -# Note that we put the dependencies into a .Tpo file, then move them -# into place if the compile succeeds. We need this because gcc does -# not atomically write the dependency output file. -override COMPILE.post = -c -o $@ -MT $@ -MMD -MP \ - -MF $(@D)/$(DEPDIR)/$(basename $(@F)).Tpo -override POSTCOMPILE = @mv $(@D)/$(DEPDIR)/$(basename $(@F)).Tpo \ - $(@D)/$(DEPDIR)/$(basename $(@F)).Po -else -override COMPILE.pre = source='$<' object='$@' libtool=no \ - DEPDIR=$(DEPDIR) $(DEPMODE) $(depcomp) \ - $(CXX) $(CXX_DIALECT) -# depcomp handles atomicity for us, so we don't need a postcompile -# step. -override POSTCOMPILE = -endif - # A list of all the objects we might care about in this build, for # dependency tracking. all_object_files = $(OBS) $(GDBREPLAY_OBS) $(IPA_OBJS) diff --git a/gdbserver/configure b/gdbserver/configure index 46faecc3a207..3cf8df2c3ae1 100755 --- a/gdbserver/configure +++ b/gdbserver/configure @@ -637,7 +637,6 @@ REPORT_BUGS_TO PKGVERSION WERROR_CFLAGS WARN_CFLAGS -CCDEPMODE CONFIG_SRC_SUBDIR CATOBJEXT GENCAT @@ -12821,103 +12820,6 @@ CONFIG_SRC_SUBDIR="arch gdbsupport nat target" ac_config_commands="$ac_config_commands gdbdepdir" -depcc="$CC" am_compiler_list= - -am_depcomp=$ac_aux_dir/depcomp -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - for depmode in $am_compiler_list; do - if test $depmode = none; then break; fi - - $as_echo "$as_me:$LINENO: trying $depmode" >&5 - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "include sub/conftest.Po" > confmf - - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - depcmd="depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c" - echo "| $depcmd" | sed -e 's/ */ /g' >&5 - if env $depcmd > conftest.err 2>&1 && - grep sub/conftst6.h sub/conftest.Po >>conftest.err 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po >>conftest.err 2>&1 && - ${MAKE-make} -s -f confmf >>conftest.err 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - $as_echo "$as_me:$LINENO: success" >&5 - break - fi - fi - $as_echo "$as_me:$LINENO: failure, diagnostics are:" >&5 - sed -e 's/^/| /' < conftest.err >&5 - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } -if test x${am_cv_CC_dependencies_compiler_type-none} = xnone -then as_fn_error $? "no usable dependency style found" "$LINENO" 5 -else CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - -fi - - for ac_header in \ arpa/inet.h \ fcntl.h \ diff --git a/gdbserver/configure.ac b/gdbserver/configure.ac index 9979afe7ece9..a549a8712fc1 100644 --- a/gdbserver/configure.ac +++ b/gdbserver/configure.ac @@ -76,8 +76,6 @@ AC_CONFIG_COMMANDS([gdbdepdir],[ done], [ac_aux_dir=$ac_aux_dir DEPDIR=$DEPDIR CONFIG_SRC_SUBDIR="$CONFIG_SRC_SUBDIR"]) -ZW_PROG_COMPILER_DEPENDENCIES([CC]) - AC_CHECK_HEADERS([ \ arpa/inet.h \ fcntl.h \ -- 2.55.0