Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: Andreas Schwab <schwab@linux-m68k.org>,
	"H.J. Lu" <hjl.tools@gmail.com>,
	       gdb-patches@sourceware.org
Subject: Re: [patch] Smaller gdb: -rdynamic -> -Wl,--dynamic-list
Date: Tue, 15 Jun 2010 20:36:00 -0000	[thread overview]
Message-ID: <20100615203558.GA29393@host0.dyn.jankratochvil.net> (raw)
In-Reply-To: <m3mxuwursa.fsf@fleche.redhat.com>

On Tue, 15 Jun 2010 19:31:01 +0200, Tom Tromey wrote:
> >>>>> "Andreas" == Andreas Schwab <schwab@linux-m68k.org> writes:
> 
> Andreas> 2010-06-13  Andreas Schwab  <schwab@linux-m68k.org>
> Andreas> 	* configure.ac: Check for RDYNAMIC also for cross builds.
> Andreas> 	* configure: Regenerate.
> 
> This is ok.  Thanks.

A patch on top of this one is attached.

Original code had `-rdynamic' hardcoded in the .mh files.  .mh files get
included iff we have ${gdb_native}.  It means two things:

(1) The `-rdynamic' upgrade to `-Wl,--dynamic-list' makes sense only iff
    we have ${gdb_native}.

(2) Iff we have ${gdb_native} we should always provide at least `-rdynamic'.
    Current code with my change for non-$GCC configurations provided empty
    RDYNAMIC and thus breaking non-$GCC threading support.
    (OTOH there is a notice -rdynamic' is required only for $GCC thus probably
    nothing got broken.)

Moreover as the functionality is really tested (by either AC_RUN_IFELSE or
AC_TRY_LINK) it should not be needed to check $GCC.  On non-$GCC the
functionality test should always fail anyway.  Removed the $GCC check.

This patch is more a cleanup only / safer change from the original code before
`-Wl,--dynamic-list' introduction.  I am not aware on which configuration this
patch below can change anything.  No problem dropping it.

Tested build on x86_64-fedora13-linux-gnu and x86_64-rhel4-linux-gnu.


Thanks,
Jan


2010-06-15  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* configure.ac: Always set RDYNAMIC at least as `-rdynamic'.
	* configure: Regenerate.

--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1453,54 +1453,47 @@ aix*)
   ;;
 esac
 
+AC_MSG_CHECKING(for the dynamic export flag)
+dynamic_list=false
 if test "${gdb_native}" = yes; then
-   if test "$GCC" = "yes" ; then
-      # The dynamically loaded libthread_db needs access to symbols in the gdb
-      # executable.  Older GNU ld supports --export-dynamic but --dynamic-list
-      # may not be supported there.
-      AC_MSG_CHECKING(for the dynamic export flag)
-      old_LDFLAGS="$LDFLAGS"
-      # Older GNU ld supports --export-dynamic but --dynamic-list it does not.
-      RDYNAMIC="-Wl,--dynamic-list=${srcdir}/proc-service.list"
-      LDFLAGS="$LDFLAGS $RDYNAMIC"
-      dynamic_list=false
-      if test "${have_libpython}" = no; then
-	AC_TRY_LINK([], [], [dynamic_list=true])
-      else
-	# Workaround http://bugs.python.org/issue4434 where static
-	# libpythonX.Y.a would get its symbols required for
-	# pythonX.Y/lib-dynload/*.so modules hidden by -Wl,--dynamic-list.
-	# Problem does not happen for the recommended libpythonX.Y.so linkage.
-	old_CFLAGS="$CFLAGS"
-	CFLAGS="$CFLAGS $PYTHON_CFLAGS"
-	AC_RUN_IFELSE(
-	  AC_LANG_PROGRAM(
-	    [#include "]${have_libpython}[/Python.h"],
-	    [int err;
-	     Py_Initialize ();
-	     err = PyRun_SimpleString ("import itertools\n");
-	     Py_Finalize ();
-	     return err == 0 ? 0 : 1;]),
-	  [dynamic_list=true], [], [true])
-	CFLAGS="$old_CFLAGS"
-      fi
-      if $dynamic_list;then
-	found="-Wl,--dynamic-list"
-	RDYNAMIC='-Wl,--dynamic-list=$(srcdir)/proc-service.list'
-      else
-	RDYNAMIC="-rdynamic"
-	LDFLAGS="$old_LDFLAGS $RDYNAMIC"
-	AC_TRY_LINK([], [],
-		    [found="-rdynamic"],
-		    [found="no"
-		     # Error on its usage by .mh file.
-		     RDYNAMIC="no-rdynamic-available"])
-      fi
-      AC_SUBST(RDYNAMIC)
-      LDFLAGS="$old_LDFLAGS"
-      AC_MSG_RESULT($found)
+   # The dynamically loaded libthread_db needs access to symbols in the gdb
+   # executable.  Older GNU ld supports --export-dynamic but --dynamic-list
+   # may not be supported there.
+   old_LDFLAGS="$LDFLAGS"
+   # Older GNU ld supports --export-dynamic but --dynamic-list it does not.
+   RDYNAMIC="-Wl,--dynamic-list=${srcdir}/proc-service.list"
+   LDFLAGS="$LDFLAGS $RDYNAMIC"
+   if test "${have_libpython}" = no; then
+     AC_TRY_LINK([], [], [dynamic_list=true])
+   else
+     # Workaround http://bugs.python.org/issue4434 where static
+     # libpythonX.Y.a would get its symbols required for
+     # pythonX.Y/lib-dynload/*.so modules hidden by -Wl,--dynamic-list.
+     # Problem does not happen for the recommended libpythonX.Y.so linkage.
+     old_CFLAGS="$CFLAGS"
+     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
+     AC_RUN_IFELSE(
+       AC_LANG_PROGRAM(
+         [#include "]${have_libpython}[/Python.h"],
+         [int err;
+          Py_Initialize ();
+          err = PyRun_SimpleString ("import itertools\n");
+          Py_Finalize ();
+          return err == 0 ? 0 : 1;]),
+       [dynamic_list=true], [], [true])
+     CFLAGS="$old_CFLAGS"
    fi
+   LDFLAGS="$old_LDFLAGS"
+fi
+if $dynamic_list; then
+  found="-Wl,--dynamic-list"
+  RDYNAMIC='-Wl,--dynamic-list=$(srcdir)/proc-service.list'
+else
+  found="-rdynamic"
+  RDYNAMIC="-rdynamic"
 fi
+AC_SUBST(RDYNAMIC)
+AC_MSG_RESULT($found)
 
 dnl For certain native configurations, we need to check whether thread
 dnl support can be built in or not.


  parent reply	other threads:[~2010-06-15 20:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-13 13:27 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           ` [patch] -Wl,--dynamic-list: Test also PYTHON_LIBS, not just PYTHON_CFLAGS [Re: [patch] Smaller gdb: -rdynamic -> -Wl,--dynamic-list] Jan Kratochvil
2010-06-13 19:58     ` [patch] Smaller gdb: -rdynamic -> -Wl,--dynamic-list 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 [this message]
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=20100615203558.GA29393@host0.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=hjl.tools@gmail.com \
    --cc=schwab@linux-m68k.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