re PR lto/88422 (collect2.exe: fatal error: lto-wrapper returned 1 exit status: file...
authorNidal Faour <nidal.faour@wdc.com>
Tue, 22 Jan 2019 09:47:52 +0000 (09:47 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 22 Jan 2019 09:47:52 +0000 (09:47 +0000)
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.

From-SVN: r268141

libiberty/ChangeLog
libiberty/simple-object.c

index 08d0a436cf20880a83238ac276998f9988f1ab2a..db5e77a25c03ec99715c74d5cfcfc90763b23ca2 100644 (file)
@@ -1,3 +1,10 @@
+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.
+
 2019-01-21  Tom Tromey  <tom@tromey.com>
 
        * splay-tree.c (splay_tree_remove): Delete the key if necessary.
index c1f38cee8ee76704661bf5df67e8fe24509ae872..b00c265128c9dbca6984cea556af010df99f5427 100644 (file)
@@ -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 (simple_object_read *sobj,
       return errmsg;
     }
 
-  outfd = creat (dest, 00777);
+  outfd = open (dest, O_CREAT|O_WRONLY|O_TRUNC|O_BINARY, 00777);
   if (outfd == -1)
     {
       *err = errno;