about summary refs log tree commit diff
path: root/stdlib/cxa_finalize.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-12-18 17:32:37 +0000
committerUlrich Drepper <drepper@redhat.com>2005-12-18 17:32:37 +0000
commita3c88553729c1c4dcd4f893a96b4668bce640ee5 (patch)
treed6660a25aa0a3a8b86fccfe2efbd2155e0893e97 /stdlib/cxa_finalize.c
parent3467f5c369a10ef19c8df38fb282c7763f36d66f (diff)
downloadglibc-a3c88553729c1c4dcd4f893a96b4668bce640ee5.tar.gz
glibc-a3c88553729c1c4dcd4f893a96b4668bce640ee5.tar.xz
glibc-a3c88553729c1c4dcd4f893a96b4668bce640ee5.zip
* stdlib/cxa_atexit.c: Use PTR_MANGLE on function pointer. Fill in
	flavor field last and protect with memory barrier.
	* stdlib/on_exit.c: Likewise.
	* stdlib/cxa_finalize.c: Use PTR_DEMANGLE on function pointer before
	using it.
	* stdlib/exit.c: Likewise.
Diffstat (limited to 'stdlib/cxa_finalize.c')
-rw-r--r--stdlib/cxa_finalize.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/stdlib/cxa_finalize.c b/stdlib/cxa_finalize.c
index 2339c7b5bd..43fcbc484f 100644
--- a/stdlib/cxa_finalize.c
+++ b/stdlib/cxa_finalize.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2001, 2002, 2003, 2005 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
@@ -21,6 +21,7 @@
 #include <atomic.h>
 #include "exit.h"
 #include <fork.h>
+#include <sysdep.h>
 
 /* If D is non-NULL, call all functions registered with `__cxa_atexit'
    with the same dso handle.  Otherwise, if D is NULL, call all of the
@@ -39,7 +40,13 @@ __cxa_finalize (void *d)
 	    /* We don't want to run this cleanup more than once.  */
 	    && ! atomic_compare_and_exchange_bool_acq (&f->flavor, ef_free,
 						       ef_cxa))
-	  (*f->func.cxa.fn) (f->func.cxa.arg, 0);
+	  {
+	    void (*cxafn) (void *arg, int status) = f->func.cxa.fn;
+#ifdef PTR_DEMANGLE
+	    PTR_DEMANGLE (cxafn);
+#endif
+	    cxafn (f->func.cxa.arg, 0);
+	  }
     }
 
   /* Remove the registered fork handlers.  We do not have to