public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r15-108] lto-wrapper: Truncate files using -truncate driver option [PR110710]
@ 2024-05-02 10:42 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2024-05-02 10:42 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:a704554d2e798e2e1b74b9fea4baf3477180bd9d

commit r15-108-ga704554d2e798e2e1b74b9fea4baf3477180bd9d
Author: Peter Damianov <peter0x44@disroot.org>
Date:   Sun Apr 28 16:16:12 2024 -0700

    lto-wrapper: Truncate files using -truncate driver option [PR110710]
    
    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>
    
            PR lto/110710
            * lto-wrapper.cc (run_gcc): Instead of truncating a processed
            ltrans input from the Makefile use the new -truncate option
            to accomplish the same.

Diff:
---
 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..cfded757f26 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
 	    {

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-02 10:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-02 10:42 [gcc r15-108] lto-wrapper: Truncate files using -truncate driver option [PR110710] Richard Biener

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).