This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[Patch] Fix build problem found by build robot
- From: "Steve Ellcey " <sellcey at imgtec dot com>
- To: <binutils at sourceware dot org>
- Date: Tue, 2 Dec 2014 10:31:45 -0800
- Subject: [Patch] Fix build problem found by build robot
- Authentication-results: sourceware.org; auth=none
As reported by the build robot in
https://sourceware.org/ml/binutils/2014-11/msg00376.html
some binutils builds are failing, I see it when compiling binutils in 32 bit
mode on an x86 box targeting MIPS. Compiling the toolchain in 64 bit mode
does not trigger the failure.
The failure is:
cc1: warnings being treated as errors
/scratch/gcc/nightly/src/binutils-gdb/bfd/ecoff.c: In function '_bfd_ecoff_slurp_symbol_table':
/scratch/gcc/nightly/src/binutils-gdb/bfd/ecoff.c:955: warning: comparison between signed and unsigned
Here is my proposed fix for the problem. I cast bfd_get_symcount (which is
unsigned int, the type of symcount in the bfd structure) to ptrdiff_t before
comparing it to 'internal_ptr - internal'. Both of those variables are
pointers.
OK for checkin?
Steve Ellcey
sellcey@imgtec.com
2014-12-02 Steve Ellcey <sellcey@mips.com>
* ecoff.c (_bfd_ecoff_slurp_symbol_table): Add cast.
diff --git a/bfd/ecoff.c b/bfd/ecoff.c
index 70783b1..e72e254 100644
--- a/bfd/ecoff.c
+++ b/bfd/ecoff.c
@@ -952,7 +952,7 @@ _bfd_ecoff_slurp_symbol_table (bfd *abfd)
and ecoff_data (abfd)->debug_info.symbolic_header.ifdMax can mean that
we have fewer symbols than we were expecting. Allow for this by updating
the symbol count and warning the user. */
- if (internal_ptr - internal < bfd_get_symcount (abfd))
+ if (internal_ptr - internal < (ptrdiff_t) bfd_get_symcount (abfd))
{
bfd_get_symcount (abfd) = internal_ptr - internal;
(*_bfd_error_handler)