public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Peter Damianov <peter0x44@disroot.org>
To: gcc-patches@gcc.gnu.org
Cc: richard.guenther@gmail.com, Peter Damianov <peter0x44@disroot.org>
Subject: [PATCH 2/2] lto-wrapper: Truncate files using -truncate driver option [PR110710]
Date: Wed, 17 Apr 2024 17:56:04 -0700	[thread overview]
Message-ID: <20240418005602.24118-2-peter0x44@disroot.org> (raw)
In-Reply-To: <20240418005602.24118-1-peter0x44@disroot.org>

This commit changes the Makefiles generated by lto-wrapper to no longer use
the "mv" and "touch" shell commands. These don't exist on Windows, so when the
Makefile attempts to call them, it results in errors like:
The system cannot find the file specified.

This problem only manifested when calling gcc from cmd.exe, and having no
sh.exe present on the PATH. The Windows port of GNU Make searches the PATH for
an sh.exe, and uses it if present.

I have tested this in environments with and without sh.exe on the PATH and
confirmed it works as expected.

Signed-off-by: Peter Damianov <peter0x44@disroot.org>
---
 gcc/lto-wrapper.cc | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/gcc/lto-wrapper.cc b/gcc/lto-wrapper.cc
index 02579951569..a36a59e6fb8 100644
--- a/gcc/lto-wrapper.cc
+++ b/gcc/lto-wrapper.cc
@@ -2023,14 +2023,12 @@ cont:
 	      fprintf (mstream, "%s:\n\t@%s ", output_name, new_argv[0]);
 	      for (j = 1; new_argv[j] != NULL; ++j)
 		fprintf (mstream, " '%s'", new_argv[j]);
-	      fprintf (mstream, "\n");
 	      /* If we are not preserving the ltrans input files then
 	         truncate them as soon as we have processed it.  This
 		 reduces temporary disk-space usage.  */
 	      if (! save_temps)
-		fprintf (mstream, "\t@-touch -r \"%s\" \"%s.tem\" > /dev/null "
-			 "2>&1 && mv \"%s.tem\" \"%s\"\n",
-			 input_name, input_name, input_name, input_name); 
+		fprintf (mstream, " '-truncate' '%s'", input_name);
+	      fprintf (mstream, "\n");
 	    }
 	  else
 	    {
-- 
2.39.2


  reply	other threads:[~2024-04-18  0:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-18  0:56 [PATCH 1/2] Driver: Add new -truncate option Peter Damianov
2024-04-18  0:56 ` Peter Damianov [this message]
2024-04-18  1:08 ` Andrew Pinski
2024-04-18  2:43 ` Peter0x44

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240418005602.24118-2-peter0x44@disroot.org \
    --to=peter0x44@disroot.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).