From 3d14a74f8f35fe16823361beb03dd0957dd6f510 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Sat, 14 Nov 2020 11:24:30 +0100 Subject: [PATCH] * Fix debug symbol emission * 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 | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/src/comp.c b/src/comp.c index 0d464281858..e126fa1b4ed 100644 --- a/src/comp.c +++ b/src/comp.c @@ -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 -- 2.39.5