From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: libc-alpha@sourceware.org
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Subject: [PATCH] hurd: add gscope support
Date: Thu, 01 Mar 2018 00:50:00 -0000 [thread overview]
Message-ID: <20180301005014.10220-1-samuel.thibault@ens-lyon.org> (raw)
* 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
next reply other threads:[~2018-03-01 0:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-01 0:50 Samuel Thibault [this message]
2018-03-01 1:17 ` Joseph Myers
2018-03-04 18:17 Samuel Thibault
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180301005014.10220-1-samuel.thibault@ens-lyon.org \
--to=samuel.thibault@ens-lyon.org \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).