summaryrefslogtreecommitdiff
path: root/boehm-gc/dyn_load.c
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2000-02-14 21:53:27 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2000-02-14 21:53:27 +0000
commit6fc4950f05d425378ca7d1f3237aa759c761a07d (patch)
tree347e3b2add618ac89c250ec8658175ad538f1b65 /boehm-gc/dyn_load.c
parentd14933cf9ef9e536bbc0c621ea32a9d21467f247 (diff)
downloadgcc-6fc4950f05d425378ca7d1f3237aa759c761a07d.tar.gz
* gc.h (dlopen): Define as GC_dlopen on Linux.
(GC_dlopen): Declare on Linux. * dyn_load.c (GC_dlopen): Define for Linux. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31970 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'boehm-gc/dyn_load.c')
-rw-r--r--boehm-gc/dyn_load.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/boehm-gc/dyn_load.c b/boehm-gc/dyn_load.c
index 8c3ec4186c4..f44726bc833 100644
--- a/boehm-gc/dyn_load.c
+++ b/boehm-gc/dyn_load.c
@@ -32,7 +32,7 @@
#include "gc_priv.h"
/* BTL: avoid circular redefinition of dlopen if SOLARIS_THREADS defined */
-# if defined(SOLARIS_THREADS) && defined(dlopen)
+# if (defined(SOLARIS_THREADS) || defined(LINUX_THREADS)) && defined(dlopen)
/* To support threads in Solaris, gc.h interposes on dlopen by */
/* defining "dlopen" to be "GC_dlopen", which is implemented below. */
/* However, both GC_FirstDLOpenedLinkMap() and GC_dlopen() use the */
@@ -190,11 +190,6 @@ void * GC_dlopen(const char *path, int mode)
}
# endif /* SOLARIS_THREADS */
-/* BTL: added to fix circular dlopen definition if SOLARIS_THREADS defined */
-# if defined(GC_must_restore_redefined_dlopen)
-# define dlopen GC_dlopen
-# endif
-
# ifndef USE_PROC_FOR_LIBRARIES
void GC_register_dynamic_libraries()
{
@@ -260,6 +255,25 @@ void GC_register_dynamic_libraries()
# endif /* !USE_PROC ... */
# endif /* SUNOS */
+#ifdef LINUX_THREADS
+#include <dlfcn.h>
+
+void * GC_dlopen(const char *path, int mode)
+{
+ void * result;
+
+ LOCK();
+ result = dlopen(path, mode);
+ UNLOCK();
+ return(result);
+}
+#endif /* LINUX_THREADS */
+
+/* BTL: added to fix circular dlopen definition if SOLARIS_THREADS defined */
+#if defined(GC_must_restore_redefined_dlopen)
+# define dlopen GC_dlopen
+#endif
+
#if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF)
/* Dynamic loading code for Linux running ELF. Somewhat tested on