emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/native-comp 260617d: * Harden `comp-abi-hash' computation


From: Andrea Corallo
Subject: feature/native-comp 260617d: * Harden `comp-abi-hash' computation
Date: Fri, 5 Mar 2021 05:03:08 -0500 (EST)

branch: feature/native-comp
commit 260617ddc2e8e46a741e6843f97c7ffbc5222ed0
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>

    * 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'.
---
 src/comp.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/comp.c b/src/comp.c
index 1e50b4f..17dc4cb 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);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]