]> git.eshelyaron.com Git - emacs.git/commitdiff
* Fix debug symbol emission
authorAndrea Corallo <akrl@sdf.org>
Sat, 14 Nov 2020 10:24:30 +0000 (11:24 +0100)
committerAndrea Corallo <akrl@sdf.org>
Sat, 14 Nov 2020 21:06:31 +0000 (22:06 +0100)
* src/comp.c (Fcomp__compile_ctxt_to_file): Now that we do not
rely anymore on globlal variables move logic in from
'Fcomp__init_ctxt' so comp.debug is already set correctly.

src/comp.c

index 0d464281858d7c6a53a0b6ba1df7190fbf9bfed1..e126fa1b4ed0242957fb5880d891adb24ab978c3 100644 (file)
@@ -4215,26 +4215,6 @@ DEFUN ("comp--init-ctxt", Fcomp__init_ctxt, Scomp__init_ctxt,
 
   comp.ctxt = gcc_jit_context_acquire ();
 
-  if (comp.debug)
-    {
-      gcc_jit_context_set_bool_option (comp.ctxt,
-                                      GCC_JIT_BOOL_OPTION_DEBUGINFO,
-                                      1);
-    }
-  if (comp.debug > 2)
-    {
-      logfile = fopen ("libgccjit.log", "w");
-      gcc_jit_context_set_logfile (comp.ctxt,
-                                  logfile,
-                                  0, 0);
-      gcc_jit_context_set_bool_option (comp.ctxt,
-                                      GCC_JIT_BOOL_OPTION_KEEP_INTERMEDIATES,
-                                      1);
-      gcc_jit_context_set_bool_option (comp.ctxt,
-                                      GCC_JIT_BOOL_OPTION_DUMP_EVERYTHING,
-                                      1);
-    }
-
   comp.void_type = gcc_jit_context_get_type (comp.ctxt, GCC_JIT_TYPE_VOID);
   comp.void_ptr_type =
     gcc_jit_context_get_type (comp.ctxt, GCC_JIT_TYPE_VOID_PTR);
@@ -4408,6 +4388,25 @@ DEFUN ("comp--compile-ctxt-to-file", Fcomp__compile_ctxt_to_file,
 
   comp.speed = XFIXNUM (CALL1I (comp-ctxt-speed, Vcomp_ctxt));
   comp.debug = XFIXNUM (CALL1I (comp-ctxt-debug, Vcomp_ctxt));
+
+  if (comp.debug)
+      gcc_jit_context_set_bool_option (comp.ctxt,
+                                      GCC_JIT_BOOL_OPTION_DEBUGINFO,
+                                      1);
+  if (comp.debug > 2)
+    {
+      logfile = fopen ("libgccjit.log", "w");
+      gcc_jit_context_set_logfile (comp.ctxt,
+                                  logfile,
+                                  0, 0);
+      gcc_jit_context_set_bool_option (comp.ctxt,
+                                      GCC_JIT_BOOL_OPTION_KEEP_INTERMEDIATES,
+                                      1);
+      gcc_jit_context_set_bool_option (comp.ctxt,
+                                      GCC_JIT_BOOL_OPTION_DUMP_EVERYTHING,
+                                      1);
+    }
+
   gcc_jit_context_set_int_option (comp.ctxt,
                                  GCC_JIT_INT_OPTION_OPTIMIZATION_LEVEL,
                                  comp.speed < 0 ? 0