diff mbox series

Fix PR88422

Message ID alpine.LSU.2.20.1901221046080.23386@zhemvz.fhfr.qr
State New
Headers show
Series Fix PR88422 | expand

Commit Message

Richard Biener Jan. 22, 2019, 9:47 a.m. UTC
The following patch from Nidal Faour fixes LTO issues on windows.

Thanks for tracking this down.

Aplied to trunk and GCC 8 branch.

Richard.

2019-01-22  Nidal Faour  <nidal.faour@wdc.com>

	PR lto/88422
	* simple-object.c (O_BINARY): Define if not already defined.
	(simple_object_copy_lto_debug_sections): Create file in binary
	mode.
diff mbox series

Patch

Index: libiberty/simple-object.c
===================================================================
--- libiberty/simple-object.c	(revision 268137)
+++ libiberty/simple-object.c	(working copy)
@@ -44,6 +44,10 @@  Boston, MA 02110-1301, USA.  */
 #define SEEK_SET 0
 #endif
 
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
 #include "simple-object-common.h"
 
 /* The known object file formats.  */
@@ -349,7 +353,7 @@  simple_object_copy_lto_debug_sections (s
       return errmsg;
     }
 
-  outfd = creat (dest, 00777);
+  outfd = open (dest, O_CREAT|O_WRONLY|O_TRUNC|O_BINARY, 00777);
   if (outfd == -1)
     {
       *err = errno;