* descriptor.cc: Include <cstdio> and "binary-io.h".
authorIan Lance Taylor <ian@airs.com>
Sat, 10 Oct 2009 04:56:43 +0000 (04:56 +0000)
committerIan Lance Taylor <ian@airs.com>
Sat, 10 Oct 2009 04:56:43 +0000 (04:56 +0000)
(Descriptors::open): Open the files in binary mode always.
* script.cc (Lex::get_token): Treat \r as whitespace.

gold/ChangeLog
gold/descriptors.cc
gold/script.cc

index 0ae34295cb2d102aea6c264f47c12e56b49d8aa6..74f72b89be18640a2d2383bdbf4752ae1dad2b46 100644 (file)
@@ -1,3 +1,10 @@
+2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
+           Ian Lance Taylor  <iant@google.com>
+
+       * descriptor.cc: Include <cstdio> and "binary-io.h".
+       (Descriptors::open): Open the files in binary mode always.
+       * script.cc (Lex::get_token): Treat \r as whitespace.
+
 2009-10-09  Ian Lance Taylor  <iant@google.com>
 
        * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
index 3d059e2c222ed79a02157d282d9a2d70d4ddce55..f4a02d03296caaf2cc1b6eeaf12204785b31ac12 100644 (file)
@@ -23,6 +23,7 @@
 #include "gold.h"
 
 #include <cerrno>
+#include <cstdio>
 #include <cstring>
 #include <fcntl.h>
 #include <unistd.h>
@@ -31,6 +32,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 +100,9 @@ Descriptors::open(int descriptor, const char* name, int flags, int mode)
       // 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
index 05a39e7d4b5dfa0312a3d2d28e9511ecc558607f..d381f553766af7d85f8379d56db044b26eab50db 100644 (file)
@@ -743,7 +743,7 @@ Lex::get_token(const char** pp)
        }
 
       // Skip whitespace quickly.
-      while (*p == ' ' || *p == '\t')
+      while (*p == ' ' || *p == '\t' || *p == '\r')
        ++p;
 
       if (*p == '\n')