Fixed atexit()

See b.android.com/66595

Change-Id: I1d4c3db424c7f839e48756359cc095a6b1028ace
This commit is contained in:
Andrew Hsieh
2014-09-04 13:17:25 -07:00
parent 83fb2f6940
commit 2db7f63f99
13 changed files with 76 additions and 21 deletions

View File

@@ -26,10 +26,20 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
extern void *__dso_handle; #include <stddef.h>
extern void* __dso_handle;
extern int __cxa_atexit(void (*)(void*), void*, void*);
__attribute__ ((visibility ("hidden"))) __attribute__ ((visibility ("hidden")))
int atexit(void (*func)(void)) void __atexit_handler_wrapper(void* func) {
{ if (func != NULL) {
return (__cxa_atexit((void (*)(void *))func, (void *)0, &__dso_handle)); (*(void (*)(void))func)();
}
}
__attribute__ ((visibility ("hidden")))
int atexit(void (*func)(void)) {
return (__cxa_atexit(&__atexit_handler_wrapper, func, &__dso_handle));
} }

View File

@@ -26,11 +26,20 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
extern void *__dso_handle; #include <stddef.h>
extern int __cxa_atexit(void (*func)(void *), void *arg, void *dso);
extern void* __dso_handle;
extern int __cxa_atexit(void (*)(void*), void*, void*);
__attribute__ ((visibility ("hidden"))) __attribute__ ((visibility ("hidden")))
int atexit(void (*func)(void)) void __atexit_handler_wrapper(void* func) {
{ if (func != NULL) {
return (__cxa_atexit((void (*)(void *))func, (void *)0, &__dso_handle)); (*(void (*)(void))func)();
}
}
__attribute__ ((visibility ("hidden")))
int atexit(void (*func)(void)) {
return (__cxa_atexit(&__atexit_handler_wrapper, func, &__dso_handle));
} }

View File

@@ -26,10 +26,20 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
extern void *__dso_handle; #include <stddef.h>
extern void* __dso_handle;
extern int __cxa_atexit(void (*)(void*), void*, void*);
__attribute__ ((visibility ("hidden"))) __attribute__ ((visibility ("hidden")))
int atexit(void (*func)(void)) void __atexit_handler_wrapper(void* func) {
{ if (func != NULL) {
return (__cxa_atexit((void (*)(void *))func, (void *)0, &__dso_handle)); (*(void (*)(void))func)();
}
}
__attribute__ ((visibility ("hidden")))
int atexit(void (*func)(void)) {
return (__cxa_atexit(&__atexit_handler_wrapper, func, &__dso_handle));
} }

View File

@@ -0,0 +1 @@
../../../android-3/arch-arm/src/__dso_handle.h

View File

@@ -0,0 +1 @@
../../../android-3/arch-arm/src/__dso_handle_so.h

View File

@@ -0,0 +1 @@
../../../android-3/arch-arm/src/atexit.h

View File

@@ -0,0 +1 @@
../../../android-3/arch-arm/src/crtbegin_dynamic.c

View File

@@ -0,0 +1 @@
../../../android-3/arch-arm/src/crtbegin_so.c

View File

@@ -0,0 +1 @@
crtbegin_dynamic.c

View File

@@ -0,0 +1 @@
../../../android-3/arch-arm/src/crtend.S

View File

@@ -0,0 +1 @@
../../../android-3/arch-arm/src/crtend_so.S

View File

@@ -26,11 +26,20 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
extern void *__dso_handle; #include <stddef.h>
extern void* __dso_handle;
extern int __cxa_atexit(void (*)(void*), void*, void*); extern int __cxa_atexit(void (*)(void*), void*, void*);
__attribute__ ((visibility ("hidden"))) __attribute__ ((visibility ("hidden")))
int atexit(void (*func)(void)) { void __atexit_handler_wrapper(void* func) {
return (__cxa_atexit((void (*)(void*)) func, (void*) 0, &__dso_handle)); if (func != NULL) {
(*(void (*)(void))func)();
}
}
__attribute__ ((visibility ("hidden")))
int atexit(void (*func)(void)) {
return (__cxa_atexit(&__atexit_handler_wrapper, func, &__dso_handle));
} }

View File

@@ -26,11 +26,20 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
extern void *__dso_handle; #include <stddef.h>
extern int __cxa_atexit(void (*func)(void *), void *arg, void *dso);
extern void* __dso_handle;
extern int __cxa_atexit(void (*)(void*), void*, void*);
__attribute__ ((visibility ("hidden"))) __attribute__ ((visibility ("hidden")))
int atexit(void (*func)(void)) void __atexit_handler_wrapper(void* func) {
{ if (func != NULL) {
return (__cxa_atexit((void (*)(void *))func, (void *)0, &__dso_handle)); (*(void (*)(void))func)();
}
}
__attribute__ ((visibility ("hidden")))
int atexit(void (*func)(void)) {
return (__cxa_atexit(&__atexit_handler_wrapper, func, &__dso_handle));
} }