From c4b886831acb82643a38f48c91456b15363bed75 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Tue, 31 Dec 2019 00:19:22 +0100 Subject: [PATCH] compile each eln to a temporary one and rename it as last --- src/comp.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/comp.c b/src/comp.c index 7d4bcc2cdff..c25b3245ca3 100644 --- a/src/comp.c +++ b/src/comp.c @@ -3151,15 +3151,18 @@ DEFUN ("comp--compile-ctxt-to-file", Fcomp__compile_ctxt_to_file, AUTO_STRING (dot_so, NATIVE_ELISP_SUFFIX); Lisp_Object out_file = CALLN (Fconcat, ctxtname, dot_so); + Lisp_Object tmp_file = + Fmake_temp_file_internal (ctxtname, Qnil, dot_so, Qnil); + gcc_jit_context_compile_to_file (comp.ctxt, + GCC_JIT_OUTPUT_KIND_DYNAMIC_LIBRARY, + SSDATA (tmp_file)); - /* Remove the old eln before creating the new one to get a new inode and - prevent crashes in case the old one is currently loaded. */ + /* Remove the old eln instead of copying the new one into ti to get + a new inode and prevent crashes in case the old one is currently + loaded. */ if (!NILP (Ffile_exists_p (out_file))) Fdelete_file (out_file, Qnil); - - gcc_jit_context_compile_to_file (comp.ctxt, - GCC_JIT_OUTPUT_KIND_DYNAMIC_LIBRARY, - SSDATA (out_file)); + Frename_file (tmp_file, out_file, Qnil); pthread_sigmask (SIG_SETMASK, &oldset, 0); unblock_input (); -- 2.39.5