Rewrite __shlib_exit() to use the function stack