diff options
author | Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr> | 2016-10-06 20:15:58 +0200 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2016-11-29 08:39:15 +0100 |
commit | 43a336e63f16c639e0e6fefdd7404509159c07b1 (patch) | |
tree | 926cd30d04e72d76ed3b0d23084a71eeb9c13fac /libpthread/nptl/sysdeps/pthread/unwind-forcedunwind.c | |
parent | b433e2d9fccb17f9a2807403c339a7004e3d4f1b (diff) |
libpthread: Fix inclusion of unwind code.
Since librt and libpthread are now integrated into libc, including
unwind-resume and unwind-forcedunwind implementations of unwind code
makes no sense. Only unwind-forcedunwind is now included with
functions hidden to avoid them overriding the ones from libgcc_s.
* libpthread/nptl/sysdeps/generic/unwind-resume.h: New. Define
generic PERSONALITY_PROTO and PERSONALITY_ARGS and set
HAVE_ARCH_UNWIND_RESUME to 0.
* libpthread/nptl/sysdeps/pthread/unwind-resume.c: Move...
* libpthread/nptl/sysdeps/generic/unwind-resume.c: ... here. Include
generic implementation of _Unwind_Resume on the condition that
!HAVE_ARCH_UNWIND_RESUME. Make functions hidden to prevent them
from overriding libgcc_s's ones.
* libpthread/nptl/sysdeps/pthread/unwind-forcedunwind.c: Likewise.
* libpthread/nptl/sysdeps/arm/unwind-resume.h: New. Define
ARM-specific PERSONALITY_PROTO and PERSONALITY_ARGS and set
HAVE_ARCH_UNWIND_RESUME to 1.
* libpthread/nptl/sysdeps/arm/arm-unwind-resume.c,
* libpthread/nptl/sysdeps/arm/pt-arm-unwind-resume.c,
* libpthread/nptl/sysdeps/arm/rt-arm-unwind-resume.c: New.
ARM-specific implementations of _Unwind_Resume resp. for libc,
libpthread and librt.
* libpthread/nptl/sysdeps/Makefile.commonarch: Remove both
arm-unwind-resume and rt-arm-unwind-resume from
libpthread_arch_CSRC.
* libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-forcedunwind.c,
* libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-resume.c: Remove.
Signed-off-by: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>
Diffstat (limited to 'libpthread/nptl/sysdeps/pthread/unwind-forcedunwind.c')
-rw-r--r-- | libpthread/nptl/sysdeps/pthread/unwind-forcedunwind.c | 49 |
1 files changed, 18 insertions, 31 deletions
diff --git a/libpthread/nptl/sysdeps/pthread/unwind-forcedunwind.c b/libpthread/nptl/sysdeps/pthread/unwind-forcedunwind.c index 6b6ad6f4f..fd45ce10c 100644 --- a/libpthread/nptl/sysdeps/pthread/unwind-forcedunwind.c +++ b/libpthread/nptl/sysdeps/pthread/unwind-forcedunwind.c @@ -22,16 +22,16 @@ #include <pthreadP.h> #include <sysdep.h> #include <libgcc_s.h> +#include <unwind-resume.h> #define __libc_dlopen(x) dlopen(x, (RTLD_LOCAL | RTLD_LAZY)) #define __libc_dlsym dlsym #define __libc_dlclose dlclose 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 *, - struct _Unwind_Context *); +void (*__libgcc_s_resume) (struct _Unwind_Exception *exc) + attribute_hidden __attribute__ ((noreturn)); +static _Unwind_Reason_Code (*libgcc_s_personality) PERSONALITY_PROTO; static _Unwind_Reason_Code (*libgcc_s_forcedunwind) (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *); static _Unwind_Word (*libgcc_s_getcfa) (struct _Unwind_Context *); @@ -66,11 +66,12 @@ pthread_cancel_init (void) #endif ) { - printf (LIBGCC_S_SO " must be installed for pthread_cancel to work\n"); + fprintf (stderr, + LIBGCC_S_SO " must be installed for pthread_cancel to work\n"); abort(); } - libgcc_s_resume = resume; + __libgcc_s_resume = resume; libgcc_s_personality = personality; libgcc_s_forcedunwind = forcedunwind; libgcc_s_getcfa = getcfa; @@ -93,55 +94,41 @@ __unwind_freeres (void) } } -void +#if !HAVE_ARCH_UNWIND_RESUME +void attribute_hidden _Unwind_Resume (struct _Unwind_Exception *exc) { if (__builtin_expect (libgcc_s_handle == NULL, 0)) pthread_cancel_init (); - void (*resume) (struct _Unwind_Exception *exc) = libgcc_s_resume; - resume (exc); + __libgcc_s_resume(exc); } +#endif -_Unwind_Reason_Code -__gcc_personality_v0 (int version, _Unwind_Action actions, - _Unwind_Exception_Class exception_class, - struct _Unwind_Exception *ue_header, - struct _Unwind_Context *context); -_Unwind_Reason_Code -__gcc_personality_v0 (int version, _Unwind_Action actions, - _Unwind_Exception_Class exception_class, - struct _Unwind_Exception *ue_header, - struct _Unwind_Context *context) +_Unwind_Reason_Code attribute_hidden +__gcc_personality_v0 PERSONALITY_PROTO { if (__builtin_expect (libgcc_s_handle == NULL, 0)) pthread_cancel_init (); - _Unwind_Reason_Code (*personality) - (int, _Unwind_Action, _Unwind_Exception_Class, struct _Unwind_Exception *, - struct _Unwind_Context *) = libgcc_s_personality; - return personality (version, actions, exception_class, ue_header, context); + return libgcc_s_personality PERSONALITY_ARGS; } -_Unwind_Reason_Code +_Unwind_Reason_Code attribute_hidden _Unwind_ForcedUnwind (struct _Unwind_Exception *exc, _Unwind_Stop_Fn stop, void *stop_argument) { if (__builtin_expect (libgcc_s_handle == NULL, 0)) pthread_cancel_init (); - _Unwind_Reason_Code (*forcedunwind) - (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *) - = libgcc_s_forcedunwind; - return forcedunwind (exc, stop, stop_argument); + return libgcc_s_forcedunwind (exc, stop, stop_argument); } -_Unwind_Word +_Unwind_Word attribute_hidden _Unwind_GetCFA (struct _Unwind_Context *context) { if (__builtin_expect (libgcc_s_handle == NULL, 0)) pthread_cancel_init (); - _Unwind_Word (*getcfa) (struct _Unwind_Context *) = libgcc_s_getcfa; - return getcfa (context); + return libgcc_s_getcfa (context); } |