This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
bfd/cache.c doesn't compile with gcc -m64 on Solaris
- From: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- To: binutils at sourceware dot org
- Date: Fri, 07 Feb 2014 11:05:07 +0100
- Subject: bfd/cache.c doesn't compile with gcc -m64 on Solaris
- Authentication-results: sourceware.org; auth=none
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?
Rainer
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)
#ifdef HAVE_GETRLIMIT
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;
else
#endif /* HAVE_GETRLIMIT */
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University