From 4293cd6ed8dfd9f0eef8287e72372c55796f50da Mon Sep 17 00:00:00 2001 From: Nidal Faour Date: Tue, 22 Jan 2019 09:47:52 +0000 Subject: [PATCH] re PR lto/88422 (collect2.exe: fatal error: lto-wrapper returned 1 exit status: file not recognized: file truncated) 2019-01-22 Nidal Faour 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 | 7 +++++++ libiberty/simple-object.c | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 08d0a436cf2..db5e77a25c0 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,10 @@ +2019-01-22 Nidal Faour + + 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 * splay-tree.c (splay_tree_remove): Delete the key if necessary. diff --git a/libiberty/simple-object.c b/libiberty/simple-object.c index c1f38cee8ee..b00c265128c 100644 --- a/libiberty/simple-object.c +++ b/libiberty/simple-object.c @@ -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; -- 2.30.2