From f3048a1d4770f01625461c6d967a774f5a3f8496 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Sat, 10 Oct 2009 04:56:43 +0000 Subject: [PATCH] * descriptor.cc: Include and "binary-io.h". (Descriptors::open): Open the files in binary mode always. * script.cc (Lex::get_token): Treat \r as whitespace. --- gold/ChangeLog | 7 +++++++ gold/descriptors.cc | 5 +++++ gold/script.cc | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gold/ChangeLog b/gold/ChangeLog index 0ae34295cb2..74f72b89be1 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,10 @@ +2009-10-09 Andrew Pinski + Ian Lance Taylor + + * descriptor.cc: Include 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 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0. diff --git a/gold/descriptors.cc b/gold/descriptors.cc index 3d059e2c222..f4a02d03296 100644 --- a/gold/descriptors.cc +++ b/gold/descriptors.cc @@ -23,6 +23,7 @@ #include "gold.h" #include +#include #include #include #include @@ -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 diff --git a/gold/script.cc b/gold/script.cc index 05a39e7d4b5..d381f553766 100644 --- a/gold/script.cc +++ b/gold/script.cc @@ -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') -- 2.30.2