From 3142b1ac55b1a807b196844f8f4ec6a9c1f5a0a5 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 8 May 2006 01:01:08 +0000 Subject: [BZ #2644] 2006-05-07 Ulrich Drepper * sysdeps/unix/sysv/linux/ia64/unwind-forcedunwind.c: Make sure functions pointer is reloaded after pthread_cancel_init calls. [BZ #2644] * sysdeps/pthread/unwind-forcedunwind.c: Make sure functions pointers are reloaded after pthread_cancel_init calls. --- nptl/sysdeps/pthread/unwind-forcedunwind.c | 34 ++++++++++++++++------ .../unix/sysv/linux/ia64/unwind-forcedunwind.c | 8 +++-- 2 files changed, 31 insertions(+), 11 deletions(-) (limited to 'nptl/sysdeps') diff --git a/nptl/sysdeps/pthread/unwind-forcedunwind.c b/nptl/sysdeps/pthread/unwind-forcedunwind.c index 9a38704..47f67bc 100644 --- a/nptl/sysdeps/pthread/unwind-forcedunwind.c +++ b/nptl/sysdeps/pthread/unwind-forcedunwind.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2005 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek . @@ -22,13 +22,13 @@ #include #include -static void (*libgcc_s_resume) (struct _Unwind_Exception *exc); -static _Unwind_Reason_Code (*libgcc_s_personality) +static void (*volatile libgcc_s_resume) (struct _Unwind_Exception *exc); +static _Unwind_Reason_Code (*volatile libgcc_s_personality) (int, _Unwind_Action, _Unwind_Exception_Class, struct _Unwind_Exception *, struct _Unwind_Context *); -static _Unwind_Reason_Code (*libgcc_s_forcedunwind) +static _Unwind_Reason_Code (*volatile libgcc_s_forcedunwind) (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *); -static _Unwind_Word (*libgcc_s_getcfa) (struct _Unwind_Context *); +static _Unwind_Word (*volatile libgcc_s_getcfa) (struct _Unwind_Context *); void pthread_cancel_init (void) @@ -67,7 +67,11 @@ void _Unwind_Resume (struct _Unwind_Exception *exc) { if (__builtin_expect (libgcc_s_resume == NULL, 0)) - pthread_cancel_init (); + { + pthread_cancel_init (); + /* The function pointer has changed, ensure we reload it. */ + asm volatile ("" : "+m" (libgcc_s_resume)); + } libgcc_s_resume (exc); } @@ -78,7 +82,11 @@ __gcc_personality_v0 (int version, _Unwind_Action actions, struct _Unwind_Context *context) { if (__builtin_expect (libgcc_s_personality == NULL, 0)) - pthread_cancel_init (); + { + pthread_cancel_init (); + /* The function pointer has changed, ensure we reload it. */ + asm volatile ("" : "+m" (libgcc_s_personality)); + } return libgcc_s_personality (version, actions, exception_class, ue_header, context); } @@ -88,7 +96,11 @@ _Unwind_ForcedUnwind (struct _Unwind_Exception *exc, _Unwind_Stop_Fn stop, void *stop_argument) { if (__builtin_expect (libgcc_s_forcedunwind == NULL, 0)) - pthread_cancel_init (); + { + pthread_cancel_init (); + /* The function pointer has changed, ensure we reload it. */ + asm volatile ("" : "+m" (libgcc_s_forcedunwind)); + } return libgcc_s_forcedunwind (exc, stop, stop_argument); } @@ -96,6 +108,10 @@ _Unwind_Word _Unwind_GetCFA (struct _Unwind_Context *context) { if (__builtin_expect (libgcc_s_getcfa == NULL, 0)) - pthread_cancel_init (); + { + pthread_cancel_init (); + /* The function pointer has changed, ensure we reload it. */ + asm volatile ("" : "+m" (libgcc_s_getcfa)); + } return libgcc_s_getcfa (context); } diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/unwind-forcedunwind.c b/nptl/sysdeps/unix/sysv/linux/ia64/unwind-forcedunwind.c index fb44b42..a788fa3 100644 --- a/nptl/sysdeps/unix/sysv/linux/ia64/unwind-forcedunwind.c +++ b/nptl/sysdeps/unix/sysv/linux/ia64/unwind-forcedunwind.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2003 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek . @@ -33,6 +33,10 @@ _Unwind_Word _Unwind_GetBSP (struct _Unwind_Context *context) { if (__builtin_expect (libgcc_s_getbsp == NULL, 0)) - pthread_cancel_init (); + { + pthread_cancel_init (); + /* The function pointer has changed, ensure we reload it. */ + asm volatile ("" : "+m" (libgcc_s_getbsp)); + } return libgcc_s_getbsp (context); } -- cgit v1.1