This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH GOLD] [4/N mingw host] lack of readv support


Andrew Pinski <Andrew_Pinski@playstation.sony.com> writes:

>   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.

I committed this a little differently, as follows.  Let me know if
this doesn't work.

Thanks.

Ian


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.


Index: configure.ac
===================================================================
RCS file: /cvs/src/src/gold/configure.ac,v
retrieving revision 1.47
diff -p -u -r1.47 configure.ac
--- configure.ac	6 Oct 2009 22:58:27 -0000	1.47
+++ configure.ac	9 Oct 2009 23:17:51 -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 -p -u -r1.53 fileread.cc
--- fileread.cc	30 Sep 2009 22:21:13 -0000	1.53
+++ fileread.cc	9 Oct 2009 23:17:51 -0000
@@ -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
 {
 
Index: fileread.h
===================================================================
RCS file: /cvs/src/src/gold/fileread.h,v
retrieving revision 1.36
diff -p -u -r1.36 fileread.h
--- fileread.h	6 Jul 2009 23:11:21 -0000	1.36
+++ fileread.h	9 Oct 2009 23:17:51 -0000
@@ -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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]