]> git.eshelyaron.com Git - emacs.git/commitdiff
* Harden `comp-abi-hash' computation
authorAndrea Corallo <akrl@sdf.org>
Fri, 5 Mar 2021 09:45:09 +0000 (10:45 +0100)
committerAndrea Corallo <akrl@sdf.org>
Fri, 5 Mar 2021 10:02:21 +0000 (11:02 +0100)
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'.

src/comp.c

index 1e50b4fe8f70bb4aeb08b2ae5f2ef9557e6943d3..17dc4cbc1328def9c4180de574a062869bfd9675 100644 (file)
@@ -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);