From 13dc8e4ef0c45dc51af820bbca1315edc0b70fb2 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 28 Apr 2018 01:45:52 +0000 Subject: mjit_config.h: expand min header name * Makefile.in, win32/Makefile.sub (mjit_config.h): expand min header name, including the version number and the suffix. * mjit.c (init_header_filename): the version number and the suffix are now included in the header name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- mjit.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'mjit.c') diff --git a/mjit.c b/mjit.c index 0b2bb98041..32a77b5467 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); -- cgit v1.2.3