From b818a49f667a77b7627c678fb4a2ca014f43695e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicol=C3=A1s=20B=C3=A9rtolo?= Date: Fri, 29 May 2020 21:08:37 -0300 Subject: [PATCH] Fix loading of libgccjit.dll while dumping in Windows. loadup.el calls `native-comp-available-p', that calls load_gccjit_if_necessary() in Windows. That function tries to load libgccjit using the mappings defined in `dynamic-library-alist'. That mapping is filled by term/w32-win.el, but that file may be loaded too late. * src/emacs.c (syms_of_emacs): Add libgccjit to the `dynamic-library-alist' used when starting to dump so `native-comp-available-p' always works in Windows. --- src/emacs.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/emacs.c b/src/emacs.c index cd4f7a0b286..8ecf9b4aeba 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -3052,7 +3052,18 @@ because they do not depend on external libraries and are always available. Also note that this is not a generic facility for accessing external libraries; only those already known by Emacs will be loaded. */); +#ifdef WINDOWSNT + /* We may need to load libgccjit when dumping before term/w32-win.el + defines `dynamic-library-alist`. This will fail if that variable + is empty, so add libgccjit.dll to it. */ + if (will_dump_p ()) + Vdynamic_library_alist = list1 (list2 (Qgccjit, + build_string ("libgccjit.dll"))); + else + Vdynamic_library_alist = Qnil; +#else Vdynamic_library_alist = Qnil; +#endif Fput (intern_c_string ("dynamic-library-alist"), Qrisky_local_variable, Qt); #ifdef WINDOWSNT -- 2.39.5