merge revision(s) 50410,50412,50413,50414,50415,50416: [Backport #11111]

dln.c: use EXPORT_PREFIX

	* configure.in (EXPORT_PREFIX): define exported symbol prefix
  string in config.h.

	* dln.c (FUNCNAME_PREFIX): use configured EXPORT_PREFIX, not
  hardcoded condition.
	* dln.c (dln_load): check if a different libruby is loaded by the
	  extension library, and then bail out to get rid of very frequent
	  reported stale bug reports.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@50486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2015-05-13 15:47:39 +00:00
parent a1f41cafe8
commit aca1574676
3 changed files with 29 additions and 7 deletions

View file

@ -1,3 +1,9 @@
Thu May 14 00:39:29 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* dln.c (dln_load): check if a different libruby is loaded by the
extension library, and then bail out to get rid of very frequent
reported stale bug reports.
Thu May 14 00:29:44 2015 Nobuyoshi Nakada <nobu@ruby-lang.org> Thu May 14 00:29:44 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/fileutils.rb (FileUtils#mv): show the exact target path in * lib/fileutils.rb (FileUtils#mv): show the exact target path in

28
dln.c
View file

@ -106,13 +106,12 @@ dln_loaderror(const char *format, ...)
# define USE_DLN_DLOPEN # define USE_DLN_DLOPEN
#endif #endif
#ifndef FUNCNAME_PATTERN #if defined(__hp9000s300) || ((defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)) && !defined(__ELF__)) || defined(__BORLANDC__) || defined(NeXT) || defined(__WATCOMC__) || defined(MACOSX_DYLD)
# if defined(__hp9000s300) || ((defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)) && !defined(__ELF__)) || defined(__BORLANDC__) || defined(NeXT) || defined(__WATCOMC__) || defined(MACOSX_DYLD) # define EXTERNAL_PREFIX "_"
# define FUNCNAME_PREFIX "_Init_" #else
# else # define EXTERNAL_PREFIX ""
# define FUNCNAME_PREFIX "Init_"
# endif
#endif #endif
#define FUNCNAME_PREFIX EXTERNAL_PREFIX"Init_"
#if defined __CYGWIN__ || defined DOSISH #if defined __CYGWIN__ || defined DOSISH
#define isdirsep(x) ((x) == '/' || (x) == '\\') #define isdirsep(x) ((x) == '/' || (x) == '\\')
@ -1330,6 +1329,23 @@ dln_load(const char *file)
error = dln_strerror(); error = dln_strerror();
goto failed; goto failed;
} }
# if defined RUBY_EXPORT
{
static const char incompatible[] = "incompatible library version";
void *ex = dlsym(handle, EXTERNAL_PREFIX"ruby_xmalloc");
if (ex && ex != ruby_xmalloc) {
# if defined __APPLE__
/* dlclose() segfaults */
rb_fatal("%s - %s", incompatible, file);
# else
dlclose(handle);
error = incompatible;
goto failed;
# endif
}
}
# endif
init_fct = (void(*)())(VALUE)dlsym(handle, buf); init_fct = (void(*)())(VALUE)dlsym(handle, buf);
if (init_fct == NULL) { if (init_fct == NULL) {

View file

@ -1,6 +1,6 @@
#define RUBY_VERSION "2.2.3" #define RUBY_VERSION "2.2.3"
#define RUBY_RELEASE_DATE "2015-05-14" #define RUBY_RELEASE_DATE "2015-05-14"
#define RUBY_PATCHLEVEL 99 #define RUBY_PATCHLEVEL 100
#define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_YEAR 2015
#define RUBY_RELEASE_MONTH 5 #define RUBY_RELEASE_MONTH 5