From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9716 invoked by alias); 11 Mar 2013 18:14:21 -0000 Received: (qmail 9704 invoked by uid 22791); 11 Mar 2013 18:14:20 -0000 X-SWARE-Spam-Status: No, hits=-7.4 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_LN X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 11 Mar 2013 18:14:12 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2BIEBfL028247 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 11 Mar 2013 14:14:12 -0400 Received: from host2.jankratochvil.net (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r2BIE7nR013705 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Mon, 11 Mar 2013 14:14:10 -0400 Date: Mon, 11 Mar 2013 18:14:00 -0000 From: Jan Kratochvil To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [RFA PATCH] Fix --dynamic-list test's workaround for http://bugs.python.org/issue4434. Message-ID: <20130311181407.GA24981@host2.jankratochvil.net> References: <20130307231400.13859.88836.stgit@brno.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130307231400.13859.88836.stgit@brno.lan> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2013-03/txt/msg00481.txt.bz2 On Fri, 08 Mar 2013 00:14:00 +0100, Pedro Alves wrote: > After a chat on IRC, I noticed that my gdb binary was linking with > -Wl,--export-dynamic instead of the better -Wl,--dynamic-list. I agree with this fix (with the bit LDFLAGS -> LIBS). But in practice it does not change anything as the full linking commandline also contains LINKFORSHARED=-Xlinker -export-dynamic from /usr/lib/python2.7/config/Makefile which overrides it: ../readline/libreadline.a ../opcodes/libopcodes.a ../bfd/libbfd.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -ldl -ldl -lncurses -lz -lm -lpthread -ldl -lutil -lm -lpython2.7 -Xlinker -export-dynamic -lexpat -llzma ../libiberty/libiberty.a build-gnulib/import/libgnu.a -ldl -Wl,--dynamic-list=./proc-service.list The real fix to reduce the stripped GDB binary by 1MB of .dynsym back again after it was regressed by Python would be to drop gdb/proc-service.list, add gcc parameter -fvisibility=hidden and mark all the exported symbols (currently in gdb/proc-service.list) by __attribute__ ((visibility ("default"))). At least I hope that -fvisibility=hidden won't break Python on the other hand. Thanks, Jan gdb/ 2013-03-11 Pedro Alves Jan Kratochvil * configure: Regenerate. * configure.ac (check dynamic export flag): Link python test with $PYTHON_LIBS. diff --git a/gdb/configure.ac b/gdb/configure.ac index e501766..c17f587 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -1687,6 +1687,8 @@ if test "${gdb_native}" = yes; then # Problem does not happen for the recommended libpythonX.Y.so linkage. old_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PYTHON_CFLAGS" + old_LIBS="$LIBS" + LIBS="$LIBS $PYTHON_LIBS" AC_RUN_IFELSE( AC_LANG_PROGRAM( [#include "]${have_libpython}[/Python.h"], @@ -1696,6 +1698,7 @@ if test "${gdb_native}" = yes; then Py_Finalize (); return err == 0 ? 0 : 1;]), [dynamic_list=true], [], [true]) + LIBS="$old_LIBS" CFLAGS="$old_CFLAGS" fi LDFLAGS="$old_LDFLAGS"