https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65559
--- Comment #20 from Rainer Emrich <rai...@emrich-ebersheim.de> --- Kai, (In reply to Kai Tietz from comment #18) > Does the following patch fixes your problem? > > Index: lto-wrapper.c > =================================================================== > --- lto-wrapper.c (Revision 222269) > +++ lto-wrapper.c (Arbeitskopie) > @@ -934,7 +934,7 @@ run_gcc (unsigned argc, char *argv[]) > filename[p - argv[i]] = '\0'; > file_offset = (off_t) loffset; > } > - fd = open (argv[i], O_RDONLY); > + fd = open (argv[i], O_RDONLY|O_BINARY); > if (fd == -1) > { > lto_argv[lto_argc++] = argv[i]; the following as Matt suggested Index: lto-wrapper.c =================================================================== --- lto-wrapper.c (Revision 222611) +++ lto-wrapper.c (Arbeitskopie) @@ -934,7 +934,7 @@ run_gcc (unsigned argc, char *argv[]) filename[p - argv[i]] = '\0'; file_offset = (off_t) loffset; } - fd = open (argv[i], O_RDONLY); + fd = open (filename, O_RDONLY|O_BINARY); if (fd == -1) { lto_argv[lto_argc++] = argv[i]; fixes the issue and not only this. I did a full native x86_64-w64-mingw32 bootstrap for c,c++ and ran the testsuite. A quick inspection shows that most lto failures are gone. gcc-5.1.0 === gcc Summary === # of expected passes 106113 # of unexpected failures 1809 # of unexpected successes 20 # of expected failures 282 # of unresolved testcases 1242 # of unsupported tests 1940 gcc-5.1.1 revision 222611 patch applied === gcc Summary === # of expected passes 108435 # of unexpected failures 839 # of unexpected successes 21 # of expected failures 283 # of unresolved testcases 21 # of unsupported tests 1907 I have to look at the related PRs still. I can't test on Linux at the moment. Has somebody the time to do a regression test for the patch on Linux? Kai?