path: root/mjit_worker.c
diff options
authorTakashi Kokubun <>2019-12-01 00:56:27 -0800
committerTakashi Kokubun <>2019-12-01 00:58:47 -0800
commita19d625e667024fe27dcee04dd748e914bc24762 (patch)
tree5ca8c6cec0d19cb54e8c2643d8736216bb6fd2e2 /mjit_worker.c
parentbdc62dfc8ecffd27dd5ad6756cce88eac5c993f5 (diff)
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.
Diffstat (limited to 'mjit_worker.c')
1 files changed, 4 insertions, 2 deletions
diff --git a/mjit_worker.c b/mjit_worker.c
index b23baf6..ce8133a 100644
--- a/mjit_worker.c
+++ b/mjit_worker.c
@@ -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;