diff options
author | Pip Cet <pipcet@protonmail.com> | 2025-01-18 20:55:18 +0000 |
---|---|---|
committer | Pip Cet <pipcet@protonmail.com> | 2025-02-01 17:02:50 +0000 |
commit | 4eabfd68c91185909be307435e5db8b8f0fb4102 (patch) | |
tree | 2bea05f1d7796c887f54220b363f324b3462437e /lisp/emacs-lisp | |
parent | 20e3959dc37685334579394b320ab93f751243fb (diff) | |
download | emacs-4eabfd68c91185909be307435e5db8b8f0fb4102.tar.gz emacs-4eabfd68c91185909be307435e5db8b8f0fb4102.tar.bz2 emacs-4eabfd68c91185909be307435e5db8b8f0fb4102.zip |
Use #$ for lambda fixups in native compilation data vectors
The "#$" syntax is recognized by Fread, which substitutes
Vload_file_name in its place. If Vload_file_name is bound
appropriately, no other value can produce an object EQ to the one
produced by "#$".
We use this to check the data vector for entries that we know should
have been initialized: if the value is still equal to what we bound
Vload_file_name to when it was read, it wasn't initialized, and we
abort.
* lisp/emacs-lisp/comp.el (comp--#$): New defvar.
(comp--finalize-container): Use it.
* src/comp.c (ABI_VERSION): Bump.
(emit_static_object): Ensure 'comp--#$' prints as "#$".
(load_static_obj): Ensure '#$' reads as Vcomp__hashdollar.
(check_comp_unit_relocs): Adjust assertion.
(syms_of_comp): Define 'comp--#$'.
* src/pdumper.c (dump_do_dump_relocation): Adjust assertion.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/comp.el | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index dd94e75966c..0da007afebb 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -42,6 +42,7 @@ (defvar comp-subr-arities-h) (defvar native-comp-eln-load-path) (defvar native-comp-enable-subr-trampolines) +(defvar comp--\#$) (declare-function comp--compile-ctxt-to-file0 "comp.c") (declare-function comp--init-ctxt "comp.c") @@ -3254,10 +3255,9 @@ Set it into the `type' slot." ;; from the corresponding m-var. collect (if (gethash obj (comp-ctxt-byte-func-to-func-h comp-ctxt)) - ;; Hack not to have `--lambda-fixup' in - ;; data relocations as it would trigger the - ;; check in 'check_comp_unit_relocs'. - (intern (concat (make-string 1 ?-) "-lambda-fixup")) + ;; This prints as #$, so we can assert this + ;; value does not remain in the data vector + comp--\#$ obj)))) (defun comp--finalize-relocs () |