From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12602 invoked by alias); 12 Jan 2012 18:48:17 -0000 Received: (qmail 12586 invoked by uid 22791); 12 Jan 2012 18:48:16 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_LN,T_RP_MATCHES_RCVD 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; Thu, 12 Jan 2012 18:47:57 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q0CIlufL000488 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 12 Jan 2012 13:47:56 -0500 Received: from host2.jankratochvil.net (ovpn-116-21.ams2.redhat.com [10.36.116.21]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q0CIlpd4029929 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 12 Jan 2012 13:47:54 -0500 Date: Thu, 12 Jan 2012 19:28:00 -0000 From: Jan Kratochvil To: Doug Evans Cc: Tom Tromey , gdb-patches@sourceware.org Subject: [patch] -Wl,--dynamic-list: Test also PYTHON_LIBS, not just PYTHON_CFLAGS [Re: [patch] Smaller gdb: -rdynamic -> -Wl,--dynamic-list] Message-ID: <20120112184750.GA21880@host2.jankratochvil.net> References: <20100513131840.GA31032@host0.dyn.jankratochvil.net> <20100516180828.GA6448@host0.dyn.jankratochvil.net> <20100528185211.GA30412@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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: 2012-01/txt/msg00425.txt.bz2 Hello Doug, On Sat, 05 Jun 2010 04:48:33 +0200, Doug Evans wrote: > I've been playing with this a bit and got the following: > > "ImportError: /usr/grte/v1/k8-linux/lib/python2.4/lib-dynload/itertools.so: > undefined symbol: PyExc_StopIteration" > > when I did "import itertools". > > I was statically linking libpythonX.Y.a. I found current FSF GDB HEAD always uses -rdynamic with libpython as it falsely thinks -Wl,--dynamic-list is incompatible: configure:14652: gcc -o conftest -m64 -ggdb2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -fno-strict-aliasing -DNDEBUG -fwrapv -lmcheck -Wl,--dynamic-list=./proc-service.list conftest.c -ldl -lncurses -lz -lm >&5 /tmp/ccgMCqKR.o: In function `main': /home/jkratoch/redhat/gdb-clean/gdb/conftest.c:212: undefined reference to `Py_Initialize' /home/jkratoch/redhat/gdb-clean/gdb/conftest.c:213: undefined reference to `PyRun_SimpleStringFlags' /home/jkratoch/redhat/gdb-clean/gdb/conftest.c:214: undefined reference to `Py_Finalize' It does not make a difference now as with Python it would use -Xlinker -export-dynamic on top of it anyway due to Python issue10112. But after it gets fixed in Python GDB could become smaller (+its ld and ld.so faster) with this patch. It is mostly obvious it should use all the PYTHON_* compilation flags and not just PYTHON_CFLAGS. But I would welcome a test on your static libpython.a config if it does not break anything. Thanks, Jan 2012-01-12 Jan Kratochvil * configure.ac [${gdb_native} && ${have_libpython}]: Use also PYTHON_CPPFLAGS and PYTHON_LIBS. * configure: Regenerate. --- gdb/configure 2 Jan 2012 02:28:56 -0000 1.336 +++ gdb/configure 12 Jan 2012 18:43:25 -0000 @@ -14631,6 +14631,10 @@ rm -f core conftest.err conftest.$ac_obj # Problem does not happen for the recommended libpythonX.Y.so linkage. old_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PYTHON_CFLAGS" + old_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS" + old_LIBS="$LIBS" + LIBS="$LIBS $PYTHON_LIBS" if test "$cross_compiling" = yes; then : true else @@ -14657,6 +14661,8 @@ rm -f core *.core core.conftest.* gmon.o fi CFLAGS="$old_CFLAGS" + CPPFLAGS="$old_CPPFLAGS" + LIBS="$old_LIBS" fi LDFLAGS="$old_LDFLAGS" fi --- gdb/configure.ac 4 Jan 2012 08:17:00 -0000 1.152 +++ gdb/configure.ac 12 Jan 2012 18:43:27 -0000 @@ -1576,6 +1576,10 @@ 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_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS" + old_LIBS="$LIBS" + LIBS="$LIBS $PYTHON_LIBS" AC_RUN_IFELSE( AC_LANG_PROGRAM( [#include "]${have_libpython}[/Python.h"], @@ -1586,6 +1590,8 @@ if test "${gdb_native}" = yes; then return err == 0 ? 0 : 1;]), [dynamic_list=true], [], [true]) CFLAGS="$old_CFLAGS" + CPPFLAGS="$old_CPPFLAGS" + LIBS="$old_LIBS" fi LDFLAGS="$old_LDFLAGS" fi