aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog15
-rw-r--r--src/dispnew.c10
-rw-r--r--src/emacs.c30
-rw-r--r--src/lisp.h4
4 files changed, 34 insertions, 25 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index c21c21deb9a..767dfa47036 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,18 @@
12012-05-30 Paul Eggert <eggert@cs.ucla.edu>
2
3 Clean up __executable_start, monstartup when --enable-profiling.
4 The following changes affect the code only when profiling.
5 * dispnew.c (__executable_start): Rename from safe_bcopy.
6 Define only on platforms that need it.
7 * emacs.c: Include <sys/gmon.h> when profiling.
8 (_mcleanup): Remove decl, since <sys/gmon.h> does it now.
9 (__executable_start): Remove decl, since lisp.h does it now.
10 (safe_bcopy): Remove decl; no longer has that name.
11 (main): Coalesce #if into single bit of code, for simplicity.
12 Cast pointers to uintptr_t, since standard libraries want integers
13 and not pointers.
14 * lisp.h (__executable_start): New decl.
15
12012-05-30 Jim Meyering <meyering@redhat.com> 162012-05-30 Jim Meyering <meyering@redhat.com>
2 17
3 * callproc.c (Fcall_process_region): Include directory component 18 * callproc.c (Fcall_process_region): Include directory component
diff --git a/src/dispnew.c b/src/dispnew.c
index d8808de3caa..a23f2b9a959 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -332,11 +332,13 @@ DEFUN ("dump-redisplay-history", Fdump_redisplay_history,
332#endif /* GLYPH_DEBUG == 0 */ 332#endif /* GLYPH_DEBUG == 0 */
333 333
334 334
335#if defined PROFILING && !HAVE___EXECUTABLE_START 335#if (defined PROFILING \
336/* FIXME: only used to find text start for profiling. */ 336 && (defined __FreeBSD__ || defined GNU_LINUX || defined __MINGW32__) \
337 337 && !HAVE___EXECUTABLE_START)
338/* This function comes first in the Emacs executable and is used only
339 to estimate the text start for profiling. */
338void 340void
339safe_bcopy (const char *from, char *to, int size) 341__executable_start (void)
340{ 342{
341 abort (); 343 abort ();
342} 344}
diff --git a/src/emacs.c b/src/emacs.c
index d3e8e4466e3..8ffacdab1c6 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -65,6 +65,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
65#include "nsterm.h" 65#include "nsterm.h"
66#endif 66#endif
67 67
68#if (defined PROFILING \
69 && (defined __FreeBSD__ || defined GNU_LINUX || defined __MINGW32__))
70# include <sys/gmon.h>
71extern void moncontrol (int mode);
72#endif
73
68#ifdef HAVE_X_WINDOWS 74#ifdef HAVE_X_WINDOWS
69#include "xterm.h" 75#include "xterm.h"
70#endif 76#endif
@@ -320,9 +326,9 @@ pthread_t main_thread;
320#ifdef HAVE_NS 326#ifdef HAVE_NS
321/* NS autrelease pool, for memory management. */ 327/* NS autrelease pool, for memory management. */
322static void *ns_pool; 328static void *ns_pool;
323#endif 329#endif
330
324 331
325
326 332
327/* Handle bus errors, invalid instruction, etc. */ 333/* Handle bus errors, invalid instruction, etc. */
328#ifndef FLOAT_CATCH_SIGILL 334#ifndef FLOAT_CATCH_SIGILL
@@ -1664,32 +1670,14 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
1664#ifdef PROFILING 1670#ifdef PROFILING
1665 if (initialized) 1671 if (initialized)
1666 { 1672 {
1667 extern void _mcleanup ();
1668#ifdef __MINGW32__ 1673#ifdef __MINGW32__
1669 extern unsigned char etext asm ("etext"); 1674 extern unsigned char etext asm ("etext");
1670#else 1675#else
1671 extern char etext; 1676 extern char etext;
1672#endif 1677#endif
1673#ifdef HAVE___EXECUTABLE_START
1674 /* This symbol is defined by GNU ld to the start of the text
1675 segment. */
1676 extern char __executable_start[];
1677#else
1678 extern void safe_bcopy ();
1679#endif
1680 1678
1681 atexit (_mcleanup); 1679 atexit (_mcleanup);
1682#ifdef HAVE___EXECUTABLE_START 1680 monstartup ((uintptr_t) __executable_start, (uintptr_t) &etext);
1683 monstartup (__executable_start, &etext);
1684#else
1685 /* This uses safe_bcopy because that function comes first in the
1686 Emacs executable. It might be better to use something that
1687 gives the start of the text segment, but start_of_text is not
1688 defined on all systems now. */
1689 /* FIXME: Does not work on architectures with function
1690 descriptors. */
1691 monstartup (safe_bcopy, &etext);
1692#endif
1693 } 1681 }
1694 else 1682 else
1695 moncontrol (0); 1683 moncontrol (0);
diff --git a/src/lisp.h b/src/lisp.h
index a05e3075ec7..de627b9f4ad 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2758,6 +2758,10 @@ extern void replace_range_2 (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t,
2758extern void syms_of_insdel (void); 2758extern void syms_of_insdel (void);
2759 2759
2760/* Defined in dispnew.c */ 2760/* Defined in dispnew.c */
2761#if (defined PROFILING \
2762 && (defined __FreeBSD__ || defined GNU_LINUX || defined __MINGW32__))
2763void __executable_start (void) NO_RETURN;
2764#endif
2761extern Lisp_Object selected_frame; 2765extern Lisp_Object selected_frame;
2762extern Lisp_Object Vwindow_system; 2766extern Lisp_Object Vwindow_system;
2763EXFUN (Fding, 1); 2767EXFUN (Fding, 1);