Subject: Re: bug#46495: 28.0.50; [native-comp] Build fails for 32bit --with-wide-int

From: Eli Zaretskii <[email-masked]>
Date: Wed, 31 Mar 2021 11:07:20 +0300

> From: Andrea Corallo <[email-masked]>
> Cc: [email-masked], [email-masked], [email-masked]
> Date: Tue, 30 Mar 2021 19:19:12 +0000
> 
> >> `batch-native-compile' or `batch-byte-native-compile-for-bootstrap'
> >> should be equivalent here as the second is just a way to do only byte
> >> compilation for non dumped files when we are not using NATIVE_FULL_AOT.
> >
> > Then I guess I'm missing something: how does Emacs know whether a
> > given .eln file should be saved in native-lisp/ or in
> > ~/.emacs.d/eln-cache/?
> 
> Ops apologies you are correct, `batch-byte-native-compile-for-bootstrap'
> also select as destination folder the `native-lisp' directory in the
> build tree.  It is correct to invoke
> `batch-byte-native-compile-for-bootstrap' if we want the .eln to be
> deposed there.

OK, thanks.

Another nit: the doc string of comp-debug says:

  0 no debugging output.
    This is the recommended value unless you are debugging the compiler itself.
  1 emit debug symbols and dump pseudo C code.
  2 dump gcc passes and libgccjit log file.
  3 dump libgccjit reproducers.

But comp.c does this:

  if (comp.debug)
      gcc_jit_context_set_bool_option (comp.ctxt,
				       GCC_JIT_BOOL_OPTION_DEBUGINFO,
				       1);
  if (comp.debug > 2)
    {
      logfile = emacs_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);
    }
  [...]
  if (comp.debug)
      gcc_jit_context_dump_to_file (comp.ctxt,
				    format_string ("%s.c", SSDATA (ebase_name)),
				    1);

AFAIU, this means the libgccjit log file is only output with
comp-debug 3 and higher?  Also, does comp-debug = 3 indeed cause the
reproducer to be written, or is that controlled independently by
comp-libgccjit-reproducer?

And finally, what do you think about moving the
gcc_jit_context_dump_to_file call to comp-debug 2 or higher?  IOW,
make level 1 just add debug info to the *.eln files?  Especially if we
are going to make comp-debug = 1 the default (as I think we should),
wouldn't it be better than the current setup?  Or maybe we should
introduce an intermediate debug level between the current 0 and 1?
And if we make that change, do we also need to bump the ABI number?

Thanks.