aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2025-04-17 09:33:06 +0800
committerPo Lu2025-04-17 09:33:38 +0800
commit0fc2fc9a4de3855cf14b6e1f548795831099981b (patch)
treef05d4c084f127e510d36bda55e6f79b68a97d4e5 /src
parentc0cb59578b5aeb75b4856dda518d80cd015caa7d (diff)
downloademacs-0fc2fc9a4de3855cf14b6e1f548795831099981b.tar.gz
emacs-0fc2fc9a4de3855cf14b6e1f548795831099981b.zip
Prevent unrelocated symbols with position from being dumped
* src/pdumper.c (dump_builtin_symbol_p): Test BARE_SYMBOL_P \(object) rather than SYMBOLP to avoid depending on the value of symbols_with_pos_enabled or depositing non-relocated references to vectorlikes in the dump file. Clarify commentary.
Diffstat (limited to 'src')
-rw-r--r--src/pdumper.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/pdumper.c b/src/pdumper.c
index 1deb8473956..5cd84995226 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -727,12 +727,18 @@ emacs_offset (const void *emacs_ptr)
727 return ptrdiff_t_to_dump_off (emacs_ptr_relative); 727 return ptrdiff_t_to_dump_off (emacs_ptr_relative);
728} 728}
729 729
730/* Return whether OBJECT is a symbol the storage of which is built 730/* Return whether OBJECT is a symbol the storage of which is built into
731 into Emacs (and so is invariant across ASLR). */ 731 Emacs (and hence is implicitly offset from an address in the Emacs
732 image). */
733
732static bool 734static bool
733dump_builtin_symbol_p (Lisp_Object object) 735dump_builtin_symbol_p (Lisp_Object object)
734{ 736{
735 return SYMBOLP (object) && c_symbol_p (XSYMBOL (object)); 737 /* Symbols with position cannot be dumped, but not returning true for
738 them avoids producing references to unrelocated Lisp_Objects in
739 fixup processing or depending on the value of
740 symbols_with_pos_enabled. */
741 return BARE_SYMBOL_P (object) && c_symbol_p (XSYMBOL (object));
736} 742}
737 743
738/* Return whether OBJECT has the same bit pattern in all Emacs 744/* Return whether OBJECT has the same bit pattern in all Emacs