aboutsummaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2009-10-09 23:20:44 +0000
committerIan Lance Taylor <ian@airs.com>2009-10-09 23:20:44 +0000
commitd9a893b837890cddc71ea116e4d7e5b7bf9aadb8 (patch)
tree9c062c6e4c64b7d9c52415a8b93afecada7e957e /gold
parentc0a628659598a06ce2b60c956763f075a2b64b30 (diff)
downloadfsf-binutils-gdb-d9a893b837890cddc71ea116e4d7e5b7bf9aadb8.zip
fsf-binutils-gdb-d9a893b837890cddc71ea116e4d7e5b7bf9aadb8.tar.gz
fsf-binutils-gdb-d9a893b837890cddc71ea116e4d7e5b7bf9aadb8.tar.bz2
* configure.ac: Check for readv function also.
* fileread.cc (readv): Define if not HAVE_READV. * fileread.h (File_read:: max_readv_entries): Set to 1 if readv does not exist. * config.in: Regenerate. * configure: Regenerate.
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog10
-rw-r--r--gold/config.in3
-rwxr-xr-xgold/configure2
-rw-r--r--gold/configure.ac2
-rw-r--r--gold/fileread.cc9
-rw-r--r--gold/fileread.h6
6 files changed, 30 insertions, 2 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 2b31fa6..0072baa 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,13 @@
+2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
+ Ian Lance Taylor <iant@google.com>
+
+ * configure.ac: Check for readv function also.
+ * fileread.cc (readv): Define if not HAVE_READV.
+ * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
+ does not exist.
+ * config.in: Regenerate.
+ * configure: Regenerate.
+
2009-10-09 Doug Kwan <dougkwan@google.com>
* layout.cc (Layout::make_output_section): Call target hook to make
diff --git a/gold/config.in b/gold/config.in
index 5fccefb..93d7517 100644
--- a/gold/config.in
+++ b/gold/config.in
@@ -99,6 +99,9 @@
/* Define to 1 if you have the `pread' function. */
#undef HAVE_PREAD
+/* Define to 1 if you have the `readv' function. */
+#undef HAVE_READV
+
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
diff --git a/gold/configure b/gold/configure
index 4fa30b8..e4eb9fb 100755
--- a/gold/configure
+++ b/gold/configure
@@ -6701,7 +6701,7 @@ fi
done
-for ac_func in mallinfo posix_fallocate
+for ac_func in mallinfo posix_fallocate readv
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var"
diff --git a/gold/configure.ac b/gold/configure.ac
index 2492c7a..85e23f9 100644
--- a/gold/configure.ac
+++ b/gold/configure.ac
@@ -338,7 +338,7 @@ AC_LANG_PUSH(C++)
AC_CHECK_HEADERS(tr1/unordered_set tr1/unordered_map)
AC_CHECK_HEADERS(ext/hash_map ext/hash_set)
AC_CHECK_HEADERS(byteswap.h)
-AC_CHECK_FUNCS(mallinfo posix_fallocate)
+AC_CHECK_FUNCS(mallinfo posix_fallocate readv)
AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strverscmp, strndup, memmem])
# Use of ::std::tr1::unordered_map::rehash causes undefined symbols
diff --git a/gold/fileread.cc b/gold/fileread.cc
index 02f0571..aed1c1d 100644
--- a/gold/fileread.cc
+++ b/gold/fileread.cc
@@ -40,6 +40,15 @@
#include "descriptors.h"
#include "fileread.h"
+#ifndef HAVE_READV
+struct iovec { void* iov_base; size_t iov_len };
+ssize_t
+readv(int, const iovec*, int)
+{
+ gold_unreachable();
+}
+#endif
+
namespace gold
{
diff --git a/gold/fileread.h b/gold/fileread.h
index 920a4da..bdffdd1 100644
--- a/gold/fileread.h
+++ b/gold/fileread.h
@@ -370,7 +370,13 @@ class File_read
{ return (file_size + (page_size - 1)) & ~ (page_size - 1); }
// The maximum number of entries we will pass to ::readv.
+#ifdef HAVE_READV
static const size_t max_readv_entries = 128;
+#else
+ // On targets that don't have readv set the max to 1 so readv is not
+ // used.
+ static const size_t max_readv_entries = 1;
+#endif
// Use readv to read data.
void