mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-24 14:30:43 -08:00
Hash eln ABI once and add it to the output compilation path
This commit is contained in:
parent
f77f6ca770
commit
43b6f05dfb
5 changed files with 35 additions and 8 deletions
|
|
@ -2125,7 +2125,7 @@ Return the compilation unit file name."
|
||||||
(file-name-as-directory
|
(file-name-as-directory
|
||||||
(concat
|
(concat
|
||||||
(file-name-directory exp-file)
|
(file-name-directory exp-file)
|
||||||
system-configuration))
|
comp-native-path-postfix))
|
||||||
(file-name-sans-extension
|
(file-name-sans-extension
|
||||||
(file-name-nondirectory exp-file))))))))
|
(file-name-nondirectory exp-file))))))))
|
||||||
(comp-log "\n\n" 1)
|
(comp-log "\n\n" 1)
|
||||||
|
|
|
||||||
29
src/comp.c
29
src/comp.c
|
|
@ -250,8 +250,8 @@ format_string (const char *format, ...)
|
||||||
|
|
||||||
/* Produce a key hashing Vcomp_subr_list. */
|
/* Produce a key hashing Vcomp_subr_list. */
|
||||||
|
|
||||||
static Lisp_Object
|
void
|
||||||
hash_subr_list (void)
|
hash_native_abi (void)
|
||||||
{
|
{
|
||||||
Lisp_Object string = Fmapconcat (intern_c_string ("subr-name"),
|
Lisp_Object string = Fmapconcat (intern_c_string ("subr-name"),
|
||||||
Vcomp_subr_list, build_string (" "));
|
Vcomp_subr_list, build_string (" "));
|
||||||
|
|
@ -260,7 +260,17 @@ hash_subr_list (void)
|
||||||
sha512_buffer (SSDATA (string), SCHARS (string), SSDATA (digest));
|
sha512_buffer (SSDATA (string), SCHARS (string), SSDATA (digest));
|
||||||
hexbuf_digest (SSDATA (digest), SDATA (digest), SHA512_DIGEST_SIZE);
|
hexbuf_digest (SSDATA (digest), SDATA (digest), SHA512_DIGEST_SIZE);
|
||||||
|
|
||||||
return digest;
|
/* Check runs once. */
|
||||||
|
eassert (Vcomp_abi_hash);
|
||||||
|
Vcomp_abi_hash = digest;
|
||||||
|
/* If 10 characters are usually sufficient for git I guess 16 are
|
||||||
|
fine for us here. */
|
||||||
|
Vcomp_native_path_postfix =
|
||||||
|
concat3 (Vsystem_configuration,
|
||||||
|
make_string ("-", 1),
|
||||||
|
Fsubstring_no_properties (Vcomp_abi_hash,
|
||||||
|
make_fixnum (0),
|
||||||
|
make_fixnum (16)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -1976,8 +1986,9 @@ emit_ctxt_code (void)
|
||||||
fields[n_frelocs++] = xmint_pointer (XCDR (el));
|
fields[n_frelocs++] = xmint_pointer (XCDR (el));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compute and store function link table hash. */
|
/* Sign the .eln for the exposed ABI it expects at load. */
|
||||||
emit_static_object (LINK_TABLE_HASH_SYM, hash_subr_list ());
|
eassert (!NILP (Vcomp_abi_hash));
|
||||||
|
emit_static_object (LINK_TABLE_HASH_SYM, Vcomp_abi_hash);
|
||||||
|
|
||||||
Lisp_Object subr_l = Vcomp_subr_list;
|
Lisp_Object subr_l = Vcomp_subr_list;
|
||||||
FOR_EACH_TAIL (subr_l)
|
FOR_EACH_TAIL (subr_l)
|
||||||
|
|
@ -3430,7 +3441,7 @@ load_comp_unit (struct Lisp_Native_Comp_Unit *comp_u, bool loading_dump)
|
||||||
&& freloc_link_table
|
&& freloc_link_table
|
||||||
&& top_level_run)
|
&& top_level_run)
|
||||||
|| NILP (Fstring_equal (load_static_obj (comp_u, LINK_TABLE_HASH_SYM),
|
|| NILP (Fstring_equal (load_static_obj (comp_u, LINK_TABLE_HASH_SYM),
|
||||||
hash_subr_list ())))
|
Vcomp_abi_hash)))
|
||||||
xsignal1 (Qnative_lisp_file_inconsistent, comp_u->file);
|
xsignal1 (Qnative_lisp_file_inconsistent, comp_u->file);
|
||||||
|
|
||||||
*current_thread_reloc = ¤t_thread;
|
*current_thread_reloc = ¤t_thread;
|
||||||
|
|
@ -3657,6 +3668,12 @@ syms_of_comp (void)
|
||||||
doc: /* Hash table symbol-function -> function-c-name. For
|
doc: /* Hash table symbol-function -> function-c-name. For
|
||||||
internal use during */);
|
internal use during */);
|
||||||
Vcomp_sym_subr_c_name_h = CALLN (Fmake_hash_table);
|
Vcomp_sym_subr_c_name_h = CALLN (Fmake_hash_table);
|
||||||
|
DEFVAR_LISP ("comp-abi-hash", Vcomp_abi_hash,
|
||||||
|
doc: /* String signing the ABI exposed to .eln files. */);
|
||||||
|
Vcomp_abi_hash = Qnil;
|
||||||
|
DEFVAR_LISP ("comp-native-path-postfix", Vcomp_native_path_postfix,
|
||||||
|
doc: /* Postifix to be added to the .eln compilation path. */);
|
||||||
|
Vcomp_native_path_postfix = Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_NATIVE_COMP */
|
#endif /* HAVE_NATIVE_COMP */
|
||||||
|
|
|
||||||
|
|
@ -61,8 +61,12 @@ XNATIVE_COMP_UNIT (Lisp_Object a)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Defined in comp.c. */
|
/* Defined in comp.c. */
|
||||||
|
|
||||||
|
extern void hash_native_abi (void);
|
||||||
|
|
||||||
extern void load_comp_unit (struct Lisp_Native_Comp_Unit *comp_u,
|
extern void load_comp_unit (struct Lisp_Native_Comp_Unit *comp_u,
|
||||||
bool loading_dump);
|
bool loading_dump);
|
||||||
extern void syms_of_comp (void);
|
extern void syms_of_comp (void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1949,6 +1949,11 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
|
||||||
keys_of_keyboard ();
|
keys_of_keyboard ();
|
||||||
keys_of_keymap ();
|
keys_of_keymap ();
|
||||||
keys_of_window ();
|
keys_of_window ();
|
||||||
|
|
||||||
|
#ifdef HAVE_NATIVE_COMP
|
||||||
|
/* Must be after the last defsubr has run. */
|
||||||
|
hash_native_abi ();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1068,7 +1068,7 @@ effective_load_path (void)
|
||||||
Lisp_Object el = XCAR (lp);
|
Lisp_Object el = XCAR (lp);
|
||||||
new_lp =
|
new_lp =
|
||||||
Fcons (concat2 (Ffile_name_as_directory (el),
|
Fcons (concat2 (Ffile_name_as_directory (el),
|
||||||
Vsystem_configuration),
|
Vcomp_native_path_postfix),
|
||||||
new_lp);
|
new_lp);
|
||||||
new_lp = Fcons (el, new_lp);
|
new_lp = Fcons (el, new_lp);
|
||||||
}
|
}
|
||||||
|
|
@ -4427,6 +4427,7 @@ defsubr (union Aligned_Lisp_Subr *aname)
|
||||||
XSETSUBR (tem, sname);
|
XSETSUBR (tem, sname);
|
||||||
set_symbol_function (sym, tem);
|
set_symbol_function (sym, tem);
|
||||||
#ifdef HAVE_NATIVE_COMP
|
#ifdef HAVE_NATIVE_COMP
|
||||||
|
eassert (NILP (Vcomp_abi_hash));
|
||||||
Vcomp_subr_list = Fpurecopy (Fcons (tem, Vcomp_subr_list));
|
Vcomp_subr_list = Fpurecopy (Fcons (tem, Vcomp_subr_list));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue