]> git.eshelyaron.com Git - emacs.git/commitdiff
; Enable pdumper on some buggy versions of Sun C
authorPo Lu <luangruo@yahoo.com>
Sat, 8 Mar 2025 13:58:19 +0000 (21:58 +0800)
committerEshel Yaron <me@eshelyaron.com>
Sun, 9 Mar 2025 10:29:09 +0000 (11:29 +0100)
* src/pdumper.c (dump_sort_copied_objects, drain_reloc_list)
(dump_do_fixups, dump_do_dump_relocation): Do not expand
Fnreverse multiple times in CALLN.  Sun C 5.12 evaluates the
arguments to array initializers to which it expands, which
clobbers the lists being reversed.

(cherry picked from commit b36abc76ae3583ae30f9883ca276ff66d522bac1)

src/pdumper.c

index 7a8c5bba9ad47ebd8eb16b744a989b4b207b24c7..342c37b5e620d3c6a60981b069ac0d9e4b51f02a 100644 (file)
@@ -3388,13 +3388,16 @@ dump_metadata_for_pdumper (struct dump_context *ctx)
 static void
 dump_sort_copied_objects (struct dump_context *ctx)
 {
+  Lisp_Object queue_reversed;
+
+  queue_reversed = Fnreverse (ctx->copied_queue);
   /* Sort the objects into the order in which they'll appear in the
      Emacs: this way, on startup, we'll do both the IO from the dump
      file and the copy into Emacs in-order, where prefetch will be
      most effective.  */
-  ctx->copied_queue =
-    CALLN (Fsort, Fnreverse (ctx->copied_queue),
-           Qdump_emacs_portable__sort_predicate_copied);
+  ctx->copied_queue
+    = CALLN (Fsort, queue_reversed,
+            Qdump_emacs_portable__sort_predicate_copied);
 }
 
 /* Dump parts of copied objects we need at runtime.  */
@@ -3959,9 +3962,11 @@ drain_reloc_list (struct dump_context *ctx,
                   struct dump_table_locator *out_locator)
 {
   struct dump_flags old_flags = ctx->flags;
+  Lisp_Object list_reversed, relocs;
   ctx->flags.pack_objects = true;
-  Lisp_Object relocs = CALLN (Fsort, Fnreverse (*reloc_list),
-                              Qdump_emacs_portable__sort_predicate);
+  list_reversed = Fnreverse (*reloc_list);
+  relocs = CALLN (Fsort, list_reversed,
+                 Qdump_emacs_portable__sort_predicate);
   *reloc_list = Qnil;
   dump_align_output (ctx, max (alignof (struct dump_reloc),
                               alignof (struct emacs_reloc)));
@@ -4082,8 +4087,9 @@ static void
 dump_do_fixups (struct dump_context *ctx)
 {
   dump_off saved_offset = ctx->offset;
-  Lisp_Object fixups = CALLN (Fsort, Fnreverse (ctx->fixups),
-                              Qdump_emacs_portable__sort_predicate);
+  Lisp_Object fixups_reversed = Fnreverse (ctx->fixups);
+  Lisp_Object fixups = CALLN (Fsort, fixups_reversed,
+                             Qdump_emacs_portable__sort_predicate);
   Lisp_Object prev_fixup = Qnil;
   ctx->fixups = Qnil;
   while (!NILP (fixups))
@@ -5430,8 +5436,8 @@ dump_do_dump_relocation (const uintptr_t dump_base,
     case RELOC_NATIVE_COMP_UNIT:
       {
        static enum { UNKNOWN, LOCAL_BUILD, INSTALLED } installation_state;
-       struct Lisp_Native_Comp_Unit *comp_u =
-         dump_ptr (dump_base, reloc_offset);
+       struct Lisp_Native_Comp_Unit *comp_u
+         dump_ptr (dump_base, reloc_offset);
        comp_u->lambda_gc_guard_h = CALLN (Fmake_hash_table, QCtest, Qeq);
        if (STRINGP (comp_u->file))
          error ("trying to load incoherent dumped eln file %s",