Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Doug Evans <dje@google.com>
Cc: Tom Tromey <tromey@redhat.com>, 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]
Date: Thu, 12 Jan 2012 19:28:00 -0000	[thread overview]
Message-ID: <20120112184750.GA21880@host2.jankratochvil.net> (raw)
In-Reply-To: <AANLkTimWI6s_nwGWE0EnfMJw7Ymc99sKM0J95Woadgz_@mail.gmail.com>

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  <jan.kratochvil@redhat.com>

	* 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


  parent reply	other threads:[~2012-01-12 18:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-13 13:27 [patch] Smaller gdb: -rdynamic -> -Wl,--dynamic-list Jan Kratochvil
2010-05-13 15:47 ` H.J. Lu
2010-05-16 21:08   ` Jan Kratochvil
2010-05-27 19:58     ` Tom Tromey
2010-05-28 23:11       ` Jan Kratochvil
2010-06-05  2:48         ` Doug Evans
2010-06-05 12:45           ` Jan Kratochvil
2010-06-08 15:23             ` Doug Evans
2010-06-08 16:08               ` Jan Kratochvil
2010-06-08 16:12                 ` Doug Evans
2010-06-08 17:37                   ` Jan Kratochvil
2012-01-12 19:28           ` Jan Kratochvil [this message]
2010-06-13 19:58     ` Andreas Schwab
2010-06-13 20:17       ` Andreas Schwab
2010-06-15 17:31         ` Tom Tromey
2010-06-15 19:09           ` Jan Kratochvil
2010-06-15 20:36           ` Jan Kratochvil
2010-06-21 18:26             ` Tom Tromey
2010-06-23 10:13               ` Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120112184750.GA21880@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox