]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
lto: Fix missing cleanup with incremental LTO.
authorMichal Jires <mjires@suse.cz>
Thu, 6 Mar 2025 05:49:20 +0000 (06:49 +0100)
committerMichal Jires <mjires@suse.cz>
Thu, 6 Mar 2025 10:05:29 +0000 (11:05 +0100)
Incremental LTO disabled cleanup of output_files since they have to
persist in ltrans cache.
This unintetionally also kept temporary early debug "*.debug.temp.o"
files.

Bootstrapped/regtested on x86_64-linux.
Ok for trunk?

lto-plugin/ChangeLog:

* lto-plugin.c (cleanup_handler): Keep only files in ltrans
cache.

lto-plugin/lto-plugin.c

index 3d272551fed5e8646f8d3b7fe1ae0de49416b217..09d5441ecc78c0af4533ac4e77024db34dddfcb1 100644 (file)
@@ -945,6 +945,17 @@ cleanup_handler (void)
   if (!flto_incremental)
     for (i = 0; i < num_output_files; i++)
       maybe_unlink (output_files[i]);
+  else
+    {
+      /* Keep files in ltrans cache.  */
+      const char* suffix = ".ltrans.o";
+      for (i = 0; i < num_output_files; i++)
+       {
+         int offset = strlen (output_files[i]) - strlen (suffix);
+         if (offset < 0 || strcmp (output_files[i] + offset, suffix))
+           maybe_unlink (output_files[i]);
+       }
+    }
 
   free_2 ();
   return LDPS_OK;