This is the mail archive of the 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]

bfd/cache.c doesn't compile with gcc -m64 on Solaris

On current mainline, bfd/cache.c doesn't compile with gcc -m64 on
Solaris 8 to 11:

cc1: warnings being treated as errors
/vol/src/gnu/gdb/gdb-7.7/bfd/cache.c: In function 'bfd_cache_max_open':
/vol/src/gnu/gdb/gdb-7.7/bfd/cache.c:85: error: comparison between signed and unsigned integer expressions

This breaks both binutils 2.24 and gdb 7.7 builds and is a regression
from the previous releases.

The error is about

	  && rlim.rlim_cur != RLIM_INFINITY)

where <sys/resource.h> has

typedef unsigned long   rlim_t;
#define RLIM_INFINITY   (-3l)

While I've raised the issue with Oracle, this won't help for shipping
Solaris releases.  The problem can easily be avoided by casting
RLIM_INFINITY to rlim_t, as the following patch does.

Ok for mainline and the binutils 2.24 branch?


2014-02-06  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* cache.c (bfd_cache_max_open): Cast RLIM_INFINITY to rlim_t.

--- bfd/cache.c	2013/12/08 04:55:47	1.1
+++ bfd/cache.c	2014/02/06 16:13:27
@@ -82,7 +82,7 @@ bfd_cache_max_open (void)
       struct rlimit rlim;
       if (getrlimit (RLIMIT_NOFILE, &rlim) == 0
-	  && rlim.rlim_cur != RLIM_INFINITY)
+	  && rlim.rlim_cur != (rlim_t) RLIM_INFINITY)
 	max = rlim.rlim_cur / 8;
 #endif /* HAVE_GETRLIMIT */

Rainer Orth, Center for Biotechnology, Bielefeld University

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