On Sun, 2024-03-17 at 18:36 -0500, StrawberryTea wrote: > Hello GCC libjit people,
Hi StrawberryTea I'm the author/maintainer of libgccjit. I confess that I don't think I've ever tried using LTO with libgccjit, but rustc_codegen_gcc appears to, given: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=8415bceea9d3ca86adc00ae8ad92deaec0457dd1 > > Whenever I try to compile Elisp packages with GCC libjit and -flto, I > get "lto1: internal compiler error: original not compressed with > zstd". FWIW that message appears in the sources in gcc/lto-compress.cc's lto_uncompression_zstd here: https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/lto-compress.cc;#l162 but I'm unfamiliar with that part of the compiler. > I have an Emacs bug report on > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=69689 and a Gentoo bug > report on https://bugs.gentoo.org/926953 but nobody has been able to > resolve this. There are hints that this might be related to the way > Gentoo builds GCC, but I'm not sure. I suspect that debugging this further would be very hard, due to it involving a large amount of non-trivial code and interactions between gcc, the linker, emacs C, the emacs AOT compilation code, and how gentoo packages all of these. You'd need to turn on debug logging from libgccjit which I don't know how to do from Emacs [2], and that might give clues as to what's going wrong (or might not!) Do you know if the Emacs native compilation project has tried turning on LTO? [1] What does that actually mean? (e.g. LTO between compiled Emacs lisp modules? Or between a compiled Emacs lisp module and Emacs C code? Are both built using the same GCC version? etc) The simplest fix is probably to turn off LTO. Sorry not to be of more help Dave [1] https://www.emacswiki.org/emacs/GccEmacs [2] FWIW, from C you'd do it with gcc_jit_context_set_logfile: https://gcc.gnu.org/onlinedocs/jit/topics/contexts.html#c.gcc_jit_context_set_logfile
