[PATCH GOLD] [4/N mingw host] lack of readv support
Andrew Pinski
Andrew_Pinski@playstation.sony.com
Wed Oct 7 02:32:00 GMT 2009
Hi,
Under mingw, readv does not exist. Ian recommended that disabling
readv would be a good idea. This patch does that by adding a
configure check to see if there is readv support and disables the
usage of readv if it is not supported.
This is the last of the cleaner patches.
OK?
Thanks,
Andrew Pinski
ChangeLog:
* configure.ac: Check for readv function also.
* config.in: Regenerate.
* configure: Regenerate.
* fileread.cc (File_read::do_readv): When we don't have readv, fatal error.
* fileread.h (File_read:: max_readv_entries): Set to 1 if readv does not exist.
-------------- next part --------------
Index: config.in
===================================================================
RCS file: /cvs/src/src/gold/config.in,v
retrieving revision 1.25
diff -u -p -r1.25 config.in
--- config.in 22 Aug 2009 16:56:44 -0000 1.25
+++ config.in 7 Oct 2009 02:31:05 -0000
@@ -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
Index: configure
===================================================================
RCS file: /cvs/src/src/gold/configure,v
retrieving revision 1.49
diff -u -p -r1.49 configure
--- configure 6 Oct 2009 22:58:27 -0000 1.49
+++ configure 7 Oct 2009 02:31:06 -0000
@@ -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"
Index: configure.ac
===================================================================
RCS file: /cvs/src/src/gold/configure.ac,v
retrieving revision 1.47
diff -u -p -r1.47 configure.ac
--- configure.ac 6 Oct 2009 22:58:27 -0000 1.47
+++ configure.ac 7 Oct 2009 02:31:06 -0000
@@ -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
Index: fileread.cc
===================================================================
RCS file: /cvs/src/src/gold/fileread.cc,v
retrieving revision 1.53
diff -u -p -r1.53 fileread.cc
--- fileread.cc 30 Sep 2009 22:21:13 -0000 1.53
+++ fileread.cc 7 Oct 2009 02:31:06 -0000
@@ -499,6 +499,13 @@ void
File_read::do_readv(off_t base, const Read_multiple& rm, size_t start,
size_t count)
{
+#ifndef HAVE_READV
+ (void)base;
+ (void)rm;
+ (void)start;
+ (void)count;
+ gold_fatal(_("This target does not support ::readv"));
+#else
unsigned char discard[File_read::page_size];
iovec iov[File_read::max_readv_entries * 2];
size_t iov_index = 0;
@@ -548,6 +555,7 @@ File_read::do_readv(off_t base, const Re
gold_fatal(_("%s: file too short: read only %zd of %zd bytes at %lld"),
this->filename().c_str(),
got, want, static_cast<long long>(base + first_offset));
+#endif
}
// Read several pieces of data from the file.
Index: fileread.h
===================================================================
RCS file: /cvs/src/src/gold/fileread.h,v
retrieving revision 1.36
diff -u -p -r1.36 fileread.h
--- fileread.h 6 Jul 2009 23:11:21 -0000 1.36
+++ fileread.h 7 Oct 2009 02:31:06 -0000
@@ -370,7 +370,12 @@ 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
More information about the Binutils
mailing list