From b3862ba3c8905a9332bd4338068a26062e1e2722 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Fri, 13 Feb 2009 17:34:30 +0000 Subject: [PATCH] 2009-02-13 Khem Raj * sysdeps/unix/sysv/linux/hppa/nptl/unwind-forcedunwind.c (libgcc_s_handle): New variable. (pthread_cancel_init): Depend in libgcc_s_handle for decision to load DSO. Assign last. (__unwind_freeres): New function. --- ChangeLog.hppa | 8 ++++++++ .../unix/sysv/linux/hppa/nptl/unwind-forcedunwind.c | 20 +++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/ChangeLog.hppa b/ChangeLog.hppa index 0fac875..a817e5f 100644 --- a/ChangeLog.hppa +++ b/ChangeLog.hppa @@ -1,3 +1,11 @@ +2009-02-13 Khem Raj + + * sysdeps/unix/sysv/linux/hppa/nptl/unwind-forcedunwind.c + (libgcc_s_handle): New variable. + (pthread_cancel_init): Depend in libgcc_s_handle for decision to + load DSO. Assign last. + (__unwind_freeres): New function. + 2009-02-09 Arthur Loiret [BZ #9717] diff --git a/sysdeps/unix/sysv/linux/hppa/nptl/unwind-forcedunwind.c b/sysdeps/unix/sysv/linux/hppa/nptl/unwind-forcedunwind.c index 8666bbb..cea5d3b 100644 --- a/sysdeps/unix/sysv/linux/hppa/nptl/unwind-forcedunwind.c +++ b/sysdeps/unix/sysv/linux/hppa/nptl/unwind-forcedunwind.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005, 2006 Free Software Foundation, Inc. +/* Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -23,6 +23,7 @@ #define LIBGCC_S_SO "libgcc_s.so.4" +static void *libgcc_s_handle; static void (*libgcc_s_resume) (struct _Unwind_Exception *exc); static _Unwind_Reason_Code (*libgcc_s_personality) (int, _Unwind_Action, _Unwind_Exception_Class, struct _Unwind_Exception *, @@ -42,7 +43,7 @@ pthread_cancel_init (void) void *resume, *personality, *forcedunwind, *getcfa; void *handle; - if (__builtin_expect (libgcc_s_getcfa != NULL, 1)) + if (__builtin_expect (libgcc_s_handle != NULL, 1)) { /* Force gcc to reload all values. */ asm volatile ("" ::: "memory"); @@ -66,11 +67,24 @@ pthread_cancel_init (void) libgcc_s_resume = resume; libgcc_s_personality = personality; libgcc_s_forcedunwind = forcedunwind; + libgcc_s_getcfa = getcfa; /* Make sure libgcc_s_getcfa is written last. Otherwise, pthread_cancel_init might return early even when the pointer the caller is interested in is not initialized yet. */ atomic_write_barrier (); - libgcc_s_getcfa = getcfa; + libgcc_s_handle = handle; +} + +void +__libc_freeres_fn_section +__unwind_freeres (void) +{ + void *handle = libgcc_s_handle; + if (handle != NULL) + { + libgcc_s_handle = NULL; + __libc_dlclose (handle); + } } void -- 2.7.4