bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#68690: Segmentation fault building with native-comp


From: Stefan Monnier
Subject: bug#68690: Segmentation fault building with native-comp
Date: Fri, 26 Jan 2024 08:48:46 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

> I remembered seeing something in pdumper.c that could be related, namely
>
>   /* Start the cold section.  This section contains bytes that should
>      never change and so can be direct-mapped from the dump without
>      special processing.  */
>   dump_drain_cold_data (ctx);
>
> And if you follow that function you'll see that it treats charsets
> specially.
>
> I find the comment about directly mapping very suspicious, when the
> charset contains a Lisp_Object, possibly requiring relocation. But it
> could well be that I misundertand something here.

Hmm... would a patch like the one below fix the problem, then?


        Stefan
diff --git a/src/pdumper.c b/src/pdumper.c
index f42d1777371..56177d3fd89 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -440,7 +440,6 @@ dump_fingerprint (FILE *output, char const *label,
   {
     COLD_OP_OBJECT,
     COLD_OP_STRING,
-    COLD_OP_CHARSET,
     COLD_OP_BUFFER,
     COLD_OP_BIGNUM,
     COLD_OP_NATIVE_SUBR,
@@ -3245,10 +3244,6 @@ dump_charset (struct dump_context *ctx, int cs_i)
   memcpy (out.fast_map, &cs->fast_map, sizeof (cs->fast_map));
   DUMP_FIELD_COPY (&out, cs, code_offset);
   dump_off offset = dump_object_finish (ctx, &out, sizeof (out));
-  if (cs_i < charset_table_used && cs->code_space_mask)
-    dump_remember_cold_op (ctx, COLD_OP_CHARSET,
-                           Fcons (dump_off_to_lisp (cs_i),
-                                  dump_off_to_lisp (offset)));
   return offset;
 }
 
@@ -3402,20 +3397,6 @@ dump_cold_string (struct dump_context *ctx, Lisp_Object 
string)
   dump_write (ctx, XSTRING (string)->u.s.data, total_size);
 }
 
-static void
-dump_cold_charset (struct dump_context *ctx, Lisp_Object data)
-{
-  /* Dump charset lookup tables.  */
-  int cs_i = XFIXNUM (XCAR (data));
-  dump_off cs_dump_offset = dump_off_from_lisp (XCDR (data));
-  dump_remember_fixup_ptr_raw
-    (ctx,
-     cs_dump_offset + dump_offsetof (struct charset, code_space_mask),
-     ctx->offset);
-  struct charset *cs = charset_table + cs_i;
-  dump_write (ctx, cs->code_space_mask, 256);
-}
-
 static void
 dump_cold_buffer (struct dump_context *ctx, Lisp_Object data)
 {
@@ -3509,9 +3490,6 @@ dump_drain_cold_data (struct dump_context *ctx)
         case COLD_OP_STRING:
           dump_cold_string (ctx, data);
           break;
-        case COLD_OP_CHARSET:
-          dump_cold_charset (ctx, data);
-          break;
         case COLD_OP_BUFFER:
           dump_cold_buffer (ctx, data);
           break;

reply via email to

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