Subject: bug#46256: [feature/native-comp] AOT eln files ignored if run from build tree

From: Pip Cet <[email-masked]>
Date: Mon, 8 Mar 2021 20:50:46 +0000

On Mon, Mar 8, 2021 at 8:47 PM Eli Zaretskii <[email-masked]> wrote:
> > From: Pip Cet <[email-masked]>
> > Date: Mon, 8 Mar 2021 18:32:55 +0000
> > Cc: Eli Zaretskii <[email-masked]>, [email-masked], [email-masked]
> >
> > What's saved_cu, actually?
>
> Not sure I understand the question.  Is the below what you wanted to
> see?
>
>   (gdb) p saved_cu
>   $6 = (Lisp_Object *) 0x6a5b2e7c <comp_unit>

Yes! I believe we've found another bug.

We were allocating comp_unit as a Lisp_Object **, but it's actually a
Lisp_Object.

Pip
From cc717daba81fb39bf8ad8e85d46de384bb6fe47a Mon Sep 17 00:00:00 2001
From: Pip Cet <[email-masked]>
Date: Mon, 8 Mar 2021 20:49:59 +0000
Subject: [PATCH] Try to fix GC crash (bug#46256)

* src/comp.c (emit_ctxt_code): Allocate comp_unit as a Lisp_Object,
not a pointer to pointer to Lisp_Object.
---
 src/comp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/comp.c b/src/comp.c
index c9e068b90aa2c..799cfdc88b55d 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -2774,7 +2774,7 @@ emit_ctxt_code (void)
 	comp.ctxt,
 	NULL,
 	GCC_JIT_GLOBAL_EXPORTED,
-	gcc_jit_type_get_pointer (comp.lisp_obj_ptr_type),
+	comp.lisp_obj_type,
 	COMP_UNIT_SYM);
 
   declare_imported_data ();
-- 
2.30.1