From 0720354082858f59db9f70ada33efc424126d668 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Sat, 2 Nov 2019 12:34:09 +0100 Subject: [PATCH] native compile return the filename of the compilation unit --- lisp/emacs-lisp/comp.el | 6 ++++-- src/comp.c | 7 +++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 2f6bcf71b1e..4fb9c129a88 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -1702,7 +1702,8 @@ Prepare every function for final compilation and drive the C back-end." "Compile INPUT into native code. This is the entrypoint for the Emacs Lisp native compiler. If INPUT is a symbol, native-compile its function definition. -If INPUT is a string, use it as the file path to be native compiled." +If INPUT is a string, use it as the file path to be native compiled. +Return the compilation unit filename." (unless (or (symbolp input) (stringp input)) (error "Trying to native compile something not a symbol function or file")) @@ -1716,7 +1717,8 @@ If INPUT is a string, use it as the file path to be native compiled." (mapc (lambda (pass) (comp-log (format "Running pass %s:\n" pass)) (setq data (funcall pass data))) - comp-passes))) + comp-passes) + data)) (provide 'comp) diff --git a/src/comp.c b/src/comp.c index 3b124bef23a..fed599dc511 100644 --- a/src/comp.c +++ b/src/comp.c @@ -3061,16 +3061,15 @@ DEFUN ("comp--compile-ctxt-to-file", Fcomp__compile_ctxt_to_file, gcc_jit_context_dump_reproducer_to_file (comp.ctxt, "comp_reproducer.c"); AUTO_STRING (dot_so, NATIVE_ELISP_SUFFIX); - const char *filename = - (const char *) SDATA (CALLN (Fconcat, ctxtname, dot_so)); + Lisp_Object out_file = CALLN (Fconcat, ctxtname, dot_so); gcc_jit_context_compile_to_file (comp.ctxt, GCC_JIT_OUTPUT_KIND_DYNAMIC_LIBRARY, - filename); + SSDATA (out_file)); pthread_sigmask (SIG_SETMASK, &oldset, 0); - return Qt; + return out_file; } -- 2.39.5