This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gdbserver] Use -rdynamic where possible


The link flag -rdynamic causes globally visible symbols in an ELF executable
to be added to the dynamic symbol table by default, so that they can be used
by later loaded libraries - normally only symbols referenced by dynamic
libraries seen at link time are executed.  GDB uses this flag because it
dlopen's libthread_db.  Gdbserver links to libthread_db directly, so
normally does not need this - however, if you have LinuxThreads in /lib
and at runtime use NPTL from /lib/tls, you'll need to make sure
ps_get_thread_area is dynamically exported by forcing -rdynamic.

Committed, along with a copyright year tweak for configure.in - I missed it
last year.

-- 
Daniel Jacobowitz

2004-10-16  Daniel Jacobowitz  <dan@debian.org>

	* configure.in: Test for -rdynamic.
	* configure: Regenerated.
	* Makefile (INTERNAL_LDFLAGS): New.
	(gdbserver, gdbreplay): Use it.

Index: configure.in
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/configure.in,v
retrieving revision 1.13
diff -u -p -r1.13 configure.in
--- configure.in	29 Jun 2003 04:01:39 -0000	1.13
+++ configure.in	16 Oct 2004 16:16:58 -0000
@@ -1,5 +1,5 @@
 dnl Autoconf configure script for GDB server.
-dnl Copyright 2000, 2002 Free Software Foundation, Inc.
+dnl Copyright 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
 dnl
 dnl This file is part of GDB.
 dnl
@@ -114,6 +114,11 @@ if test "$srv_linux_thread_db" = "yes"; 
   else
     srv_libs="$srv_cv_thread_db"
   fi
+  old_LDFLAGS="$LDFLAGS"
+  LDFLAGS="$LDFLAGS -rdynamic"
+  AC_TRY_LINK([], [], [RDYNAMIC=-rdynamic], [RDYNAMIC=])
+  AC_SUBST(RDYNAMIC)
+  LDFLAGS="$old_LDFLAGS"
 fi
 
 if test "$srv_linux_thread_db" = "yes"; then
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/Makefile.in,v
retrieving revision 1.26
diff -u -p -r1.26 Makefile.in
--- Makefile.in	13 Sep 2004 20:55:42 -0000	1.26
+++ Makefile.in	16 Oct 2004 16:16:58 -0000
@@ -103,6 +103,7 @@ INTERNAL_CFLAGS =  $(WARN_CFLAGS) ${CFLA
 # LDFLAGS is specifically reserved for setting from the command line
 # when running make.
 LDFLAGS = @LDFLAGS@
+INTERNAL_LDFLAGS = $(LDFLAGS) @RDYNAMIC@
 
 # Perhaps should come from parent Makefile
 VERSION = gdbserver-4.12.3
@@ -171,12 +172,12 @@ clean-info:
 
 gdbserver: $(OBS) ${ADD_DEPS} ${CDEPS}
 	rm -f gdbserver
-	${CC-LD} $(GLOBAL_CFLAGS) $(LDFLAGS) -o gdbserver $(OBS) \
+	${CC-LD} $(GLOBAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbserver $(OBS) \
 	  $(GDBSERVER_LIBS) $(XM_CLIBS)
 
 gdbreplay: gdbreplay.o
 	rm -f gdbreplay
-	${CC-LD} $(GLOBAL_CFLAGS) $(LDFLAGS) -o gdbreplay gdbreplay.o \
+	${CC-LD} $(GLOBAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbreplay gdbreplay.o \
 	  $(XM_CLIBS)
 
 # Put the proper machine-specific files first, so M-. on a machine


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]