diff options
| author | Eli Zaretskii | 2021-03-07 12:49:05 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2021-03-07 12:49:05 +0200 |
| commit | 7a13a0d616cde9f0f2a6fe217144e9891e769b61 (patch) | |
| tree | 03d992f5338d077e6df4a055052e5f89b901ab2e /src | |
| parent | c60f2f458a63a8ae4288652228f24e43fdc7bba7 (diff) | |
| download | emacs-7a13a0d616cde9f0f2a6fe217144e9891e769b61.tar.gz emacs-7a13a0d616cde9f0f2a6fe217144e9891e769b61.zip | |
Fix libgccjit PROGNAME on MS-Windows
* src/comp.c [WINDOWSNT]: Import gcc_jit_context_set_str_option.
(init_gccjit_functions): Load gcc_jit_context_set_str_option.
(gcc_jit_context_set_str_option) [WINDOWSNT]: New macro.
(Fcomp__compile_ctxt_to_file) [WINDOWSNT]: Pass the actual name of
the libgccjit DLL to the library, to be used as PROGNAME.
Diffstat (limited to 'src')
| -rw-r--r-- | src/comp.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/comp.c b/src/comp.c index 94d3fa99a33..d9ad623ec79 100644 --- a/src/comp.c +++ b/src/comp.c | |||
| @@ -89,6 +89,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 89 | #undef gcc_jit_context_set_bool_option | 89 | #undef gcc_jit_context_set_bool_option |
| 90 | #undef gcc_jit_context_set_int_option | 90 | #undef gcc_jit_context_set_int_option |
| 91 | #undef gcc_jit_context_set_logfile | 91 | #undef gcc_jit_context_set_logfile |
| 92 | #undef gcc_jit_context_set_str_option | ||
| 92 | #undef gcc_jit_function_get_param | 93 | #undef gcc_jit_function_get_param |
| 93 | #undef gcc_jit_function_new_block | 94 | #undef gcc_jit_function_new_block |
| 94 | #undef gcc_jit_function_new_local | 95 | #undef gcc_jit_function_new_local |
| @@ -248,6 +249,9 @@ DEF_DLL_FN (void, gcc_jit_context_set_int_option, | |||
| 248 | (gcc_jit_context *ctxt, enum gcc_jit_int_option opt, int value)); | 249 | (gcc_jit_context *ctxt, enum gcc_jit_int_option opt, int value)); |
| 249 | DEF_DLL_FN (void, gcc_jit_context_set_logfile, | 250 | DEF_DLL_FN (void, gcc_jit_context_set_logfile, |
| 250 | (gcc_jit_context *ctxt, FILE *logfile, int flags, int verbosity)); | 251 | (gcc_jit_context *ctxt, FILE *logfile, int flags, int verbosity)); |
| 252 | DEF_DLL_FN (void, gcc_jit_context_set_str_option, | ||
| 253 | (gcc_jit_context *ctxt, enum gcc_jit_str_option opt, | ||
| 254 | const char *value)); | ||
| 251 | DEF_DLL_FN (void, gcc_jit_struct_set_fields, | 255 | DEF_DLL_FN (void, gcc_jit_struct_set_fields, |
| 252 | (gcc_jit_struct *struct_type, gcc_jit_location *loc, int num_fields, | 256 | (gcc_jit_struct *struct_type, gcc_jit_location *loc, int num_fields, |
| 253 | gcc_jit_field **fields)); | 257 | gcc_jit_field **fields)); |
| @@ -304,6 +308,7 @@ init_gccjit_functions (void) | |||
| 304 | LOAD_DLL_FN (library, gcc_jit_context_set_bool_option); | 308 | LOAD_DLL_FN (library, gcc_jit_context_set_bool_option); |
| 305 | LOAD_DLL_FN (library, gcc_jit_context_set_int_option); | 309 | LOAD_DLL_FN (library, gcc_jit_context_set_int_option); |
| 306 | LOAD_DLL_FN (library, gcc_jit_context_set_logfile); | 310 | LOAD_DLL_FN (library, gcc_jit_context_set_logfile); |
| 311 | LOAD_DLL_FN (library, gcc_jit_context_set_str_option); | ||
| 307 | LOAD_DLL_FN (library, gcc_jit_function_get_param); | 312 | LOAD_DLL_FN (library, gcc_jit_function_get_param); |
| 308 | LOAD_DLL_FN (library, gcc_jit_function_new_block); | 313 | LOAD_DLL_FN (library, gcc_jit_function_new_block); |
| 309 | LOAD_DLL_FN (library, gcc_jit_function_new_local); | 314 | LOAD_DLL_FN (library, gcc_jit_function_new_local); |
| @@ -373,6 +378,7 @@ init_gccjit_functions (void) | |||
| 373 | #define gcc_jit_context_set_bool_option fn_gcc_jit_context_set_bool_option | 378 | #define gcc_jit_context_set_bool_option fn_gcc_jit_context_set_bool_option |
| 374 | #define gcc_jit_context_set_int_option fn_gcc_jit_context_set_int_option | 379 | #define gcc_jit_context_set_int_option fn_gcc_jit_context_set_int_option |
| 375 | #define gcc_jit_context_set_logfile fn_gcc_jit_context_set_logfile | 380 | #define gcc_jit_context_set_logfile fn_gcc_jit_context_set_logfile |
| 381 | #define gcc_jit_context_set_str_option fn_gcc_jit_context_set_str_option | ||
| 376 | #define gcc_jit_function_get_param fn_gcc_jit_function_get_param | 382 | #define gcc_jit_function_get_param fn_gcc_jit_function_get_param |
| 377 | #define gcc_jit_function_new_block fn_gcc_jit_function_new_block | 383 | #define gcc_jit_function_new_block fn_gcc_jit_function_new_block |
| 378 | #define gcc_jit_function_new_local fn_gcc_jit_function_new_local | 384 | #define gcc_jit_function_new_local fn_gcc_jit_function_new_local |
| @@ -4364,6 +4370,30 @@ DEFUN ("comp--compile-ctxt-to-file", Fcomp__compile_ctxt_to_file, | |||
| 4364 | 4370 | ||
| 4365 | comp.func_relocs_local = NULL; | 4371 | comp.func_relocs_local = NULL; |
| 4366 | 4372 | ||
| 4373 | #ifdef WINDOWSNT | ||
| 4374 | /* Tell libgccjit the actual file name of the loaded DLL, otherwise | ||
| 4375 | it will use 'libgccjit.so', which is not useful. */ | ||
| 4376 | Lisp_Object libgccjit_loaded_from = Fget (Qgccjit, QCloaded_from); | ||
| 4377 | Lisp_Object libgccjit_fname; | ||
| 4378 | |||
| 4379 | if (CONSP (libgccjit_loaded_from)) | ||
| 4380 | { | ||
| 4381 | /* Use the absolute file name if available, otherwise the name | ||
| 4382 | we looked for in w32_delayed_load. */ | ||
| 4383 | libgccjit_fname = XCDR (libgccjit_loaded_from); | ||
| 4384 | if (NILP (libgccjit_fname)) | ||
| 4385 | libgccjit_fname = XCAR (libgccjit_loaded_from); | ||
| 4386 | /* Must encode to ANSI, as libgccjit will not be able to handle | ||
| 4387 | UTF-8 encoded file names. */ | ||
| 4388 | libgccjit_fname = ansi_encode_filename (libgccjit_fname); | ||
| 4389 | gcc_jit_context_set_str_option (comp.ctxt, GCC_JIT_STR_OPTION_PROGNAME, | ||
| 4390 | SSDATA (libgccjit_fname)); | ||
| 4391 | } | ||
| 4392 | else /* this should never happen */ | ||
| 4393 | gcc_jit_context_set_str_option (comp.ctxt, GCC_JIT_STR_OPTION_PROGNAME, | ||
| 4394 | "libgccjit-0.dll"); | ||
| 4395 | #endif | ||
| 4396 | |||
| 4367 | comp.speed = XFIXNUM (CALL1I (comp-ctxt-speed, Vcomp_ctxt)); | 4397 | comp.speed = XFIXNUM (CALL1I (comp-ctxt-speed, Vcomp_ctxt)); |
| 4368 | eassert (comp.speed < INT_MAX); | 4398 | eassert (comp.speed < INT_MAX); |
| 4369 | comp.debug = XFIXNUM (CALL1I (comp-ctxt-debug, Vcomp_ctxt)); | 4399 | comp.debug = XFIXNUM (CALL1I (comp-ctxt-debug, Vcomp_ctxt)); |