]> git.eshelyaron.com Git - emacs.git/commitdiff
compile each eln to a temporary one and rename it as last
authorAndrea Corallo <akrl@sdf.org>
Mon, 30 Dec 2019 23:19:22 +0000 (00:19 +0100)
committerAndrea Corallo <akrl@sdf.org>
Wed, 1 Jan 2020 10:38:18 +0000 (11:38 +0100)
src/comp.c

index 7d4bcc2cdff9d7e64c348e3f43fcac84e2d13ae0..c25b3245ca376c1b0e3eb657700a681df3db1a96 100644 (file)
@@ -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 ();