all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Subsystem initialization functions in normal binary
@ 2015-01-12 10:59 Dmitry Antipov
  2015-01-13  7:43 ` Paul Eggert
  2015-01-13  8:34 ` Andreas Schwab
  0 siblings, 2 replies; 4+ messages in thread
From: Dmitry Antipov @ 2015-01-12 10:59 UTC (permalink / raw
  To: Emacs development discussions

[-- Attachment #1: Type: text/plain, Size: 392 bytes --]

IIUC functions syms_of_XXX, keys_of_YYY and init_ZZZ_once are never
called in a normal (dumped) executable; so what's about putting them
into a special section and strip the latter at all?  This patch
illustrates an idea, with yet another make-docfile trick.  (Also we
can offload lisp.h and other headers from declarations which are easy
to generate and put into globals.h instead).

Dmitry

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: strip_once.patch --]
[-- Type: text/x-diff; name="strip_once.patch", Size: 29479 bytes --]

diff --git a/configure.ac b/configure.ac
index 4cad214..bb9eb37 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4818,6 +4818,18 @@ if test "$emacs_cv_struct_alignment" = yes; then
      structure to an N-byte boundary.])
 fi
 
+AC_CACHE_CHECK([whether function may be placed in a specified section],
+  [emacs_cv_function_section],
+  [AC_COMPILE_IFELSE(
+     [AC_LANG_PROGRAM([[void __attribute__ ((section (".once"))) f (void) {}]])],
+     [emacs_cv_function_section=yes],
+     [emacs_cv_function_section=no])])
+if test "$emacs_cv_function_section" = yes; then
+  AC_DEFINE([HAVE_FUNCTION_ATTRIBUTE_SECTION], 1,
+    [Define to 1 if function '__attribute__ ((section (NAME)))' is supported.])
+  AC_CHECK_TOOL(STRIP, strip, :)
+fi
+
 if test "${GNU_MALLOC}" = "yes" ; then
   AC_DEFINE(GNU_MALLOC, 1,
 	    [Define to 1 if you want to use the GNU memory allocator.])
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c
index bc5420e..b54a87d 100644
--- a/lib-src/make-docfile.c
+++ b/lib-src/make-docfile.c
@@ -39,6 +39,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>   /* config.h unconditionally includes this anyway */
+#include <ctype.h>
 
 #ifdef WINDOWSNT
 /* Defined to be sys_fopen in ms-w32.h, but only #ifdef emacs, so this
@@ -246,6 +247,12 @@ start_globals (void)
 \f
 static char input_buffer[128];
 
+static char *
+copy_input_buffer (size_t len)
+{
+  return memcpy (xmalloc (len), input_buffer, len);
+}
+
 /* Some state during the execution of `read_c_string_or_comment'.  */
 struct rcsoc_state
 {
@@ -554,7 +561,8 @@ enum global_type
   EMACS_INTEGER,
   BOOLEAN,
   SYMBOL,
-  FUNCTION
+  FUNCTION,
+  ONCEFN
 };
 
 /* A single global.  */
@@ -643,7 +651,7 @@ static void
 write_globals (void)
 {
   int i, j;
-  bool seen_defun = false;
+  bool seen_defun = false, seen_oncefn = false;
   int symnum = 0;
   int num_symbols = 0;
   qsort (globals, num_globals, sizeof (struct global), compare_globals);
@@ -680,6 +688,13 @@ write_globals (void)
 	case LISP_OBJECT:
 	  type = "Lisp_Object";
 	  break;
+	case ONCEFN:
+	  if (!seen_oncefn)
+	    {
+	      putchar ('\n');
+	      seen_oncefn = true;
+	    }
+	  /* Fallthrough case.  */
 	case SYMBOL:
 	case FUNCTION:
 	  if (!seen_defun)
@@ -706,7 +721,7 @@ write_globals (void)
 		 "DEFINE_LISP_SYMBOL_END (%s)\n\n"),
 		globals[i].name, globals[i].name, symnum++,
 		globals[i].name, globals[i].name, globals[i].name);
-      else
+      else if (globals[i].type == FUNCTION)
 	{
 	  /* It would be nice to have a cleaner way to deal with these
 	     special hacks.  */
@@ -760,6 +775,19 @@ write_globals (void)
 
 	  puts (";");
 	}
+      else if (globals[i].type == ONCEFN)
+	{
+	  fputs ("extern void ", stdout);
+#ifdef HAVE_FUNCTION_ATTRIBUTE_SECTION
+	  fputs ("__attribute__ ((section (\".once\"))) ", stdout);
+#endif
+	  fputs (globals[i].name, stdout);
+	  fputs (" (void);\n", stdout);
+	  if (i == num_globals - 1)
+	    puts ("");
+	}
+      else
+	abort ();
     }
 
   if (!seen_defun)
@@ -817,6 +845,23 @@ scan_c_file (char *filename, const char *mode)
   return scan_c_stream (infile);
 }
 
+/* Return 1 if next input from INFILE is equal to P, -1 if EOF,
+   0 if input doesn't match.  */
+
+static int
+stream_match (FILE *infile, const char *p)
+{
+  for (; *p; p++)
+    {
+      int c = getc (infile);
+      if (c == EOF)
+	return -1;
+      if (c != *p)
+	return 0;
+    }
+  return 1;
+}
+
 static int
 scan_c_stream (FILE *infile)
 {
@@ -910,6 +955,105 @@ scan_c_stream (FILE *infile)
 	  c = getc (infile);
 	  defunflag = c == 'U';
 	}
+      else if (c == 's')
+	{
+	  /* Try syms_of_XXX.  */
+	  if (stream_match (infile, "yms_of_") != 1)
+	    continue;
+	  else
+	    {
+	      char *p = input_buffer + 8;
+
+	      memcpy (input_buffer, "syms_of_", 8);
+
+	      while (1)
+		{
+		  c = getc (infile);
+		  if (c < 0)
+		    goto eof;
+		  else if (p - input_buffer > sizeof (input_buffer) - 1)
+		    abort ();
+		  else if (isalnum (c) || c == '_')
+		    *p++ = c;
+		  else
+		    break;
+		}
+	      if (p != input_buffer + 8)
+		{
+		  *p = '\0';
+		  name = copy_input_buffer (p - input_buffer + 1);
+		  add_global (ONCEFN, name, 0, 0);
+		  continue;
+		}
+	    }
+	}
+      else if (c == 'k')
+	{
+	  /* Try keys_of_YYY.  */
+	  if (stream_match (infile, "eys_of_") != 1)
+	    continue;
+	  else
+	    {
+	      char *p = input_buffer + 8;
+
+	      memcpy (input_buffer, "keys_of_", 8);
+
+	      while (1)
+		{
+		  c = getc (infile);
+		  if (c < 0)
+		    goto eof;
+		  else if (p - input_buffer > sizeof (input_buffer) - 1)
+		    abort ();
+		  else if (isalnum (c) || c == '_')
+		    *p++ = c;
+		  else
+		    break;
+		}
+	      if (p != input_buffer + 8)
+		{
+		  *p = '\0';
+		  name = copy_input_buffer (p - input_buffer + 1);
+		  add_global (ONCEFN, name, 0, 0);
+		  continue;
+		}
+	    }
+	}
+      else if (c == 'i')
+	{
+	  /* Try init_ZZZ_once.  */
+	  if (stream_match (infile, "nit_") != 1)
+	    continue;
+	  else
+	    {
+	      char *p = input_buffer + 5;
+
+	      memcpy (input_buffer, "init_", 5);
+
+	      while (1)
+		{
+		  c = getc (infile);
+		  if (c < 0)
+		    goto eof;
+		  else if (p - input_buffer > sizeof (input_buffer) - 1)
+		    abort ();
+		  else if (isalnum (c) || c == '_')
+		    *p++ = c;
+		  else
+		    break;
+		}
+	      if (p != input_buffer + 5)
+		{
+		  *p = '\0';
+		  if (p > input_buffer + 9 && !strcmp (p - 5, "_once"))
+		    {
+		      name = copy_input_buffer (p - input_buffer + 1);
+		      add_global (ONCEFN, name, 0, 0);
+		      continue;
+		    }
+		}
+	    }
+	}
       else continue;
 
       if (generate_globals
@@ -957,8 +1101,7 @@ scan_c_stream (FILE *infile)
 		    || c == '\n' || c == '\r'));
 	  input_buffer[i] = '\0';
 
-	  name = xmalloc (i + 1);
-	  memcpy (name, input_buffer, i + 1);
+	  name = copy_input_buffer (i + 1);
 
 	  if (type == SYMBOL)
 	    {
diff --git a/src/Makefile.in b/src/Makefile.in
index 2ac34f5..a126fe5 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -117,6 +117,10 @@ SETFATTR = @SETFATTR@
 PAXCTL_if_present = $(or $(PAXCTL),: paxctl)
 SETFATTR_if_present = $(or $(SETFATTR),: setfattr)
 
+## Substituted only if we strip .once section.
+STRIP = @STRIP@
+STRIP_if_present = $(or $(STRIP),: strip)
+
 ## Some systems define this to request special libraries.
 LIBS_SYSTEM=@LIBS_SYSTEM@
 
@@ -456,6 +460,7 @@ ifeq ($(CANNOT_DUMP),yes)
 else
 	LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump
 	$(PAXCTL_if_present) -zex $@
+	$(STRIP_if_present) -R .once $@
 	ln -f $@ bootstrap-emacs$(EXEEXT)
 endif
 
diff --git a/src/composite.h b/src/composite.h
index fb9f9eb..5a9ca45 100644
--- a/src/composite.h
+++ b/src/composite.h
@@ -197,7 +197,6 @@ extern bool find_composition (ptrdiff_t, ptrdiff_t, ptrdiff_t *, ptrdiff_t *,
 			      Lisp_Object *, Lisp_Object);
 extern void update_compositions (ptrdiff_t, ptrdiff_t, int);
 extern void make_composition_value_copy (Lisp_Object);
-extern void syms_of_composite (void);
 extern void compose_text (ptrdiff_t, ptrdiff_t, Lisp_Object, Lisp_Object,
                           Lisp_Object);
 
diff --git a/src/cygw32.h b/src/cygw32.h
index e14e3d1..628ee6d 100644
--- a/src/cygw32.h
+++ b/src/cygw32.h
@@ -33,7 +33,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "lisp.h"
 #include "coding.h"
 
-extern void syms_of_cygw32 (void);
 extern char * w32_strerror (int error_no);
 
 #endif /* CYGW32_H */
diff --git a/src/dispextern.h b/src/dispextern.h
index e9e6f70..3760ba0 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -3488,7 +3488,6 @@ void update_single_window (struct window *);
 void do_pending_window_change (bool);
 void change_frame_size (struct frame *, int, int, bool, bool, bool, bool);
 void init_display (void);
-void syms_of_display (void);
 extern void spec_glyph_lookup_face (struct window *, GLYPH *);
 extern void fill_up_frame_row_with_spaces (struct glyph_row *, int);
 
diff --git a/src/emacs.c b/src/emacs.c
index d09c3c3..f61cf07 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -209,7 +209,6 @@ char **initial_argv;
 int initial_argc;

 static void sort_args (int argc, char **argv);
-static void syms_of_emacs (void);
 
 /* C99 needs each string to be at most 4095 characters, and the usage
    strings below are split to not overflow this limit.  */
diff --git a/src/font.h b/src/font.h
index 5a3e38a..34800b9 100644
--- a/src/font.h
+++ b/src/font.h
@@ -772,32 +772,22 @@ extern void font_filter_properties (Lisp_Object font,
 
 #ifdef HAVE_FREETYPE
 extern struct font_driver ftfont_driver;
-extern void syms_of_ftfont (void);
 #endif	/* HAVE_FREETYPE */
 #ifdef HAVE_X_WINDOWS
 extern struct font_driver xfont_driver;
-extern void syms_of_xfont (void);
-extern void syms_of_ftxfont (void);
 #ifdef HAVE_XFT
 extern struct font_driver xftfont_driver;
 #endif
 #if defined HAVE_FREETYPE || defined HAVE_XFT
 extern struct font_driver ftxfont_driver;
-extern void syms_of_xftfont (void);
 #endif
-#ifdef HAVE_BDFFONT
-extern void syms_of_bdffont (void);
-#endif	/* HAVE_BDFFONT */
 #endif	/* HAVE_X_WINDOWS */
 #ifdef HAVE_NTGUI
 extern struct font_driver w32font_driver;
 extern struct font_driver uniscribe_font_driver;
-extern void syms_of_w32font (void);
 #endif	/* HAVE_NTGUI */
 #ifdef HAVE_NS
 extern struct font_driver nsfont_driver;
-extern void syms_of_nsfont (void);
-extern void syms_of_macfont (void);
 #endif	/* HAVE_NS */
 
 #ifndef FONT_DEBUG
diff --git a/src/gnutls.h b/src/gnutls.h
index fd69682..1ec68ec 100644
--- a/src/gnutls.h
+++ b/src/gnutls.h
@@ -83,7 +83,4 @@ extern void emacs_gnutls_transport_set_errno (gnutls_session_t state, int err);
 extern Lisp_Object emacs_gnutls_deinit (Lisp_Object);
 
 #endif
-
-extern void syms_of_gnutls (void);
-
 #endif
diff --git a/src/intervals.h b/src/intervals.h
index b2260d0..0880ee3 100644
--- a/src/intervals.h
+++ b/src/intervals.h
@@ -290,8 +290,6 @@ Lisp_Object get_char_property_and_overlay (Lisp_Object, Lisp_Object,
 extern int text_property_stickiness (Lisp_Object prop, Lisp_Object pos,
                                      Lisp_Object buffer);
 
-extern void syms_of_textprop (void);
-
 #include "composite.h"
 
 INLINE_HEADER_END
diff --git a/src/keymap.h b/src/keymap.h
index 215dd3f..17b1350 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -39,8 +39,6 @@ extern void describe_map_tree (Lisp_Object, bool, Lisp_Object, Lisp_Object,
 extern ptrdiff_t current_minor_maps (Lisp_Object **, Lisp_Object **);
 extern void initial_define_key (Lisp_Object, int, const char *);
 extern void initial_define_lispy_key (Lisp_Object, const char *, const char *);
-extern void syms_of_keymap (void);
-extern void keys_of_keymap (void);
 
 typedef void (*map_keymap_function_t)
      (Lisp_Object key, Lisp_Object val, Lisp_Object args, void *data);
diff --git a/src/lisp.h b/src/lisp.h
index 9ed9375..caeb34c 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3480,36 +3480,22 @@ extern _Noreturn void args_out_of_range_3 (Lisp_Object, Lisp_Object,
 					   Lisp_Object);
 extern Lisp_Object do_symval_forwarding (union Lisp_Fwd *);
 extern void set_internal (Lisp_Object, Lisp_Object, Lisp_Object, bool);
-extern void syms_of_data (void);
 extern void swap_in_global_binding (struct Lisp_Symbol *);
 
-/* Defined in cmds.c */
-extern void syms_of_cmds (void);
-extern void keys_of_cmds (void);
-
 /* Defined in coding.c.  */
 extern Lisp_Object detect_coding_system (const unsigned char *, ptrdiff_t,
                                          ptrdiff_t, bool, bool, Lisp_Object);
 extern void init_coding (void);
-extern void init_coding_once (void);
-extern void syms_of_coding (void);
 
 /* Defined in character.c.  */
 extern ptrdiff_t chars_in_text (const unsigned char *, ptrdiff_t);
 extern ptrdiff_t multibyte_chars_in_text (const unsigned char *, ptrdiff_t);
-extern void syms_of_character (void);
 
 /* Defined in charset.c.  */
 extern void init_charset (void);
-extern void init_charset_once (void);
-extern void syms_of_charset (void);
 /* Structure forward declarations.  */
 struct charset;
 
-/* Defined in syntax.c.  */
-extern void init_syntax_once (void);
-extern void syms_of_syntax (void);
-
 /* Defined in fns.c.  */
 enum { NEXT_ALMOST_PRIME_LIMIT = 11 };
 extern EMACS_INT next_almost_prime (EMACS_INT) ATTRIBUTE_CONST;
@@ -3539,24 +3525,19 @@ extern ptrdiff_t string_char_to_byte (Lisp_Object, ptrdiff_t);
 extern ptrdiff_t string_byte_to_char (Lisp_Object, ptrdiff_t);
 extern Lisp_Object string_to_multibyte (Lisp_Object);
 extern Lisp_Object string_make_unibyte (Lisp_Object);
-extern void syms_of_fns (void);
 
 /* Defined in floatfns.c.  */
-extern void syms_of_floatfns (void);
 extern Lisp_Object fmod_float (Lisp_Object x, Lisp_Object y);
 
 /* Defined in fringe.c.  */
-extern void syms_of_fringe (void);
 extern void init_fringe (void);
 #ifdef HAVE_WINDOW_SYSTEM
 extern void mark_fringe_data (void);
-extern void init_fringe_once (void);
 #endif /* HAVE_WINDOW_SYSTEM */
 
 /* Defined in image.c.  */
 extern int x_bitmap_mask (struct frame *, ptrdiff_t);
 extern void reset_image_types (void);
-extern void syms_of_image (void);
 
 /* Defined in insdel.c.  */
 extern void move_gap_both (ptrdiff_t, ptrdiff_t);
@@ -3602,7 +3583,6 @@ extern void adjust_markers_for_delete (ptrdiff_t, ptrdiff_t,
 extern void replace_range (ptrdiff_t, ptrdiff_t, Lisp_Object, bool, bool, bool);
 extern void replace_range_2 (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t,
 			     const char *, ptrdiff_t, ptrdiff_t, bool);
-extern void syms_of_insdel (void);
 
 /* Defined in dispnew.c.  */
 #if (defined PROFILING \
@@ -3637,15 +3617,11 @@ extern void truncate_echo_area (ptrdiff_t);
 extern void redisplay (void);
 
 void set_frame_cursor_types (struct frame *, Lisp_Object);
-extern void syms_of_xdisp (void);
 extern void init_xdisp (void);
 extern Lisp_Object safe_eval (Lisp_Object);
 extern int pos_visible_p (struct window *, ptrdiff_t, int *,
                           int *, int *, int *, int *, int *);
 
-/* Defined in xsettings.c.  */
-extern void syms_of_xsettings (void);
-
 /* Defined in vm-limit.c.  */
 extern void memory_warnings (void *, void (*warnfun) (const char *));
 
@@ -3810,9 +3786,7 @@ extern void free_save_value (Lisp_Object);
 extern Lisp_Object build_overlay (Lisp_Object, Lisp_Object, Lisp_Object);
 extern void free_marker (Lisp_Object);
 extern void free_cons (struct Lisp_Cons *);
-extern void init_alloc_once (void);
 extern void init_alloc (void);
-extern void syms_of_alloc (void);
 extern struct buffer * allocate_buffer (void);
 extern int valid_lisp_object_p (Lisp_Object);
 extern int relocatable_string_data_p (const char *);
@@ -3844,7 +3818,6 @@ extern void map_char_table_for_charset (void (*c_function) (Lisp_Object, Lisp_Ob
 					Lisp_Object, struct charset *,
 					unsigned, unsigned);
 extern Lisp_Object uniprop_table (Lisp_Object);
-extern void syms_of_chartab (void);
 
 /* Defined in print.c.  */
 extern Lisp_Object Vprin1_to_string_buffer;
@@ -3858,8 +3831,6 @@ extern Lisp_Object internal_with_output_to_temp_buffer
         (const char *, Lisp_Object (*) (Lisp_Object), Lisp_Object);
 #define FLOAT_TO_STRING_BUFSIZE 350
 extern int float_to_string (char *, double);
-extern void init_print_once (void);
-extern void syms_of_print (void);
 
 /* Defined in doprnt.c.  */
 extern ptrdiff_t doprnt (char *, ptrdiff_t, const char *, const char *,
@@ -3894,7 +3865,6 @@ extern void map_obarray (Lisp_Object, void (*) (Lisp_Object, Lisp_Object),
 extern void dir_warning (const char *, Lisp_Object);
 extern void init_obarray (void);
 extern void init_lread (void);
-extern void syms_of_lread (void);
 
 INLINE Lisp_Object
 intern (const char *str)
@@ -3968,12 +3938,10 @@ extern _Noreturn void verror (const char *, va_list)
   ATTRIBUTE_FORMAT_PRINTF (1, 0);
 extern void un_autoload (Lisp_Object);
 extern Lisp_Object call_debugger (Lisp_Object arg);
-extern void init_eval_once (void);
 extern Lisp_Object safe_call (ptrdiff_t, Lisp_Object, ...);
 extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object);
 extern Lisp_Object safe_call2 (Lisp_Object, Lisp_Object, Lisp_Object);
 extern void init_eval (void);
-extern void syms_of_eval (void);
 extern void unwind_body (Lisp_Object);
 extern ptrdiff_t record_in_backtrace (Lisp_Object, Lisp_Object *, ptrdiff_t);
 extern void mark_specpdl (void);
@@ -3995,7 +3963,6 @@ extern Lisp_Object make_buffer_string (ptrdiff_t, ptrdiff_t, bool);
 extern Lisp_Object make_buffer_string_both (ptrdiff_t, ptrdiff_t, ptrdiff_t,
 					    ptrdiff_t, bool);
 extern void init_editfns (void);
-extern void syms_of_editfns (void);
 
 /* Defined in buffer.c.  */
 extern bool mouse_face_overlay_overlaps (Lisp_Object);
@@ -4008,10 +3975,7 @@ extern void report_overlay_modification (Lisp_Object, Lisp_Object, bool,
 extern bool overlay_touches_p (ptrdiff_t);
 extern Lisp_Object other_buffer_safely (Lisp_Object);
 extern Lisp_Object get_truename_buffer (Lisp_Object);
-extern void init_buffer_once (void);
 extern void init_buffer (int);
-extern void syms_of_buffer (void);
-extern void keys_of_buffer (void);
 
 /* Defined in marker.c.  */
 
@@ -4026,7 +3990,6 @@ extern Lisp_Object set_marker_both (Lisp_Object, Lisp_Object, ptrdiff_t, ptrdiff
 extern Lisp_Object set_marker_restricted_both (Lisp_Object, Lisp_Object,
                                                ptrdiff_t, ptrdiff_t);
 extern Lisp_Object build_marker (struct buffer *, ptrdiff_t, ptrdiff_t);
-extern void syms_of_marker (void);
 
 /* Defined in fileio.c.  */
 
@@ -4044,7 +4007,6 @@ extern Lisp_Object emacs_readlinkat (int, const char *);
 extern bool file_directory_p (const char *);
 extern bool file_accessible_directory_p (Lisp_Object);
 extern void init_fileio (void);
-extern void syms_of_fileio (void);
 extern Lisp_Object make_temp_name (Lisp_Object, bool);
 
 /* Defined in search.c.  */
@@ -4070,7 +4032,6 @@ extern ptrdiff_t find_newline_no_quit (ptrdiff_t, ptrdiff_t,
 				       ptrdiff_t, ptrdiff_t *);
 extern ptrdiff_t find_before_next_newline (ptrdiff_t, ptrdiff_t,
 					   ptrdiff_t, ptrdiff_t *);
-extern void syms_of_search (void);
 extern void clear_regexp_cache (void);
 
 /* Defined in minibuf.c.  */
@@ -4078,22 +4039,6 @@ extern void clear_regexp_cache (void);
 extern Lisp_Object Vminibuffer_list;
 extern Lisp_Object last_minibuf_string;
 extern Lisp_Object get_minibuffer (EMACS_INT);
-extern void init_minibuf_once (void);
-extern void syms_of_minibuf (void);
-
-/* Defined in callint.c.  */
-
-extern void syms_of_callint (void);
-
-/* Defined in casefiddle.c.  */
-
-extern void syms_of_casefiddle (void);
-extern void keys_of_casefiddle (void);
-
-/* Defined in casetab.c.  */
-
-extern void init_casetab_once (void);
-extern void syms_of_casetab (void);
 
 /* Defined in keyboard.c.  */
 
@@ -4123,14 +4068,11 @@ extern Lisp_Object recursive_edit_1 (void);
 extern void record_auto_save (void);
 extern void force_auto_save_soon (void);
 extern void init_keyboard (void);
-extern void syms_of_keyboard (void);
-extern void keys_of_keyboard (void);
 
 /* Defined in indent.c.  */
 extern ptrdiff_t current_column (void);
 extern void invalidate_current_column (void);
 extern bool indented_beyond_p (ptrdiff_t, ptrdiff_t, EMACS_INT);
-extern void syms_of_indent (void);
 
 /* Defined in frame.c.  */
 extern void store_frame_param (struct frame *, Lisp_Object, Lisp_Object);
@@ -4138,7 +4080,6 @@ extern void store_in_alist (Lisp_Object *, Lisp_Object, Lisp_Object);
 extern Lisp_Object do_switch_frame (Lisp_Object, int, int, Lisp_Object);
 extern Lisp_Object get_frame_param (struct frame *, Lisp_Object);
 extern void frames_discard_buffer (Lisp_Object);
-extern void syms_of_frame (void);
 
 /* Defined in emacs.c.  */
 extern char **initial_argv;
@@ -4204,7 +4145,6 @@ extern void add_gpm_wait_descriptor (int);
 extern void delete_gpm_wait_descriptor (int);
 #endif
 extern void init_process_emacs (void);
-extern void syms_of_process (void);
 extern void setup_process_coding_systems (Lisp_Object);
 
 /* Defined in callproc.c.  */
@@ -4215,16 +4155,13 @@ extern int child_setup (int, int, int, char **, bool, Lisp_Object);
 extern void init_callproc_1 (void);
 extern void init_callproc (void);
 extern void set_initial_environment (void);
-extern void syms_of_callproc (void);
 
 /* Defined in doc.c.  */
 extern Lisp_Object read_doc_string (Lisp_Object);
 extern Lisp_Object get_doc_string (Lisp_Object, bool, bool);
-extern void syms_of_doc (void);
 extern int read_bytecode_char (bool);
 
 /* Defined in bytecode.c.  */
-extern void syms_of_bytecode (void);
 extern struct byte_stack *byte_stack_list;
 #if BYTE_MARK_STACK
 extern void mark_byte_stack (void);
@@ -4235,7 +4172,6 @@ extern Lisp_Object exec_byte_code (Lisp_Object, Lisp_Object, Lisp_Object,
 
 /* Defined in macros.c.  */
 extern void init_macros (void);
-extern void syms_of_macros (void);
 
 /* Defined in undo.c.  */
 extern void truncate_undo_list (struct buffer *);
@@ -4246,17 +4182,10 @@ extern void record_change (ptrdiff_t, ptrdiff_t);
 extern void record_property_change (ptrdiff_t, ptrdiff_t,
 				    Lisp_Object, Lisp_Object,
                                     Lisp_Object);
-extern void syms_of_undo (void);
 
 /* Defined in textprop.c.  */
 extern void report_interval_modification (Lisp_Object, Lisp_Object);
 
-/* Defined in menu.c.  */
-extern void syms_of_menu (void);
-
-/* Defined in xmenu.c.  */
-extern void syms_of_xmenu (void);
-
 /* Defined in termchar.h.  */
 struct tty_display_info;
 
@@ -4296,79 +4225,32 @@ extern void unlock_all_files (void);
 extern void lock_file (Lisp_Object);
 extern void unlock_file (Lisp_Object);
 extern void unlock_buffer (struct buffer *);
-extern void syms_of_filelock (void);
 extern int str_collate (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
 
-/* Defined in sound.c.  */
-extern void syms_of_sound (void);
-
 /* Defined in category.c.  */
-extern void init_category_once (void);
 extern Lisp_Object char_category_set (int);
-extern void syms_of_category (void);
-
-/* Defined in ccl.c.  */
-extern void syms_of_ccl (void);
 
 /* Defined in dired.c.  */
-extern void syms_of_dired (void);
 extern Lisp_Object directory_files_internal (Lisp_Object, Lisp_Object,
                                              Lisp_Object, Lisp_Object,
                                              bool, Lisp_Object);
 
 /* Defined in term.c.  */
 extern int *char_ins_del_vector;
-extern void syms_of_term (void);
 extern _Noreturn void fatal (const char *msgid, ...)
   ATTRIBUTE_FORMAT_PRINTF (1, 2);
 
-/* Defined in terminal.c.  */
-extern void syms_of_terminal (void);
-
 /* Defined in font.c.  */
-extern void syms_of_font (void);
 extern void init_font (void);
 
-#ifdef HAVE_WINDOW_SYSTEM
-/* Defined in fontset.c.  */
-extern void syms_of_fontset (void);
-#endif
-
 /* Defined in gfilenotify.c */
 #ifdef HAVE_GFILENOTIFY
 extern void globals_of_gfilenotify (void);
-extern void syms_of_gfilenotify (void);
-#endif
-
-/* Defined in inotify.c */
-#ifdef HAVE_INOTIFY
-extern void syms_of_inotify (void);
-#endif
-
-#ifdef HAVE_W32NOTIFY
-/* Defined on w32notify.c.  */
-extern void syms_of_w32notify (void);
 #endif
 
 /* Defined in xfaces.c.  */
 extern Lisp_Object Vface_alternative_font_family_alist;
 extern Lisp_Object Vface_alternative_font_registry_alist;
-extern void syms_of_xfaces (void);
-
-#ifdef HAVE_X_WINDOWS
-/* Defined in xfns.c.  */
-extern void syms_of_xfns (void);
-
-/* Defined in xsmfns.c.  */
-extern void syms_of_xsmfns (void);
-
-/* Defined in xselect.c.  */
-extern void syms_of_xselect (void);
-
-/* Defined in xterm.c.  */
-extern void init_xterm (void);
-extern void syms_of_xterm (void);
-#endif /* HAVE_X_WINDOWS */
 
 #ifdef HAVE_WINDOW_SYSTEM
 /* Defined in xterm.c, nsterm.m, w32term.c.  */
@@ -4377,26 +4259,18 @@ extern char *x_get_keysym_name (int);
 
 #ifdef HAVE_LIBXML2
 /* Defined in xml.c.  */
-extern void syms_of_xml (void);
 extern void xml_cleanup_parser (void);
 #endif
 
-#ifdef HAVE_ZLIB
-/* Defined in decompress.c.  */
-extern void syms_of_decompress (void);
-#endif
-
 #ifdef HAVE_DBUS
 /* Defined in dbusbind.c.  */
 void init_dbusbind (void);
-void syms_of_dbusbind (void);
 #endif
 
 
 /* Defined in profiler.c.  */
 extern bool profiler_memory_running;
 extern void malloc_probe (size_t);
-extern void syms_of_profiler (void);
 
 
 #ifdef DOS_NT
diff --git a/src/nsterm.h b/src/nsterm.h
index 9035ee1..258c9f1 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -857,10 +857,6 @@ extern void ns_run_file_dialog (void);
 extern const char *ns_etc_directory (void);
 extern const char *ns_exec_path (void);
 extern const char *ns_load_path (void);
-extern void syms_of_nsterm (void);
-extern void syms_of_nsfns (void);
-extern void syms_of_nsmenu (void);
-extern void syms_of_nsselect (void);
 
 /* From nsimage.m, needed in image.c */
 struct image;
diff --git a/src/w32.h b/src/w32.h
index 835557d..32b9d89 100644
--- a/src/w32.h
+++ b/src/w32.h
@@ -179,8 +179,6 @@ extern int (WINAPI *pWideCharToMultiByte)(UINT,DWORD,LPCWSTR,int,LPSTR,int,LPCST
 
 extern void init_environment (char **);
 extern void check_windows_init_file (void);
-extern void syms_of_ntproc (void);
-extern void syms_of_ntterm (void);
 extern void dostounix_filename (register char *);
 extern void unixtodos_filename (register char *);
 extern int  filename_from_ansi (const char *, char *);
diff --git a/src/w32fns.c b/src/w32fns.c
index 789a91a..4f79210 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -79,7 +79,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define FOF_NO_CONNECTED_ELEMENTS 0x2000
 #endif
 
-void syms_of_w32fns (void);
 void globals_of_w32fns (void);
 
 extern void free_frame_menubar (struct frame *);
@@ -214,7 +213,6 @@ extern HMENU current_popup_menu;
 int menubar_in_use = 0;
 
 /* From w32uniscribe.c  */
-extern void syms_of_w32uniscribe (void);
 extern int uniscribe_available;
 
 #ifdef WINDOWSNT
diff --git a/src/w32font.h b/src/w32font.h
index 82c5e09..dbad23f 100644
--- a/src/w32font.h
+++ b/src/w32font.h
@@ -84,7 +84,6 @@ int uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec);
 
 Lisp_Object intern_font_name (char *);
 
-extern void syms_of_w32font (void);
 extern void globals_of_w32font (void);
 
 #endif
diff --git a/src/w32menu.c b/src/w32menu.c
index 7a946d2..a5dea2c 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -67,7 +67,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 HMENU current_popup_menu;
 
-void syms_of_w32menu (void);
 void globals_of_w32menu (void);
 
 typedef BOOL (WINAPI * GetMenuItemInfoA_Proc) (
diff --git a/src/w32select.h b/src/w32select.h
index 0fa9f18..3c7412e 100644
--- a/src/w32select.h
+++ b/src/w32select.h
@@ -21,7 +21,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define W32SELECT_H
 #include <windows.h>
 
-extern void syms_of_w32select (void);
 extern void globals_of_w32select (void);
 extern void term_w32select (void);
 
diff --git a/src/w32term.h b/src/w32term.h
index 042d7ab..d15429a 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -845,10 +845,6 @@ typedef char guichar_t;
 extern Lisp_Object w32_popup_dialog (struct frame *, Lisp_Object, Lisp_Object);
 extern void w32_arrow_cursor (void);
 
-extern void syms_of_w32term (void);
-extern void syms_of_w32menu (void);
-extern void syms_of_w32fns (void);
-
 extern void globals_of_w32menu (void);
 extern void globals_of_w32fns (void);
 extern void globals_of_w32notify (void);
diff --git a/src/window.h b/src/window.h
index 2ec28ab..f49e507 100644
--- a/src/window.h
+++ b/src/window.h
@@ -1101,10 +1101,7 @@ extern Lisp_Object sanitize_window_sizes (Lisp_Object, Lisp_Object);
 /* This looks like a setter, but it is a bit special.  */
 extern void wset_buffer (struct window *, Lisp_Object);
 extern bool window_outdated (struct window *);
-extern void init_window_once (void);
 extern void init_window (void);
-extern void syms_of_window (void);
-extern void keys_of_window (void);
 
 /* Move cursor to row/column position VPOS/HPOS, pixel coordinates
    Y/X. HPOS/VPOS are window-relative row and column numbers and X/Y
diff --git a/src/xterm.h b/src/xterm.h
index f2aff72..8bf378d 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -979,6 +979,7 @@ XrmDatabase x_load_resources (Display *, const char *, const char *,
 
 /* Defined in xterm.c */
 
+extern void init_xterm (void);
 extern bool x_text_icon (struct frame *, const char *);
 extern void x_catch_errors (Display *);
 extern void x_check_errors (Display *, const char *)

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: Subsystem initialization functions in normal binary
  2015-01-12 10:59 Subsystem initialization functions in normal binary Dmitry Antipov
@ 2015-01-13  7:43 ` Paul Eggert
  2015-01-13 10:51   ` Dmitry Antipov
  2015-01-13  8:34 ` Andreas Schwab
  1 sibling, 1 reply; 4+ messages in thread
From: Paul Eggert @ 2015-01-13  7:43 UTC (permalink / raw
  To: Dmitry Antipov, Emacs development discussions

I'm of two minds about this.  On the one hand, it simplifies the C source code 
and makes 'emacs' a tad smaller.  On the other, it's a bit tricky and I worry 
about how portable it is.  Suppose, for example, GCC supports __attribute__ 
((section (".once"))) but 'strip' does not support -R?

Is it possible for unexelf.c to do the strip, rather than to rely on an external 
'strip -R' command?

If we use the idea, it might be helpful to use '#define ATTRIBUTE_SECTION_ONCE 
__attribute__ ((section (".once")))' (or '#define ATTRIBUTE_SECTION_ONCE /* 
empty */' on hosts that don't support the attribute), and then use 
ATTRIBUTE_SECTION_ONCE elsewhere.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Subsystem initialization functions in normal binary
  2015-01-12 10:59 Subsystem initialization functions in normal binary Dmitry Antipov
  2015-01-13  7:43 ` Paul Eggert
@ 2015-01-13  8:34 ` Andreas Schwab
  1 sibling, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2015-01-13  8:34 UTC (permalink / raw
  To: Dmitry Antipov; +Cc: Emacs development discussions

Dmitry Antipov <dmantipov@yandex.ru> writes:

> @@ -456,6 +460,7 @@ ifeq ($(CANNOT_DUMP),yes)
>  else
>  	LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump
>  	$(PAXCTL_if_present) -zex $@
> +	$(STRIP_if_present) -R .once $@

Is it portable enough to strip a loadable section from an executable?
That necessarily leaves a hole in the text segment since it cannot
relocate the other sections, so it won't really have much effect on the
address space layout anyway, but can easily damage the binary.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Subsystem initialization functions in normal binary
  2015-01-13  7:43 ` Paul Eggert
@ 2015-01-13 10:51   ` Dmitry Antipov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Antipov @ 2015-01-13 10:51 UTC (permalink / raw
  To: Paul Eggert; +Cc: Andreas Schwab, emacs-devel

On 01/13/2015 10:43 AM, Paul Eggert wrote:

> Is it possible for unexelf.c to do the strip, rather than to rely
> on an external 'strip -R' command?

I'm not familiar with ELF unexec enough.  According to comments, it can
relocate existing sections and insert new ones; it's worth trying to check
whether .once can be "stripped" without making the hole noticed by Andreas.

Dmitry




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-13 10:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-12 10:59 Subsystem initialization functions in normal binary Dmitry Antipov
2015-01-13  7:43 ` Paul Eggert
2015-01-13 10:51   ` Dmitry Antipov
2015-01-13  8:34 ` Andreas Schwab

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.