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]

[PATCH] Fix profiling support fallout


The attached patch fixes a build problem on OpenBSD/i386 (and probably
other a.out systems that have the profiling functions).  It makes us
use etext (without underscore) if _etext isn't available.

Checked in.

Mark

Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* configure.in: Add check for _etext.
	* maint.c (maintenance_set_profile_cmd): Use etext if _etext isn't
	available.
	* config.in, configure: regenerated.

Index: configure.in
===================================================================
RCS file: /cvs/src/src/gdb/configure.in,v
retrieving revision 1.121
diff -u -p -r1.121 configure.in
--- configure.in 1 Feb 2003 11:32:19 -0000 1.121
+++ configure.in 14 Feb 2003 20:02:02 -0000
@@ -204,6 +204,16 @@ AC_ARG_ENABLE(profiling,
  [enable_profiling=no])
 
 AC_CHECK_FUNCS(monstartup _mcleanup)
+AC_CACHE_CHECK([for _etext], ac_cv_var__etext,
+[AC_TRY_LINK(
+[#include <stdlib.h>
+extern char _etext;
+],
+[free (&_etext);], ac_cv_var__etext=yes, ac_cv_var__etext=no)])
+if test $ac_cv_var__etext = yes; then
+  AC_DEFINE(HAVE__ETEXT, 1,
+            [Define to 1 if your system has the _etext variable. ])
+fi
 if test "$enable_profiling" = yes ; then
   if test $ac_cv_func_monstartup = no || test $ac_cv_func__mcleanup = no; then
     AC_MSG_ERROR(--enable-profiling requires monstartup and _mcleanup)
Index: maint.c
===================================================================
RCS file: /cvs/src/src/gdb/maint.c,v
retrieving revision 1.33
diff -u -p -r1.33 maint.c
--- maint.c 27 Jan 2003 20:25:35 -0000 1.33
+++ maint.c 14 Feb 2003 20:02:02 -0000
@@ -645,6 +645,14 @@ static int maintenance_profile_p;
 
 #if defined (HAVE_MONSTARTUP) && defined (HAVE__MCLEANUP)
 
+#ifdef HAVE__ETEXT
+extern char _etext;
+#define TEXTEND &_etext
+#else
+extern char etext;
+#define TEXTEND &etext
+#endif
+
 static int profiling_state;
 
 static void
@@ -669,7 +677,6 @@ maintenance_set_profile_cmd (char *args,
       static int profiling_initialized;
 
       extern void monstartup (unsigned long, unsigned long);
-      extern char _etext;
       extern int main();
 
       if (!profiling_initialized)
@@ -680,7 +687,7 @@ maintenance_set_profile_cmd (char *args,
 
       /* "main" is now always the first function in the text segment, so use
 	 its address for monstartup.  */
-      monstartup ((unsigned long) &main, (unsigned long) &_etext);
+      monstartup ((unsigned long) &main, (unsigned long) TEXTEND);
     }
   else
     {


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