summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2010-07-25 21:09:54 +0200
committerAndreas Schwab <schwab@linux-m68k.org>2010-07-25 21:09:54 +0200
commitdcc19aacb785a5a0de0184342ab8eae714bff916 (patch)
tree108d2dcfc0ec36a97a0283a849f6de2ad2d8f75e /src
parent7bfa6d7793030944556daeede46dff688465cfd7 (diff)
downloademacs-dcc19aacb785a5a0de0184342ab8eae714bff916.tar.gz
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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/config.in3
-rw-r--r--src/dispnew.c2
-rw-r--r--src/emacs.c10
4 files changed, 19 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 0ed773d1acd..50a9fcb8ba8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
2010-07-25 Andreas Schwab <schwab@linux-m68k.org>
+ * 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.
+
* callproc.c (set_initial_environment): Avoid unbalanced braces.
2010-07-25 Ken Brown <kbrown@cornell.edu>
diff --git a/src/config.in b/src/config.in
index 40b62633446..647c8804dff 100644
--- a/src/config.in
+++ b/src/config.in
@@ -801,6 +801,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if you want to use the X window system. */
#undef HAVE_X_WINDOWS
+/* Define to 1 if you have the `__executable_start' function. */
+#undef HAVE___EXECUTABLE_START
+
/* Define to 1 if you have the `__fpending' function. */
#undef HAVE___FPENDING
diff --git a/src/dispnew.c b/src/dispnew.c
index fe64143ec07..73aafe07d94 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -436,7 +436,7 @@ DEFUN ("dump-redisplay-history", Fdump_redisplay_history,
#endif /* GLYPH_DEBUG == 0 */
-#ifdef PROFILING
+#if defined PROFILING && !HAVE___EXECUTABLE_START
/* FIXME: only used to find text start for profiling. */
void
diff --git a/src/emacs.c b/src/emacs.c
index fbae7763877..a5d57116c4f 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1747,9 +1747,18 @@ main (int argc, char **argv)
#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 @@ main (int argc, char **argv)
/* FIXME: Does not work on architectures with function
descriptors. */
monstartup (safe_bcopy, &etext);
+#endif
}
else
moncontrol (0);