aboutsummaryrefslogtreecommitdiff
path: root/gcc
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 /gcc
parentd6f1961e68092fda35ce064ef45d1dbec780c624 (diff)
downloadgcc-ed1233115c9c60b0174fa99913ba6bd61e81edd7.zip
gcc-ed1233115c9c60b0174fa99913ba6bd61e81edd7.tar.gz
gcc-ed1233115c9c60b0174fa99913ba6bd61e81edd7.tar.bz2
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 'gcc')
-rw-r--r--gcc/lto-wrapper.cc34
1 files changed, 5 insertions, 29 deletions
diff --git a/gcc/lto-wrapper.cc b/gcc/lto-wrapper.cc
index f9b2511..a980b20 100644
--- a/gcc/lto-wrapper.cc
+++ b/gcc/lto-wrapper.cc
@@ -1571,6 +1571,8 @@ run_gcc (unsigned argc, char *argv[])
/* Exists. */
if (access (option->arg, W_OK) == 0)
ltrans_cache_dir = option->arg;
+ else
+ fatal_error (input_location, "missing directory: %s", option->arg);
break;
case OPT_flto_incremental_cache_size_:
@@ -2218,39 +2220,13 @@ cont:
{
for (i = 0; i < nr; ++i)
{
- char *input_name = input_names[i];
- char const *output_name = output_names[i];
-
ltrans_file_cache::item* item;
- item = ltrans_cache.get_item (input_name);
+ item = ltrans_cache.get_item (input_names[i]);
- if (item && !save_temps)
+ if (item)
{
+ /* Ensure LTRANS for this item finished. */
item->lock.lock_read ();
- /* Ensure that cached compiled file is not deleted.
- Create copy. */
-
- obstack_grow (&env_obstack, output_name,
- strlen (output_name) - 2);
- obstack_grow (&env_obstack, ".cache_copy.XXX.o",
- sizeof (".cache_copy.XXX.o"));
-
- char* output_name_link = XOBFINISH (&env_obstack, char *);
- char* name_idx = output_name_link + strlen (output_name_link)
- - strlen ("XXX.o");
-
- /* lto-wrapper can run in parallel and access
- the same partition. */
- for (int j = 0; ; j++)
- {
- gcc_assert (j < 1000);
- sprintf (name_idx, "%03d.o", j);
-
- if (link (output_name, output_name_link) != EEXIST)
- break;
- }
-
- output_names[i] = output_name_link;
item->lock.unlock ();
}
}