Bug 12075 - binutils doesn't build with zlib-devel-1.2.5.
Summary: binutils doesn't build with zlib-devel-1.2.5.
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.21
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
: 12170 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-10-01 05:35 UTC by Pawel Sikora
Modified: 2010-10-29 19:59 UTC (History)
5 users (show)

See Also:
Host: i686-gnu-linux
Target: x86_64-pc-mingw32
Build: i686-gnu-linux
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pawel Sikora 2010-10-01 05:35:57 UTC
hi,

i've noticed an error during binutils crosscompilation
on i686-gnu-linux for x86-64-pc-mingw32 target:

(...)
cc1: warnings being treated as errors
compress.c: In function 'bfd_compress_section_contents':
compress.c:106:3: error: passing argument 2 of 'compress' from incompatible 
pointer type
/usr/include/zlib.h:1102:21: note: expected 'uLongf *' but argument is of type 
'bfd_size_type *'

afaics zlib expects address of ulong32 for argument 'compressed_size'
while bfd_compress_section_contents() passes address of bfd_size_type
which has 64-bits.

temporary patch for clean build:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/crossmingw64-binutils/
crossmingw64-binutils-zlib.patch?rev=1.1;content-type=text%2Fplain
Comment 1 Nick Clifton 2010-10-27 14:35:56 UTC
Hi Pawel,

  This should no longer be a problem because the code has been rewritten and the compress function is no longer being used.

Cheers
  Nick
Comment 2 H.J. Lu 2010-10-29 18:37:43 UTC
Binutils isn't compatible with zlib 1.2.5.
Comment 3 H.J. Lu 2010-10-29 18:38:19 UTC
*** Bug 12170 has been marked as a duplicate of this bug. ***
Comment 4 H.J. Lu 2010-10-29 18:40:49 UTC
I have no problem with zlib 1.2.3. Is this a new problem
with zlib 1.2.5?
Comment 5 Ozkan Sezer 2010-10-29 18:44:23 UTC
(In reply to comment #4)
> I have no problem with zlib 1.2.3. Is this a new problem
> with zlib 1.2.5?

Bug 12170 is already reported using zlib 1.2.3, so the answer is no.
Comment 6 Ozkan Sezer 2010-10-29 19:31:05 UTC
Changing the type of compressed_size from bfd_size_type to uLong should solve it because we are playing with zlib's rules here anyway.  Like:

Index: bfd/compress.c
===================================================================
RCS file: /cvs/src/src/bfd/compress.c,v
retrieving revision 1.5
diff -u -p -r1.5 compress.c
--- bfd/compress.c	29 Oct 2010 12:10:23 -0000	1.5
+++ bfd/compress.c	29 Oct 2010 19:23:33 -0000
@@ -94,7 +94,7 @@ bfd_compress_section_contents (bfd *abfd
   bfd_set_error (bfd_error_invalid_operation);
   return FALSE;
 #else
-  bfd_size_type compressed_size;
+  uLong compressed_size;
   bfd_byte *compressed_buffer;
 
   compressed_size = compressBound (uncompressed_size) + 12;

Compiled fine for me on fedora9 for x86_64-w64-mingw32.