Allow static C++ destructors to be properly called on dlclose().
With this patch, _and_ an upcoming build/ patch, the destruction
of static C++ objects contained in shared libraries will happen
properly when dlclose() is called.
Note that this change introduces crtbegin_so.S and crtend_so.S which
are currently ignored by the build system.
+ move definition of __dso_handle to the right place
(before that, all shared libraries used the __dso_handle
global variable from the C library).
Note that we keep a 'weak' __dso_handle in aeabi.c to avoid
breaking the build until the next patch to build/core/combo/
appears. We will be able to remove that later.
+ move bionic/aeabi.c to arch-arm/bionic/ (its proper location)
Change-Id: Ie771aa204e3acbdf02fd30ebd4150373a1398f39
NOTE: The NDK will need to be modified to enable this feature in
the shared libraries that are generated through it.
diff --git a/libc/arch-sh/bionic/crtbegin_dynamic.S b/libc/arch-sh/bionic/crtbegin_dynamic.S
index dc485dd..daf6c8b 100644
--- a/libc/arch-sh/bionic/crtbegin_dynamic.S
+++ b/libc/arch-sh/bionic/crtbegin_dynamic.S
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 The Android Open Source Project
+ * Copyright (C) 2009-2010 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
.globl _start
# this is the small startup code that is first run when
-# any executable that is statically-linked with Bionic
+# any executable that is dynamically-linked with Bionic
# runs.
#
# it's purpose is to call __libc_init with appropriate
@@ -93,3 +93,5 @@
.globl __CTOR_LIST__
__CTOR_LIST__:
.long -1
+
+#include "__dso_handle.S"