Tcl Source Code

Artifact [1404a0de3e]
Login

Artifact 1404a0de3e53f23f0fd32922bf031d633a8a4ffa:

Attachment "3216070.patch" to ticket [3216070fff] added by nijtmans 2011-03-16 19:26:42.
Index: unix/tclLoadDl.c
===================================================================
--- unix/tclLoadDl.c
+++ unix/tclLoadDl.c
@@ -17,21 +17,21 @@
 #   include <dlfcn.h>
 #endif
 
 /*
  * In some systems, like SunOS 4.1.3, the RTLD_NOW flag isn't defined and this
- * argument to dlopen must always be 1. The RTLD_GLOBAL flag is needed on some
- * systems (e.g. SCO and UnixWare) but doesn't exist on others; if it doesn't
- * exist, set it to 0 so it has no effect.
+ * argument to dlopen must always be 1. The RTLD_LOCAL flag doesn't exist on
+ * some platforms; if it doesn't exist, set it to 0 so it has no effect.
+ * See [Bug #3216070]
  */
 
 #ifndef RTLD_NOW
 #   define RTLD_NOW 1
 #endif
 
-#ifndef RTLD_GLOBAL
-#   define RTLD_GLOBAL 0
+#ifndef RTLD_LOCAL
+#   define RTLD_LOCAL 0
 #endif
 
 /*
  *---------------------------------------------------------------------------
  *
@@ -71,11 +71,11 @@
      * important if the cwd is inside a vfs, and we are trying to load using a
      * relative path.
      */
 
     native = Tcl_FSGetNativePath(pathPtr);
-    handle = dlopen(native, RTLD_NOW | RTLD_GLOBAL);
+    handle = dlopen(native, RTLD_NOW | RTLD_LOCAL);
     if (handle == NULL) {
 	/*
 	 * Let the OS loader examine the binary search path for whatever
 	 * string the user gave us which hopefully refers to a file on the
 	 * binary path.
@@ -83,11 +83,11 @@
 
 	Tcl_DString ds;
 	char *fileName = Tcl_GetString(pathPtr);
 
 	native = Tcl_UtfToExternalDString(NULL, fileName, -1, &ds);
-	handle = dlopen(native, RTLD_NOW | RTLD_GLOBAL);
+	handle = dlopen(native, RTLD_NOW | RTLD_LOCAL);
 	Tcl_DStringFree(&ds);
     }
 
     if (handle == NULL) {
 	/*

Index: unix/tclLoadDyld.c
===================================================================
--- unix/tclLoadDyld.c
+++ unix/tclLoadDyld.c
@@ -194,21 +194,21 @@
 #if TCL_DYLD_USE_DLFCN
 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1040
     if (tclMacOSXDarwinRelease >= 8)
 #endif
     {
-	dlHandle = dlopen(nativePath, RTLD_NOW | RTLD_GLOBAL);
+	dlHandle = dlopen(nativePath, RTLD_NOW | RTLD_LOCAL);
 	if (!dlHandle) {
 	    /*
 	     * Let the OS loader examine the binary search path for whatever
 	     * string the user gave us which hopefully refers to a file on the
 	     * binary path.
 	     */
 
 	    fileName = Tcl_GetString(pathPtr);
 	    nativeFileName = Tcl_UtfToExternalDString(NULL, fileName, -1, &ds);
-	    dlHandle = dlopen(nativeFileName, RTLD_NOW | RTLD_GLOBAL);
+	    dlHandle = dlopen(nativeFileName, RTLD_NOW | RTLD_LOCAL);
 	}
 	if (dlHandle) {
 	    TclLoadDbgMsg("dlopen() successful");
 	} else {
 	    errMsg = dlerror();