diff src/emacs.c @ 109539:d962ccf8829f

Use __executable_start to find start of text segment for profiling * emacs.c (main) [PROFILING]: Use __executable_start if defined to find start of text segment. * dispnew.c (safe_bcopy): Don't define if HAVE___EXECUTABLE_START is defined. * configure.in: Check for __executable_start.
author Andreas Schwab <schwab@linux-m68k.org>
date Sun, 25 Jul 2010 21:09:54 +0200
parents 4e99d7aa7526
children 05e7e7c46ff0
line wrap: on
line diff
--- a/src/emacs.c	Sun Jul 25 20:36:37 2010 +0200
+++ b/src/emacs.c	Sun Jul 25 21:09:54 2010 +0200
@@ -1747,9 +1747,18 @@
 #else
       extern char etext;
 #endif
+#ifdef HAVE___EXECUTABLE_START
+      /* This symbol is defined by GNU ld to the start of the text
+	 segment.  */
+      extern char __executable_start[];
+#else
       extern void safe_bcopy ();
+#endif
 
       atexit (_mcleanup);
+#ifdef HAVE___EXECUTABLE_START
+      monstartup (__executable_start, &etext);
+#else
       /* This uses safe_bcopy because that function comes first in the
 	 Emacs executable.  It might be better to use something that
 	 gives the start of the text segment, but start_of_text is not
@@ -1757,6 +1766,7 @@
       /* FIXME: Does not work on architectures with function
 	 descriptors.  */
       monstartup (safe_bcopy, &etext);
+#endif
     }
   else
     moncontrol (0);