summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.in2
-rw-r--r--common.mk3
-rw-r--r--mjit.c14
-rw-r--r--win32/Makefile.sub2
4 files changed, 8 insertions, 13 deletions
diff --git a/Makefile.in b/Makefile.in
index 4dc0178..e0de480 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -562,7 +562,7 @@ mjit_config.h:
echo '#define RUBY_MJIT_CONFIG_H 1'; \
echo; \
sep=; \
- quote MJIT_HEADER_INSTALL_DIR "$(MJIT_HEADER_INSTALL_DIR)"; \
+ quote MJIT_MIN_HEADER_NAME "/$(MJIT_HEADER_INSTALL_DIR)/$(MJIT_MIN_HEADER_NAME)"; \
sep=,; \
quote "MJIT_CC_COMMON " $(MJIT_CC); \
quote "MJIT_CFLAGS $${archs:+ MJIT_ARCHFLAG}" -w; \
diff --git a/common.mk b/common.mk
index 9370b50..1439ac9 100644
--- a/common.mk
+++ b/common.mk
@@ -60,7 +60,8 @@ RDOCOUT = $(EXTOUT)/rdoc
HTMLOUT = $(EXTOUT)/html
CAPIOUT = doc/capi
MJIT_HEADER = rb_mjit_header.h
-MJIT_MIN_HEADER = $(MJIT_HEADER_BUILD_DIR)/rb_mjit_min_header-$(RUBY_PROGRAM_VERSION).h
+MJIT_MIN_HEADER_NAME = rb_mjit_min_header-$(RUBY_PROGRAM_VERSION).h
+MJIT_MIN_HEADER = $(MJIT_HEADER_BUILD_DIR)/$(MJIT_MIN_HEADER_NAME)
MJIT_HEADER_BUILD_DIR = $(EXTOUT)/include/$(arch)
INITOBJS = dmyext.$(OBJEXT) dmyenc.$(OBJEXT)
diff --git a/mjit.c b/mjit.c
index 0b2bb98..32a77b5 100644
--- a/mjit.c
+++ b/mjit.c
@@ -1184,8 +1184,6 @@ mjit_get_iseq_func(struct rb_iseq_constant_body *body)
return body->jit_func;
}
-/* A name of the header file included in any C file generated by MJIT for iseqs. */
-#define RUBY_MJIT_HEADER_NAME "rb_mjit_min_header-"
/* GCC and CLANG executable paths. TODO: The paths should absolute
ones to prevent changing C compiler for security reasons. */
#define CC_PATH CC_COMMON_ARGS[0]
@@ -1200,9 +1198,8 @@ init_header_filename(void)
VALUE basedir_val;
char *basedir;
size_t baselen;
- size_t verlen;
- static const char header_name[] =
- "/" MJIT_HEADER_INSTALL_DIR "/" RUBY_MJIT_HEADER_NAME;
+ /* A name of the header file included in any C file generated by MJIT for iseqs. */
+ static const char header_name[] = MJIT_MIN_HEADER_NAME;
const size_t header_name_len = sizeof(header_name) - 1;
char *p;
#ifdef _WIN32
@@ -1219,13 +1216,10 @@ init_header_filename(void)
basedir_val = ruby_prefix_path;
basedir = StringValuePtr(basedir_val);
baselen = RSTRING_LEN(basedir_val);
- verlen = strlen(ruby_version);
- header_file = xmalloc(baselen + header_name_len + verlen + rb_strlen_lit(".h") + 1);
+ header_file = xmalloc(baselen + header_name_len + 1);
p = append_str2(header_file, basedir, baselen);
- p = append_str2(p, header_name, header_name_len);
- p = append_str2(p, ruby_version, verlen);
- p = append_str2(p, ".h", rb_strlen_lit(".h") + 1);
+ p = append_str2(p, header_name, header_name_len + 1);
if ((fd = rb_cloexec_open(header_file, O_RDONLY, 0)) < 0) {
verbose(2, "Cannot access header file %s\n", header_file);
xfree(header_file);
diff --git a/win32/Makefile.sub b/win32/Makefile.sub
index bd54f1d..61d492a 100644
--- a/win32/Makefile.sub
+++ b/win32/Makefile.sub
@@ -1281,7 +1281,7 @@ mjit_config.h:
#ifndef RUBY_MJIT_CONFIG_H
#define RUBY_MJIT_CONFIG_H 1
-#define MJIT_HEADER_INSTALL_DIR "$(MJIT_HEADER_INSTALL_DIR)"
+#define MJIT_MIN_HEADER_NAME "/$(MJIT_HEADER_INSTALL_DIR)/$(MJIT_MIN_HEADER_NAME)"
<<KEEP
@
@(set sep=#define MJIT_CC_COMMON ) & \