1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2018-04-28 01:45:52 +00:00
parent 1d67b9de28
commit 13dc8e4ef0
4 changed files with 8 additions and 13 deletions

View file

@ -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; \

View file

@ -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)

14
mjit.c
View file

@ -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);

View file

@ -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 ) & \