diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-07 02:49:26 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-07 02:49:26 +0000 |
commit | f837601cdb32ab25f19f83f0ec2ed840ed225a83 (patch) | |
tree | 0b0d43ca45257ba58443ad503025e3d53bfc9ee3 /mjit.c | |
parent | 92e9f61579d1146758f3f2c31895b4ba959ae0cc (diff) |
mjit_build_dir: separate MJIT_BUILD_DIR
* Makefile.in (mjit_build_dir.so): separate MJIT_BUILD_DIR to
eliminate the feature for test-all after installation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'mjit.c')
-rw-r--r-- | mjit.c | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -388,7 +388,7 @@ init_header_filename(void) const size_t libpathflag_len = sizeof(libpathflag) - 1; #endif #ifndef LOAD_RELATIVE - static const char build_dir[] = MJIT_BUILD_DIR; + const char *build_dir = 0; struct stat st; #endif @@ -401,7 +401,12 @@ init_header_filename(void) /* This path is not intended to be used on production, but using build directory's header file here because people want to run `make test-all` without running `make install`. Don't use $MJIT_SEARCH_BUILD_DIR except for test-all. */ - if (build_dir[0] != '/') { + + build_dir = dlsym(RTLD_DEFAULT, "MJIT_BUILD_DIR"); + if (!build_dir) { + verbose(1, "No mjit_build_directory"); + } + else if (build_dir[0] != '/') { verbose(1, "Non-absolute path MJIT_BUILD_DIR: %s", build_dir); } else if (stat(build_dir, &st) || !S_ISDIR(st.st_mode)) { @@ -412,8 +417,14 @@ init_header_filename(void) return FALSE; } else { + /* Do not pass PRELOADENV to child processes, on + * multi-arch environment */ + verbose(3, "PRELOADENV("PRELOADENV")=%s", getenv(PRELOADENV)); + /* assume no other PRELOADENV in test-all */ + unsetenv(PRELOADENV); + verbose(3, "MJIT_BUILD_DIR: %s", build_dir); basedir = build_dir; - baselen = sizeof(build_dir) - 1; + baselen = strlen(build_dir); } } #endif |