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/exit.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'stdlib/exit.c') diff --git a/stdlib/exit.c b/stdlib/exit.c index e5e25960b1..bc4cb0fd08 100644 --- a/stdlib/exit.c +++ b/stdlib/exit.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "exit.h" #include "set-hooks.h" @@ -45,17 +46,33 @@ exit (int status) &__exit_funcs->fns[--__exit_funcs->idx]; switch (f->flavor) { + void (*atfct) (void); + void (*onfct) (int status, void *arg); + void (*cxafct) (void *arg, int status); + case ef_free: case ef_us: break; case ef_on: - (*f->func.on.fn) (status, f->func.on.arg); + onfct = f->func.on.fn; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (onfct); +#endif + onfct (status, f->func.on.arg); break; case ef_at: - (*f->func.at) (); + atfct = f->func.at; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (atfct); +#endif + atfct (); break; case ef_cxa: - (*f->func.cxa.fn) (f->func.cxa.arg, status); + cxafct = f->func.cxa.fn; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (cxafct); +#endif + cxafct (f->func.cxa.arg, status); break; } } -- cgit v1.2.3