aboutsummaryrefslogtreecommitdiffstats
path: root/src/comp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/comp.c')
-rw-r--r--src/comp.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/comp.c b/src/comp.c
index a00088bb7f8..97a56658707 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -54,6 +54,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
54#undef gcc_jit_block_end_with_return 54#undef gcc_jit_block_end_with_return
55#undef gcc_jit_block_end_with_void_return 55#undef gcc_jit_block_end_with_void_return
56#undef gcc_jit_context_acquire 56#undef gcc_jit_context_acquire
57#undef gcc_jit_context_add_driver_option
57#undef gcc_jit_context_compile_to_file 58#undef gcc_jit_context_compile_to_file
58#undef gcc_jit_context_dump_reproducer_to_file 59#undef gcc_jit_context_dump_reproducer_to_file
59#undef gcc_jit_context_dump_to_file 60#undef gcc_jit_context_dump_to_file
@@ -119,6 +120,8 @@ DEF_DLL_FN (const char *, gcc_jit_context_get_first_error,
119DEF_DLL_FN (gcc_jit_block *, gcc_jit_function_new_block, 120DEF_DLL_FN (gcc_jit_block *, gcc_jit_function_new_block,
120 (gcc_jit_function *func, const char *name)); 121 (gcc_jit_function *func, const char *name));
121DEF_DLL_FN (gcc_jit_context *, gcc_jit_context_acquire, (void)); 122DEF_DLL_FN (gcc_jit_context *, gcc_jit_context_acquire, (void));
123DEF_DLL_FN (void, gcc_jit_context_add_driver_option,
124 (gcc_jit_context *ctxt, const char *optname));
122DEF_DLL_FN (gcc_jit_field *, gcc_jit_context_new_field, 125DEF_DLL_FN (gcc_jit_field *, gcc_jit_context_new_field,
123 (gcc_jit_context *ctxt, gcc_jit_location *loc, gcc_jit_type *type, 126 (gcc_jit_context *ctxt, gcc_jit_location *loc, gcc_jit_type *type,
124 const char *name)); 127 const char *name));
@@ -256,6 +259,7 @@ init_gccjit_functions (void)
256 LOAD_DLL_FN (library, gcc_jit_block_end_with_return); 259 LOAD_DLL_FN (library, gcc_jit_block_end_with_return);
257 LOAD_DLL_FN (library, gcc_jit_block_end_with_void_return); 260 LOAD_DLL_FN (library, gcc_jit_block_end_with_void_return);
258 LOAD_DLL_FN (library, gcc_jit_context_acquire); 261 LOAD_DLL_FN (library, gcc_jit_context_acquire);
262 LOAD_DLL_FN (library, gcc_jit_context_add_driver_option);
259 LOAD_DLL_FN (library, gcc_jit_context_compile_to_file); 263 LOAD_DLL_FN (library, gcc_jit_context_compile_to_file);
260 LOAD_DLL_FN (library, gcc_jit_context_dump_reproducer_to_file); 264 LOAD_DLL_FN (library, gcc_jit_context_dump_reproducer_to_file);
261 LOAD_DLL_FN (library, gcc_jit_context_dump_to_file); 265 LOAD_DLL_FN (library, gcc_jit_context_dump_to_file);
@@ -317,6 +321,7 @@ init_gccjit_functions (void)
317#define gcc_jit_block_end_with_return fn_gcc_jit_block_end_with_return 321#define gcc_jit_block_end_with_return fn_gcc_jit_block_end_with_return
318#define gcc_jit_block_end_with_void_return fn_gcc_jit_block_end_with_void_return 322#define gcc_jit_block_end_with_void_return fn_gcc_jit_block_end_with_void_return
319#define gcc_jit_context_acquire fn_gcc_jit_context_acquire 323#define gcc_jit_context_acquire fn_gcc_jit_context_acquire
324#define gcc_jit_context_add_driver_option fn_gcc_jit_context_add_driver_option
320#define gcc_jit_context_compile_to_file fn_gcc_jit_context_compile_to_file 325#define gcc_jit_context_compile_to_file fn_gcc_jit_context_compile_to_file
321#define gcc_jit_context_dump_reproducer_to_file fn_gcc_jit_context_dump_reproducer_to_file 326#define gcc_jit_context_dump_reproducer_to_file fn_gcc_jit_context_dump_reproducer_to_file
322#define gcc_jit_context_dump_to_file fn_gcc_jit_context_dump_to_file 327#define gcc_jit_context_dump_to_file fn_gcc_jit_context_dump_to_file
@@ -4118,6 +4123,26 @@ DEFUN ("comp--release-ctxt", Fcomp__release_ctxt, Scomp__release_ctxt,
4118} 4123}
4119 4124
4120static void 4125static void
4126add_driver_options ()
4127{
4128 Lisp_Object options = Fsymbol_value (Qcomp_native_driver_options);
4129
4130#ifdef LIBGCCJIT_HAVE_gcc_jit_context_add_command_line_option
4131 while (CONSP (options))
4132 {
4133 gcc_jit_context_add_driver_option (comp.ctxt, SSDATA (XCAR (options)));
4134 options = XCDR (options);
4135 }
4136#else
4137 if (CONSP (options))
4138 {
4139 xsignal1 (Qnative_compiler_error,
4140 build_string ("Customizing native compiler options via `comp-native-driver-options' is only available on libgccjit version 9 and above."));
4141 }
4142#endif
4143}
4144
4145static void
4121restore_sigmask (void) 4146restore_sigmask (void)
4122{ 4147{
4123 pthread_sigmask (SIG_SETMASK, &saved_sigset, 0); 4148 pthread_sigmask (SIG_SETMASK, &saved_sigset, 0);
@@ -4186,6 +4211,8 @@ DEFUN ("comp--compile-ctxt-to-file", Fcomp__compile_ctxt_to_file,
4186 for (ptrdiff_t i = 0; i < func_h->count; i++) 4211 for (ptrdiff_t i = 0; i < func_h->count; i++)
4187 compile_function (HASH_VALUE (func_h, i)); 4212 compile_function (HASH_VALUE (func_h, i));
4188 4213
4214 add_driver_options ();
4215
4189 if (COMP_DEBUG) 4216 if (COMP_DEBUG)
4190 gcc_jit_context_dump_to_file (comp.ctxt, 4217 gcc_jit_context_dump_to_file (comp.ctxt,
4191 format_string ("%s.c", SSDATA (base_name)), 4218 format_string ("%s.c", SSDATA (base_name)),
@@ -4992,6 +5019,7 @@ native compiled one. */);
4992 5019
4993 DEFSYM (Qcomp_speed, "comp-speed"); 5020 DEFSYM (Qcomp_speed, "comp-speed");
4994 DEFSYM (Qcomp_debug, "comp-debug"); 5021 DEFSYM (Qcomp_debug, "comp-debug");
5022 DEFSYM (Qcomp_native_driver_options, "comp-native-driver-options");
4995 5023
4996 /* Limple instruction set. */ 5024 /* Limple instruction set. */
4997 DEFSYM (Qcomment, "comment"); 5025 DEFSYM (Qcomment, "comment");