From: Andrea Corallo Date: Fri, 5 Mar 2021 09:45:09 +0000 (+0100) Subject: * Harden `comp-abi-hash' computation X-Git-Tag: emacs-28.0.90~2727^2~101 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=260617ddc2e8e46a741e6843f97c7ffbc5222ed0;p=emacs.git * Harden `comp-abi-hash' computation Account for subr arity in `comp-abi-hash' computation as that's part of the ABI exposed to .eln files. * src/comp.c (Fcomp__subr_signature): New support function. (hash_native_abi): Make use of. (syms_of_comp): Register 'Scomp__subr_signature'. --- diff --git a/src/comp.c b/src/comp.c index 1e50b4fe8f7..17dc4cbc132 100644 --- a/src/comp.c +++ b/src/comp.c @@ -713,6 +713,16 @@ comp_hash_source_file (Lisp_Object filename) return Fsubstring (digest, Qnil, make_fixnum (HASH_LENGTH)); } +DEFUN ("comp--subr-signature", Fcomp__subr_signature, + Scomp__subr_signature, 1, 1, 0, + doc: /* Support function to 'hash_native_abi'. +For internal use. */) + (Lisp_Object subr) +{ + return concat2 (Fsubr_name (subr), + Fprin1_to_string (Fsubr_arity (subr), Qnil)); +} + /* Produce a key hashing Vcomp_subr_list. */ void @@ -726,7 +736,7 @@ hash_native_abi (void) concat3 (build_string (ABI_VERSION), concat3 (Vemacs_version, Vsystem_configuration, Vsystem_configuration_options), - Fmapconcat (intern_c_string ("subr-name"), + Fmapconcat (intern_c_string ("comp--subr-signature"), Vcomp_subr_list, build_string ("")))); Vcomp_native_version_dir = concat3 (Vemacs_version, build_string ("-"), Vcomp_abi_hash); @@ -5199,6 +5209,7 @@ compiled one. */); build_pure_c_string ("eln file inconsistent with current runtime " "configuration, please recompile")); + defsubr (&Scomp__subr_signature); defsubr (&Scomp_el_to_eln_filename); defsubr (&Scomp_native_driver_options_effective_p); defsubr (&Scomp__install_trampoline);