summaryrefslogtreecommitdiffstats
path: root/lib/libthr
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2010-09-19 05:42:29 +0000
committerdavidxu <davidxu@FreeBSD.org>2010-09-19 05:42:29 +0000
commit4c94bb3829b85eea7184e6ca9e7c05f446f9a433 (patch)
treed4887ea3e6656cdec24c301d48f668ca0b86d474 /lib/libthr
parentad24f558bd7b034d0376f20da562ae31ddfe68b1 (diff)
downloadFreeBSD-src-4c94bb3829b85eea7184e6ca9e7c05f446f9a433.zip
FreeBSD-src-4c94bb3829b85eea7184e6ca9e7c05f446f9a433.tar.gz
- _Unwind_Resume function is not used, remove it.
- Use a store barrier to make sure uwl_forcedunwind is lastest thing other threads can see. - Add some comments.
Diffstat (limited to 'lib/libthr')
-rw-r--r--lib/libthr/thread/thr_exit.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/lib/libthr/thread/thr_exit.c b/lib/libthr/thread/thr_exit.c
index 83188c8..9c5fd95 100644
--- a/lib/libthr/thread/thr_exit.c
+++ b/lib/libthr/thread/thr_exit.c
@@ -63,7 +63,6 @@ static _Unwind_Reason_Code thread_unwind_stop(int version,
/* unwind library pointers */
static _Unwind_Reason_Code (*uwl_forcedunwind)(struct _Unwind_Exception *,
_Unwind_Stop_Fn, void *);
-static void (*uwl_resume)(struct _Unwind_Exception *exc);
static _Unwind_Word (*uwl_getcfa)(struct _Unwind_Context *);
static void
@@ -72,22 +71,24 @@ thread_uw_init(void)
static int inited = 0;
Dl_info dlinfo;
void *handle;
- void *forcedunwind, *resume, *getcfa;
+ void *forcedunwind, *getcfa;
if (inited)
return;
handle = RTLD_DEFAULT;
if ((forcedunwind = dlsym(handle, "_Unwind_ForcedUnwind")) != NULL) {
if (dladdr(forcedunwind, &dlinfo)) {
+ /*
+ * Make sure the address is always valid by holding the library,
+ * also assume functions are in same library.
+ */
if ((handle = dlopen(dlinfo.dli_fname, RTLD_LAZY)) != NULL) {
forcedunwind = dlsym(handle, "_Unwind_ForcedUnwind");
- resume = dlsym(handle, "_Unwind_Resume");
getcfa = dlsym(handle, "_Unwind_GetCFA");
- if (forcedunwind != NULL && resume != NULL &&
- getcfa != NULL) {
- uwl_forcedunwind = forcedunwind;
- uwl_resume = resume;
+ if (forcedunwind != NULL && getcfa != NULL) {
uwl_getcfa = getcfa;
+ atomic_store_rel_ptr((volatile void *)&uwl_forcedunwind,
+ (uintptr_t)forcedunwind);
} else {
dlclose(handle);
}
@@ -97,12 +98,6 @@ thread_uw_init(void)
inited = 1;
}
-void
-_Unwind_Resume(struct _Unwind_Exception *ex)
-{
- (*uwl_resume)(ex);
-}
-
_Unwind_Reason_Code
_Unwind_ForcedUnwind(struct _Unwind_Exception *ex, _Unwind_Stop_Fn stop_func,
void *stop_arg)
@@ -118,7 +113,6 @@ _Unwind_GetCFA(struct _Unwind_Context *context)
#else
#pragma weak _Unwind_GetCFA
#pragma weak _Unwind_ForcedUnwind
-#pragma weak _Unwind_Resume
#endif /* PIC */
static void
OpenPOWER on IntegriCloud