[RFA PATCH] Fix --dynamic-list test's workaround for http://bugs.python.org/issue4434.
Jan Kratochvil
jan.kratochvil@redhat.com
Mon Mar 11 18:14:00 GMT 2013
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 <palves@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
* 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"
More information about the Gdb-patches
mailing list