Allow specifying arbitrary MJIT flags by --jit-debug

This is a secret feature for me. It's only for testing and any behavior
with this flag override is unsupported.

I needed this because I sometimes want to add debug options but do not
want to disable optimizations, for using Linux perf.
This commit is contained in:
Takashi Kokubun 2019-12-01 00:56:27 -08:00
parent bdc62dfc8e
commit a19d625e66
No known key found for this signature in database
GPG key ID: 6FFC433B12EE23DD
5 changed files with 48 additions and 3 deletions

View file

@ -221,6 +221,8 @@ static VALUE valid_class_serials;
static const char *cc_path;
// Used C compiler flags.
static const char **cc_common_args;
// Used C compiler flags added by --jit-debug=...
static char **cc_added_args;
// Name of the precompiled header file.
static char *pch_file;
// The process id which should delete the pch_file on mjit_finish.
@ -759,7 +761,7 @@ make_pch(void)
};
verbose(2, "Creating precompiled header");
char **args = form_args(3, cc_common_args, CC_CODEFLAG_ARGS, rest_args);
char **args = form_args(4, cc_common_args, CC_CODEFLAG_ARGS, cc_added_args, rest_args);
if (args == NULL) {
mjit_warning("making precompiled header failed on forming args");
CRITICAL_SECTION_START(3, "in make_pch");
@ -796,7 +798,7 @@ compile_c_to_o(const char *c_file, const char *o_file)
"-c", NULL
};
char **args = form_args(4, cc_common_args, CC_CODEFLAG_ARGS, files, CC_LINKER_ARGS);
char **args = form_args(5, cc_common_args, CC_CODEFLAG_ARGS, cc_added_args, files, CC_LINKER_ARGS);
if (args == NULL)
return false;