summaryrefslogtreecommitdiffstats
path: root/libc/stdlib/atexit.c
Commit message (Collapse)AuthorAgeFilesLines
* Unregister pthread_atfork handlers on dlclose()Dmitriy Ivanov2015-04-241-0/+212
| | | | | Bug: http://b/20339788 Change-Id: I874c87faa377645fa9e0752f4fc166d81fd9ef7e
* Revert "Unregister pthread_atfork handlers on dlclose()"Dimitry Ivanov2015-04-241-212/+0
| | | | | | | | | The visibility control in pthread_atfork.h is incorrect. It breaks 64bit libc.so by hiding pthread_atfork. This reverts commit 6df122f8528f9b9fcf7dfea14ae98b0ef66274e1. Change-Id: I21e4b344d500c6f6de0ccb7420b916c4e233dd34
* Unregister pthread_atfork handlers on dlclose()Dmitriy Ivanov2015-04-221-0/+212
| | | | Change-Id: I326fdf6bb06bed12743f08980b5c69d849c015b8
* Upstream atexitDmitriy Ivanov2014-07-141-250/+0
| | | | Change-Id: Ia454a2181b5058ed9783dc02b6b1805d0e4d2715
* Slim down static binaries by avoiding stdio.Elliott Hughes2014-07-101-3/+2
| | | | | | | | | | | | | | It's okay for a program to choose to drag in stdio, but it's unfortunate if even the minimal "int main() { return 42; }" drags in stdio... This brings the minimal static binary on ARM down from 78KiB to 46KiB. Given that we don't have a separate -lpthread it's not obvious to me that we can shave this down any further. I'm not sure whether this is a worthwhile change for that reason. (And the fact that dynamic binaries, the usual case, are unaffected either way.) Change-Id: I02f91dcff37d14354314a30b72fed2563f431c88
* Hide __atexit and remove __atexit_invalid.Dan Albert2014-06-181-5/+0
| | | | | Bug: 11156955 Change-Id: I8c72edee8ecb92b75a282384277253bae19f7455
* Register _cleanup function with atexitDmitriy Ivanov2014-05-151-2/+40
| | | | | | | | | | | | | | | | * Register cleanup function with atexit instead of calling it explicitly on exit() * abort() no longer calls _cleanup: Flushing stdio buffers on abort is no longer required by POSIX. * dlmalloc no longer need to reset cleanup (see above) * Upstream findfp.c makebuf.c setvbuf.cexit.c to openbsd versions. Bug: 14415367 Change-Id: I277058852485a9d3dbb13e5c232db5f9948d78ac
* Fixes for __cxa_finalizeDmitriy Ivanov2014-05-051-27/+70
| | | | | | | | | * Ability to register atexit handler from atexit handler * Correct way to handle both forms of atexit handler Bug: https://code.google.com/p/android/issues/detail?id=66595 Bug: 4998315 Change-Id: I39529afaef97b6e1469c21389d54c0d7d175da28
* Fix x86_64 build, clean up intermediate libraries.Elliott Hughes2013-10-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | The x86_64 build was failing because clone.S had a call to __thread_entry which was being added to a different intermediate .a on the way to making libc.so, and the linker couldn't guarantee statically that such a relocation would be possible. ld: error: out/target/product/generic_x86_64/obj/STATIC_LIBRARIES/libc_common_intermediates/libc_common.a(clone.o): requires dynamic R_X86_64_PC32 reloc against '__thread_entry' which may overflow at runtime; recompile with -fPIC This patch addresses that by ensuring that the caller and callee end up in the same intermediate .a. While I'm here, I've tried to clean up some of the mess that led to this situation too. In particular, this removes libc/private/ from the default include path (except for the DNS code), and splits out the DNS code into its own library (since it's a weird special case of upstream NetBSD code that's diverged so heavily it's unlikely ever to get back in sync). There's more cleanup of the DNS situation possible, but this is definitely a step in the right direction, and it's more than enough to get x86_64 building cleanly. Change-Id: I00425a7245b7a2573df16cc38798187d0729e7c4
* Clean up abort.Elliott Hughes2013-06-121-40/+2
| | | | | | | | | | | | | | | | | | * A dlmalloc usage error shouldn't call abort(3) because we want to cause a SIGSEGV by writing the address dlmalloc didn't like to an address the kernel won't like, so that debuggerd will dump the memory around the address that upset dlmalloc. * Switch to the simpler FreeBSD/NetBSD style of registering stdio cleanup. Hopefully this will let us simplify more of the stdio implementation. * Clear the stdio cleanup handler before we abort because of a dlmalloc corruption error. This fixes the reported bug, where we'd hang inside dlmalloc because the stdio cleanup reentered dlmalloc. Bug: 9301265 Change-Id: Ief31b389455d6876e5a68f0f5429567d37277dbc
* ARM: make CRT_LEGACY_WORKAROUND work as intendedArd Biesheuvel2012-08-281-11/+0
| | | | | | | | | | | | | To properly support legacy ARM shared libraries, libc.so needs to export the symbols __dso_handle and atexit, even though these are now supplied by the crt startup code. This patch reshuffles the existing CRT_LEGACY_WORKAROUND conditionally compiled code slightly so it works as the original author likely intended. Change-Id: Id6c0e94dc65b7928324a5f0bad7eba6eb2f464b9 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@gmail.com>
* fix __cxa_finalize() implementation to be thread safe.Srinavasa Nagaraju2012-07-311-0/+4
| | | | | | | | __cxa_finalize() modifies the access permissions of __atexit global variable without acquiring _ATEXIT_LOCK(). Fix it prevent any possible races. Change-Id: I11939d0ebcbf6f360c14163222d40a449d96948e
* Enable functional DSO object destructionBruce Beare2011-06-201-0/+2
| | | | | | | | | | | Unfortunately, legacy .so files for ARM don't have a correct crtbegin file. Consequently, we have to grandfather the old __dso_handle behaviour. Add some ifdefs for ARM to allow it to use the old code until we can work out a transition. Change-Id: I6a28f368267d792c94e1d985d8344023bc632f6f Author: H.J. Lu <hongjiu.lu@intel.com> Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
* Fix __eabi_atexit() implementation, as well as a bug in the BSD-originated ↵David 'Digit' Turner2009-05-201-0/+9
| | | | | | __cxa_finalize() implementation This patch uses "#if ANDROID" instead of "#if 1" in the __cxa_finalize() fix
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-0/+209
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-209/+0
|
* auto import from //branches/cupcake/...@127101The Android Open Source Project2009-01-201-11/+87
|
* Initial Contributionandroid-1.0The Android Open Source Project2008-10-211-0/+133