aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKai Tietz <kai.tietz@onevision.com>2011-02-10 08:57:24 +0000
committerKai Tietz <ktietz@gcc.gnu.org>2011-02-10 09:57:24 +0100
commit8ead22235d2315c4bd8d1fc7ebc561a6a6b14f1c (patch)
tree28e70f3d59791ff900a79fbdc861abc4231498b2 /gcc
parent06c969bd2687012065ba4555e947b6124358f8fe (diff)
downloadgcc-8ead22235d2315c4bd8d1fc7ebc561a6a6b14f1c.zip
gcc-8ead22235d2315c4bd8d1fc7ebc561a6a6b14f1c.tar.gz
gcc-8ead22235d2315c4bd8d1fc7ebc561a6a6b14f1c.tar.bz2
re PR lto/47241 (lto not work on mingw32, reporting 'ld.exe: could not unlink output file')
2011-02-10 Kai Tietz <kai.tietz@onevision.com> PR lto/47241 * lto.c (lto_read_section_data): Free fd_name in failure case. For mingw targets don't hash file-descriptor. (read_cgraph_and_symbols): Close current_lto_file in failure case. From-SVN: r169999
Diffstat (limited to 'gcc')
-rw-r--r--gcc/lto/ChangeLog9
-rw-r--r--gcc/lto/lto.c20
2 files changed, 25 insertions, 4 deletions
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 4cb66fe..3872a35 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,12 @@
+2011-02-10 Kai Tietz <kai.tietz@onevision.com>
+
+ PR lto/47241
+ * lto.c (lto_read_section_data): Free
+ fd_name in failure case.
+ For mingw targets don't hash file-descriptor.
+ (read_cgraph_and_symbols): Close current_lto_file
+ in failure case.
+
2011-01-11 Jan Hubicka <jh@suse.cz>
PR lto/45721
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index cbc192a..71c8cdb 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -590,10 +590,10 @@ lto_read_section_data (struct lto_file_decl_data *file_data,
}
if (fd == -1)
{
- fd_name = xstrdup (file_data->file_name);
fd = open (file_data->file_name, O_RDONLY|O_BINARY);
if (fd == -1)
return NULL;
+ fd_name = xstrdup (file_data->file_name);
}
#if LTO_MMAP_IO
@@ -619,9 +619,17 @@ lto_read_section_data (struct lto_file_decl_data *file_data,
|| read (fd, result, len) != (ssize_t) len)
{
free (result);
- return NULL;
+ result = NULL;
}
-
+#ifdef __MINGW32__
+ /* Native windows doesn't supports delayed unlink on opened file. So
+ we close file here again. This produces higher I/O load, but at least
+ it prevents to have dangling file handles preventing unlink. */
+ free (fd_name);
+ fd_name = NULL;
+ close (fd);
+ fd = -1;
+#endif
return result;
#endif
}
@@ -2147,7 +2155,11 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
file_data = lto_file_read (current_lto_file, resolution, &count);
if (!file_data)
- break;
+ {
+ lto_obj_file_close (current_lto_file);
+ current_lto_file = NULL;
+ break;
+ }
decl_data[last_file_ix++] = file_data;