components/binutils/patches/cache.c.patch
author Norm Jacobs <Norm.Jacobs@Oracle.COM>
Tue, 18 Oct 2016 13:46:28 -0500
changeset 7126 c0715e78cafb
parent 5110 92c73cda9414
permissions -rw-r--r--
24912627 gcc5 uses wrong triple on sparc

# Patch submitted to the binutils project:
# https://sourceware.org/bugzilla/show_bug.cgi?id=19260
--- bfd/cache.c	2014-10-14 00:32:02.000000000 -0700
+++ bfd/cache.c	2015-11-17 21:23:28.679754360 -0800
@@ -77,6 +77,23 @@
 {
   if (max_open_files == 0)
     {
+#if defined(__sun) && !defined(__sparcv9) && !defined(__x86_64__)
+      /* Very inelegant handling of the 255 file descriptor limit
+       * in 32-bit Solaris libc.
+       * The problem is that setrlimit(2) can raise RLIMIT_NOFILE
+       * in 32-bit to a value that is not supported by libc, resulting
+       * in "Too many open files" errors.
+       * This can happen even if max_open_files = rlim.rlim_cur / 8.
+       * For example, if rlim.rlim_cur == 65536, then max_open_files == 8192.
+       * This essentially reverts to the behavior from binutils 2.23.1
+       * for 32-bit Solaris only.
+       * We hope to have this 32-bit libc limitation removed soon.
+       * 64-bit Solaris libc does not have this limitation.
+       */
+      max_open_files = 16;
+      return max_open_files;
+#endif
+
       int max;
 #ifdef HAVE_GETRLIMIT
       struct rlimit rlim;