aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Jires <mjires@suse.cz>2025-03-06 06:49:20 +0100
committerMichal Jires <mjires@suse.cz>2025-03-06 11:05:29 +0100
commit50cd99795268aaaf10705fa876dd4b751453e2f6 (patch)
treeaa582da6a13a96e3519158368a2981e7994dc047
parent3bd61c1dfaa2d7153eb4be82f423533ea937d0f9 (diff)
downloadgcc-50cd99795268aaaf10705fa876dd4b751453e2f6.zip
gcc-50cd99795268aaaf10705fa876dd4b751453e2f6.tar.gz
gcc-50cd99795268aaaf10705fa876dd4b751453e2f6.tar.bz2
lto: Fix missing cleanup with incremental LTO.
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.
-rw-r--r--lto-plugin/lto-plugin.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lto-plugin/lto-plugin.c b/lto-plugin/lto-plugin.c
index 3d27255..09d5441 100644
--- a/lto-plugin/lto-plugin.c
+++ b/lto-plugin/lto-plugin.c
@@ -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;