From a3c88553729c1c4dcd4f893a96b4668bce640ee5 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 18 Dec 2005 17:32:37 +0000 Subject: * 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. --- stdlib/cxa_atexit.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'stdlib/cxa_atexit.c') diff --git a/stdlib/cxa_atexit.c b/stdlib/cxa_atexit.c index 490776105f..9b7a932b85 100644 --- a/stdlib/cxa_atexit.c +++ b/stdlib/cxa_atexit.c @@ -21,6 +21,8 @@ #include #include "exit.h" +#include +#include #undef __cxa_atexit @@ -35,10 +37,14 @@ __cxa_atexit (void (*func) (void *), void *arg, void *d) if (new == NULL) return -1; - new->flavor = ef_cxa; +#ifdef PTR_MANGLE + PTR_MANGLE (func); +#endif new->func.cxa.fn = (void (*) (void *, int)) func; new->func.cxa.arg = arg; new->func.cxa.dso_handle = d; + atomic_write_barrier (); + new->flavor = ef_cxa; return 0; } INTDEF(__cxa_atexit) -- cgit 1.4.1