summaryrefslogtreecommitdiff
path: root/lto-plugin
diff options
context:
space:
mode:
authorMichal Jires <mjires@suse.cz>2025-01-13 04:08:03 +0100
committerMichal Jires <mjires@suse.cz>2025-01-15 07:41:39 +0100
commited1233115c9c60b0174fa99913ba6bd61e81edd7 (patch)
tree3cc81651ef46153f3a28330f7ace5c0985c3fe6d /lto-plugin
parentd6f1961e68092fda35ce064ef45d1dbec780c624 (diff)
lto: Remove link() to fix build with MinGW [PR118238]
I used link() to create cheap copies of Incremental LTO cache contents to prevent their deletion once linking is finished. This is unnecessary, since output_files are deleted in our lto-plugin and not in the linker itself. Bootstrapped/regtested on x86_64-linux. lto-wrapper now again builds on MinGW. Though so far I have not setup MinGW to be able to do full bootstrap. Ok for trunk? PR lto/118238 gcc/ChangeLog: * lto-wrapper.cc (run_gcc): Remove link() copying. lto-plugin/ChangeLog: * lto-plugin.c (cleanup_handler): Keep output_files when using Incremental LTO. (onload): Detect Incremental LTO.
Diffstat (limited to 'lto-plugin')
-rw-r--r--lto-plugin/lto-plugin.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lto-plugin/lto-plugin.c b/lto-plugin/lto-plugin.c
index 6bccb56291c..3d272551fed 100644
--- a/lto-plugin/lto-plugin.c
+++ b/lto-plugin/lto-plugin.c
@@ -214,6 +214,7 @@ static char *ltrans_objects = NULL;
static bool debug;
static bool save_temps;
+static bool flto_incremental;
static bool verbose;
static char nop;
static char *resolution_file = NULL;
@@ -941,8 +942,9 @@ cleanup_handler (void)
if (arguments_file_name)
maybe_unlink (arguments_file_name);
- for (i = 0; i < num_output_files; i++)
- maybe_unlink (output_files[i]);
+ if (!flto_incremental)
+ for (i = 0; i < num_output_files; i++)
+ maybe_unlink (output_files[i]);
free_2 ();
return LDPS_OK;
@@ -1615,6 +1617,9 @@ onload (struct ld_plugin_tv *tv)
if (strstr (collect_gcc_options, "'-save-temps'"))
save_temps = true;
+ if (strstr (collect_gcc_options, "'-flto-incremental="))
+ flto_incremental = true;
+
if (strstr (collect_gcc_options, "'-v'")
|| strstr (collect_gcc_options, "'--verbose'"))
verbose = true;