History log of /bionic/libc/bionic/libc_init_common.c
Revision Date Author Comments
1df986c21ee52c6756846b4a5e45cb316f772112 21-Oct-2010 David 'Digit' Turner <digit@google.com> libc: fix executable destruction support.

This change allows an executable to call its destructor functions
(declared with __attribute__((destructor))) to be properly called
when it normally exits.

Note that this is different from calling the destructors of a shared
library when it is unloaded with dlclose() or through program exit,
which are already supported.

Bug: 3106500
Change-Id: I1412ef5407f13b613fc6cb6103e0a691dbee4b1a
39f3745cf30efe38482ffead1c32f4e62f6fe32e 22-Jul-2009 Andy McFadden <fadden@android.com> Restore malloc debug.

Some libc changes were preventing the initialization call from being made.
The basic problem appears to be that libc_init_common.c is only built once,
and it's only built for the non-debug libc.
b56b5659b3996e98c2060f168d1cff1474e77d2a 18-Jul-2009 David 'Digit' Turner <digit@google.com> Fix the C library runtime initialization order.

This allows libc.so to run the C runtime initializer as soon as the
dynamic linker loads the shared library, i.e. before any other initializers
(e.g. static C++ constructors in other shared libraries the executable depends
on).

This also removes the bug where the initializers from the executable itself
were run twice: once by the dynamic linker, and another time by __libc_init
as defined by libc_init_dynamic.c
3a654b1e04d4275ae315cfe1b196998acf10052c 03-Jun-2009 David 'Digit' Turner <digit@google.com> Revert "Fix the C library initialization to avoid calling static C++ constructors twice."

This reverts commit 03eabfe65e1e2c36f4d26c78a730fa19a3bdada3.
03eabfe65e1e2c36f4d26c78a730fa19a3bdada3 28-May-2009 David 'Digit' Turner <digit@google.com> Fix the C library initialization to avoid calling static C++ constructors twice.

The problem was due to the fact that, in the case of dynamic executables,
the dynamic linker calls the DT_PREINIT_ARRAY, DT_INIT and DT_INIT_ARRAY
constructors when loading shared libraries and dynamic executables,
*before* calling the executable's entry point (i.e. arch-$ARCH/bionic/crtbegin_dynamic.c)
which in turns call __libc_init() in libc.so, as defined by bionic/libc_init_dynamic.c

The latter did call these constructors array again, mistakenly.

The patch also updates the documentation of many related functions.

Also adds a new section to linker/README.TXT explaining restrictions on
C library usage.

The patch has been tested on a Dream for stability issues with
proprietary blobs:

- H264 decoding works
- Camera + Video recording works
- GPS works
- Sensors work

The tests in system/extra/tests/bionic/libc/common/test_static_cpp_mutex.cpp has been
run and shows the static C++ constructor being called only once.
1dc9e472e19acfe6dc7f41e429236e7eef7ceda1 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
1767f908af327fa388b1c66883760ad851267013 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
e5cc1f386b167b9f7bfdebc7219e89aa9b71e4b2 16-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@126645
a27d2baa0c1a2ec70f47ea9199b1dd6762c8a349 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution