From patchwork Thu Aug 4 22:07:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 108578 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 15C30B6F64 for ; Fri, 5 Aug 2011 08:08:20 +1000 (EST) Received: (qmail 22750 invoked by alias); 4 Aug 2011 22:08:15 -0000 Received: (qmail 22461 invoked by uid 22791); 4 Aug 2011 22:08:07 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from eddie.linux-mips.org (HELO cvs.linux-mips.org) (78.24.191.182) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 04 Aug 2011 22:07:48 +0000 Received: from localhost.localdomain ([127.0.0.1]:48625 "EHLO localhost.localdomain" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S1491779Ab1HDWHp (ORCPT ); Fri, 5 Aug 2011 00:07:45 +0200 Date: Thu, 4 Aug 2011 23:07:45 +0100 (BST) From: "Maciej W. Rozycki" To: binutils@sourceware.org cc: Steffen Dettmer , gcc-patches@gcc.gnu.org Subject: [PATCH] Correct zlib checks [Was: binutils prerequisites (recent zlib version - what else?)] In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (LFD 1167 2008-08-23) MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On Wed, 20 Apr 2011, Steffen Dettmer wrote: > I'm trying to build gcc-4.6.0 with binutils-2.21 in the same > source directory which fails with > > cc1: warnings being treated as errors > ../../../gcc-4.6.0/binutils/bfd/compress.c: In function > `bfd_compress_section_contents': > ../../../gcc-4.6.0/binutils/bfd/compress.c:100: warning: implicit > declaration of function `compressBound' > make[7]: *** [compress.lo] Error 1 > > (I guess without -Werror it won't link). > Google told that this is a zlib symbol and my zlib would be too > old. Do I need more libraries and stuff? Hmm, old topic... It looks to me we should be checking for this symbol then, rather than meaningless for us zlibVersion. I have updated comments respectively, particularly for objdump.c that still needs to link against -lz if libz is a static archive. Any comments about this patch? No change for gold/ required as it doesn't use BFD. Not sure why binutils/ and ld/ use their own checks instead of AM_ZLIB, but there you go. 2011-08-04 Maciej W. Rozycki config/ * zlib.m4 (AM_ZLIB): Check for compressBound instead of zlibVersion. 2011-08-04 Maciej W. Rozycki bfd/ * configure: Regenerate. 2011-08-04 Maciej W. Rozycki binutils/ * configure.in: Check for compressBound instead of zlibVersion. * configure: Regenerate. 2011-08-04 Maciej W. Rozycki gas/ * configure: Regenerate. 2011-08-04 Maciej W. Rozycki ld/ * configure.in: Check for compressBound instead of zlibVersion. * configure: Regenerate. Maciej binutils-zlib-check.patch Index: bfd/configure =================================================================== RCS file: /cvs/src/src/bfd/configure,v retrieving revision 1.353 diff -u -p -r1.353 configure --- bfd/configure 28 Jul 2011 22:35:13 -0000 1.353 +++ bfd/configure 4 Aug 2011 21:54:36 -0000 @@ -13743,9 +13743,10 @@ fi if test "$with_zlib" != "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing zlibVersion" >&5 -$as_echo_n "checking for library containing zlibVersion... " >&6; } -if test "${ac_cv_search_zlibVersion+set}" = set; then : + # BFD needs compressBound that is not present in older versions of zlib. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing compressBound" >&5 +$as_echo_n "checking for library containing compressBound... " >&6; } +if test "${ac_cv_search_compressBound+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -13758,11 +13759,11 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ #ifdef __cplusplus extern "C" #endif -char zlibVersion (); +char compressBound (); int main () { -return zlibVersion (); +return compressBound (); ; return 0; } @@ -13775,25 +13776,25 @@ for ac_lib in '' z; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_zlibVersion=$ac_res + ac_cv_search_compressBound=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if test "${ac_cv_search_zlibVersion+set}" = set; then : + if test "${ac_cv_search_compressBound+set}" = set; then : break fi done -if test "${ac_cv_search_zlibVersion+set}" = set; then : +if test "${ac_cv_search_compressBound+set}" = set; then : else - ac_cv_search_zlibVersion=no + ac_cv_search_compressBound=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_zlibVersion" >&5 -$as_echo "$ac_cv_search_zlibVersion" >&6; } -ac_res=$ac_cv_search_zlibVersion +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_compressBound" >&5 +$as_echo "$ac_cv_search_compressBound" >&6; } +ac_res=$ac_cv_search_compressBound if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" for ac_header in zlib.h Index: binutils/configure =================================================================== RCS file: /cvs/src/src/binutils/configure,v retrieving revision 1.139 diff -u -p -r1.139 configure --- binutils/configure 31 May 2011 08:54:47 -0000 1.139 +++ binutils/configure 4 Aug 2011 21:54:49 -0000 @@ -12970,11 +12970,12 @@ _ACEOF # Link in zlib if we can. This allows us to read compressed debug -# sections. This is used only by readelf.c (objdump uses bfd for -# reading compressed sections). -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing zlibVersion" >&5 -$as_echo_n "checking for library containing zlibVersion... " >&6; } -if test "${ac_cv_search_zlibVersion+set}" = set; then : +# sections. This is used explicitly by readelf.c, and implicitly +# by objdump.c which uses bfd (that requires compressBound) for +# reading compressed sections. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing compressBound" >&5 +$as_echo_n "checking for library containing compressBound... " >&6; } +if test "${ac_cv_search_compressBound+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -12987,11 +12988,11 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ #ifdef __cplusplus extern "C" #endif -char zlibVersion (); +char compressBound (); int main () { -return zlibVersion (); +return compressBound (); ; return 0; } @@ -13004,25 +13005,25 @@ for ac_lib in '' z; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_zlibVersion=$ac_res + ac_cv_search_compressBound=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if test "${ac_cv_search_zlibVersion+set}" = set; then : + if test "${ac_cv_search_compressBound+set}" = set; then : break fi done -if test "${ac_cv_search_zlibVersion+set}" = set; then : +if test "${ac_cv_search_compressBound+set}" = set; then : else - ac_cv_search_zlibVersion=no + ac_cv_search_compressBound=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_zlibVersion" >&5 -$as_echo "$ac_cv_search_zlibVersion" >&6; } -ac_res=$ac_cv_search_zlibVersion +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_compressBound" >&5 +$as_echo "$ac_cv_search_compressBound" >&6; } +ac_res=$ac_cv_search_compressBound if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" for ac_header in zlib.h Index: binutils/configure.in =================================================================== RCS file: /cvs/src/src/binutils/configure.in,v retrieving revision 1.103 diff -u -p -r1.103 configure.in --- binutils/configure.in 31 May 2011 08:54:46 -0000 1.103 +++ binutils/configure.in 4 Aug 2011 21:54:49 -0000 @@ -141,9 +141,10 @@ AC_CHECK_DECLS([fprintf, stpcpy, strstr, snprintf, vsnprintf]) # Link in zlib if we can. This allows us to read compressed debug -# sections. This is used only by readelf.c (objdump uses bfd for -# reading compressed sections). -AC_SEARCH_LIBS(zlibVersion, z, [AC_CHECK_HEADERS(zlib.h)]) +# sections. This is used explicitly by readelf.c, and implicitly +# by objdump.c which uses bfd (that requires compressBound) for +# reading compressed sections. +AC_SEARCH_LIBS(compressBound, z, [AC_CHECK_HEADERS(zlib.h)]) BFD_BINARY_FOPEN Index: config/zlib.m4 =================================================================== RCS file: /cvs/src/src/config/zlib.m4,v retrieving revision 1.1 diff -u -p -r1.1 zlib.m4 --- config/zlib.m4 24 Nov 2009 22:35:29 -0000 1.1 +++ config/zlib.m4 4 Aug 2011 21:54:50 -0000 @@ -9,7 +9,8 @@ AC_DEFUN([AM_ZLIB], [], [with_zlib=auto]) if test "$with_zlib" != "no"; then - AC_SEARCH_LIBS(zlibVersion, z, [AC_CHECK_HEADERS(zlib.h)]) + # BFD needs compressBound that is not present in older versions of zlib. + AC_SEARCH_LIBS(compressBound, z, [AC_CHECK_HEADERS(zlib.h)]) if test "$with_zlib" = "yes" -a "$ac_cv_header_zlib_h" != "yes"; then AC_MSG_ERROR([zlib (libz) library was explicitly requested but not found]) fi Index: gas/configure =================================================================== RCS file: /cvs/src/src/gas/configure,v retrieving revision 1.262 diff -u -p -r1.262 configure --- gas/configure 18 May 2011 09:41:14 -0000 1.262 +++ gas/configure 4 Aug 2011 21:55:06 -0000 @@ -13997,9 +13997,10 @@ fi if test "$with_zlib" != "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing zlibVersion" >&5 -$as_echo_n "checking for library containing zlibVersion... " >&6; } -if test "${ac_cv_search_zlibVersion+set}" = set; then : + # BFD needs compressBound that is not present in older versions of zlib. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing compressBound" >&5 +$as_echo_n "checking for library containing compressBound... " >&6; } +if test "${ac_cv_search_compressBound+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -14012,11 +14013,11 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ #ifdef __cplusplus extern "C" #endif -char zlibVersion (); +char compressBound (); int main () { -return zlibVersion (); +return compressBound (); ; return 0; } @@ -14029,25 +14030,25 @@ for ac_lib in '' z; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_zlibVersion=$ac_res + ac_cv_search_compressBound=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if test "${ac_cv_search_zlibVersion+set}" = set; then : + if test "${ac_cv_search_compressBound+set}" = set; then : break fi done -if test "${ac_cv_search_zlibVersion+set}" = set; then : +if test "${ac_cv_search_compressBound+set}" = set; then : else - ac_cv_search_zlibVersion=no + ac_cv_search_compressBound=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_zlibVersion" >&5 -$as_echo "$ac_cv_search_zlibVersion" >&6; } -ac_res=$ac_cv_search_zlibVersion +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_compressBound" >&5 +$as_echo "$ac_cv_search_compressBound" >&6; } +ac_res=$ac_cv_search_compressBound if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" for ac_header in zlib.h Index: ld/configure =================================================================== RCS file: /cvs/src/src/ld/configure,v retrieving revision 1.114 diff -u -p -r1.114 configure --- ld/configure 28 Mar 2011 10:27:07 -0000 1.114 +++ ld/configure 4 Aug 2011 21:55:31 -0000 @@ -16616,10 +16616,11 @@ _ACEOF # Link in zlib if we can. This is needed only for the bootstrap tests -# right now, since those tests use libbfd, which depends on zlib. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing zlibVersion" >&5 -$as_echo_n "checking for library containing zlibVersion... " >&6; } -if test "${ac_cv_search_zlibVersion+set}" = set; then : +# right now, since those tests use libbfd, which depends on zlib (and +# requires compressBound). +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing compressBound" >&5 +$as_echo_n "checking for library containing compressBound... " >&6; } +if test "${ac_cv_search_compressBound+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -16632,11 +16633,11 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ #ifdef __cplusplus extern "C" #endif -char zlibVersion (); +char compressBound (); int main () { -return zlibVersion (); +return compressBound (); ; return 0; } @@ -16649,25 +16650,25 @@ for ac_lib in '' z; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_zlibVersion=$ac_res + ac_cv_search_compressBound=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if test "${ac_cv_search_zlibVersion+set}" = set; then : + if test "${ac_cv_search_compressBound+set}" = set; then : break fi done -if test "${ac_cv_search_zlibVersion+set}" = set; then : +if test "${ac_cv_search_compressBound+set}" = set; then : else - ac_cv_search_zlibVersion=no + ac_cv_search_compressBound=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_zlibVersion" >&5 -$as_echo "$ac_cv_search_zlibVersion" >&6; } -ac_res=$ac_cv_search_zlibVersion +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_compressBound" >&5 +$as_echo "$ac_cv_search_compressBound" >&6; } +ac_res=$ac_cv_search_compressBound if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" for ac_header in zlib.h Index: ld/configure.in =================================================================== RCS file: /cvs/src/src/ld/configure.in,v retrieving revision 1.69 diff -u -p -r1.69 configure.in --- ld/configure.in 28 Mar 2011 10:27:07 -0000 1.69 +++ ld/configure.in 4 Aug 2011 21:55:31 -0000 @@ -216,8 +216,9 @@ BFD_BINARY_FOPEN AC_CHECK_DECLS([strstr, free, sbrk, getenv, environ]) # Link in zlib if we can. This is needed only for the bootstrap tests -# right now, since those tests use libbfd, which depends on zlib. -AC_SEARCH_LIBS(zlibVersion, z, [AC_CHECK_HEADERS(zlib.h)]) +# right now, since those tests use libbfd, which depends on zlib (and +# requires compressBound). +AC_SEARCH_LIBS(compressBound, z, [AC_CHECK_HEADERS(zlib.h)]) # When converting linker scripts into strings for use in emulation # files, use astring.sed if the compiler supports ANSI string