This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] hurd: add gscope support


	* elf/dl-support.c [THREAD_GSCOPE_GLOBAL] (_dl_thread_gscope_count):
	Define variable.
	* sysdeps/generic/ldsodefs.h [THREAD_GSCOPE_GLOBAL] (struct
	rtld_global): Add _dl_thread_gscope_count member.
	* sysdeps/mach/hurd/tls.h: Include <atomic.h>.
	[!defined __ASSEMBLER__] (THREAD_GSCOPE_GLOBAL, THREAD_GSCOPE_SET_FLAG,
	THREAD_GSCOPE_RESET_FLAG, THREAD_GSCOPE_WAIT): Define macros.
---
 ChangeLog                  | 10 ++++++++++
 elf/dl-support.c           |  3 +++
 sysdeps/generic/ldsodefs.h |  3 +++
 sysdeps/mach/hurd/tls.h    | 16 ++++++++++++++++
 4 files changed, 32 insertions(+)

diff --git a/elf/dl-support.c b/elf/dl-support.c
index 114f77a8e5..be564306f2 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -188,6 +188,9 @@ int (*_dl_make_stack_executable_hook) (void **) = _dl_make_stack_executable;
 /* Function in libpthread to wait for termination of lookups.  */
 void (*_dl_wait_lookup_done) (void);
 
+#ifdef THREAD_GSCOPE_GLOBAL
+int _dl_thread_gscope_count;
+#endif
 struct dl_scope_free_list *_dl_scope_free_list;
 
 #ifdef NEED_DL_SYSINFO
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 5e1b24ecb5..2447cd6717 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -435,6 +435,9 @@ struct rtld_global
     size_t count;
     void *list[50];
   } *_dl_scope_free_list;
+#ifdef THREAD_GSCOPE_GLOBAL
+  EXTERN int _dl_thread_gscope_count;
+#endif
 #ifdef SHARED
 };
 # define __rtld_global_attribute__
diff --git a/sysdeps/mach/hurd/tls.h b/sysdeps/mach/hurd/tls.h
index faff87c7b5..47a9a357c8 100644
--- a/sysdeps/mach/hurd/tls.h
+++ b/sysdeps/mach/hurd/tls.h
@@ -27,6 +27,7 @@
 # include <sysdep.h>
 # include <mach/mig_errors.h>
 # include <mach.h>
+# include <atomic.h>
 
 
 /* This is the size of the initial TCB.  */
@@ -51,6 +52,21 @@
 # define GET_DTV(descr) \
   (((tcbhead_t *) (descr))->dtv)
 
+/* Temporary poor-man's global scope switch support */
+#define THREAD_GSCOPE_GLOBAL
+#define THREAD_GSCOPE_SET_FLAG()					      \
+	atomic_increment(&GL(dl_thread_gscope_count))
+#define THREAD_GSCOPE_RESET_FLAG() do {					      \
+	if (atomic_decrement_val(&GL(dl_thread_gscope_count)) == 0)	      \
+		lll_wake(&GL(dl_thread_gscope_count), 0);		      \
+} while (0)
+#define THREAD_GSCOPE_WAIT() do {					      \
+	int count;							      \
+	while ((count = GL(dl_thread_gscope_count))) {			      \
+		lll_wait(&GL(dl_thread_gscope_count), count, 0);	      \
+	}								      \
+} while (0)
+
 #endif /* !ASSEMBLER */
 
 
-- 
2.16.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]