[PATCH GOLD] [5/N mingw host] open files in binary mode
Andrew Pinski
Andrew_Pinski@playstation.sony.com
Wed Oct 7 19:14:00 GMT 2009
Hi,
Under mingw, files are opened by default in text mode which means
/n/r is converted into /n but since we are reading in binary files,
this confuses the rest of the linker.
OK? Built and tested on i686-linux-gnu.
Thanks,
Andrew Pinski
ChangeLog:
* descriptor.c: Include binary-io.h.
(Descriptors::open): Open the files in binary mode always.
-------------- next part --------------
? gold/autom4te.cache
Index: gold/descriptors.cc
===================================================================
RCS file: /cvs/src/src/gold/descriptors.cc,v
retrieving revision 1.7
diff -u -p -r1.7 descriptors.cc
--- gold/descriptors.cc 24 Mar 2009 04:50:32 -0000 1.7
+++ gold/descriptors.cc 7 Oct 2009 19:11:52 -0000
@@ -31,6 +31,7 @@
#include "options.h"
#include "gold-threads.h"
#include "descriptors.h"
+#include "binary-io.h"
// Very old systems may not define FD_CLOEXEC.
#ifndef FD_CLOEXEC
@@ -98,6 +99,9 @@ Descriptors::open(int descriptor, const
// require callers to pass it.
flags |= O_CLOEXEC;
+ // Always open the file as a binary file.
+ flags |= O_BINARY;
+
int new_descriptor = ::open(name, flags, mode);
if (new_descriptor < 0
&& errno != ENFILE
More information about the Binutils
mailing list