summaryrefslogtreecommitdiffstats
path: root/libc/stdlib
Commit message (Collapse)AuthorAgeFilesLines
* Hide __atexitDmitriy Ivanov2015-06-042-14/+12
| | | | | | Bug: http://b/21640806 Change-Id: I778b35c8c7538859179e97fcf5a82db2fcd9e50f (cherry picked from commit 9cf6fc304bbbfb26911e0b624b80d862c40b0308)
* Unregister pthread_atfork handlers on dlclose()Dmitriy Ivanov2015-04-242-0/+259
| | | | | Bug: http://b/20339788 Change-Id: I874c87faa377645fa9e0752f4fc166d81fd9ef7e
* Revert "Unregister pthread_atfork handlers on dlclose()"Dimitry Ivanov2015-04-242-259/+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-222-0/+259
| | | | Change-Id: I326fdf6bb06bed12743f08980b5c69d849c015b8
* Call __cxa_thread_finalize for the main thread.Dmitriy Ivanov2015-04-151-0/+66
| | | | | | Bug: http://b/20231984 Bug: http://b/16696563 Change-Id: I71cfddd0d404d1d4a593ec8d3bca9741de8cb90f
* Upstream atexitDmitriy Ivanov2014-07-142-303/+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-182-7/+1
| | | | | 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-052-31/+71
| | | | | | | | | * 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
* Switch to the upstream OpenBSD getenv/putenv/setenv implementation.Elliott Hughes2014-04-223-235/+0
| | | | | | This fixes all the bugs found by the new tests. Change-Id: Id5a5f9f39a0620208bafa053f871a044725b4795
* Upgrade our <ctype.h> implementation to OpenBSD head.Elliott Hughes2014-04-182-166/+0
| | | | | | | | Adding the perfunctory <ctype.h> tests showed that we'd accidentally dropped several symbols. This puts everything back in its proper place and switches us to upstream head at the same time. Change-Id: Ib527ad280c9baded81e667fa598698526d93e66f
* Merge "Changes our ctype identifiers to match the BSDs"Dan Albert2014-04-181-19/+10
|\
| * Changes our ctype identifiers to match the BSDsDan Albert2014-04-181-19/+10
| | | | | | | | | | | | | | This is to make it possible to adopt the BSDs' implementations for a few locale APIs in libc++ rather than writing our own, nearly identical, code. Change-Id: I482acd4ece83aa4ec9eb0c7acf48f3686794bcc3
* | Switch to gdtoa.Elliott Hughes2014-04-161-2689/+0
|/ | | | | | | | This gives us a real strtold for LP64 and fixes various LP64 bugs. Bug: 13563801 Change-Id: I277858d718ee746e136b6b6308a495ba50dfa488
* Clean up localeconv(3).Elliott Hughes2014-04-081-4/+0
| | | | | | | The OpenBSD doesn't support C99, and the extent to which we support locales is trivial, so just do it ourselves. Change-Id: If0a06e627ecc593f7b8ea3e9389365782e49b00e
* Add lconv declaration and localeconv(3)Pavel Chupin2014-03-281-2/+3
| | | | | | | | | | | | lconv is taken from ndk/sources/android/support/include/locale.h and matches bsd/glibc upstream. Keep old declaration for 32-bits for compatibility. localeconv.c and deps are taken from openbsd upstream. Changed strtod.c accordingly. Change-Id: I9fcc4d15f5674d192950d80edf26f36006cd31b4 Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
* Clean up reentrancy cruft.Elliott Hughes2014-03-131-20/+4
| | | | | | | | | | | | | | | | The DNS copy of reentrant.h was unused, so remove it. The strtod implementation can use the upstream-netbsd reentrant.h and get a little closer to what was then upstream. (It's since been replaced by gdtoa, and we'll have to follow at some point, but for now this doesn't make anything any worse.) ANDROID_CHANGES is (now) only used in the DNS code, so push the -D down. The <locale.h> change prevents an LP32 hack from leaking into LP64. Change-Id: Idf30b98a59d7ca8f7c6cd6d07020b512057911ef
* Clean up our OpenBSD usage.Elliott Hughes2014-02-218-742/+0
| | | | | | | | | Also undo some of the mess where we have OpenBSD <stdio.h> but a mix of different BSD's implementations. In this first pass, I've only moved easy OpenBSD stuff. Change-Id: Iae67b02cde6dba9d8d06fedeb53efbfdac0a8cf6
* bionic: call stdio cleanup on exitPawit Pornkitprasan2013-11-191-59/+0
| | | | | | | | | | | | | | | As of 61e699a133a4807fe878a6cb0d7190d7c96e21f8, stdio clean up functions are no longer registered in atexit and must be called manually via __cleanup. The issue this fixes is some static binaries linked against bionic cannot output properly when piped or redirected because the buffer is not flushed before closing. This is done by pulling in exit.c (and other dependencies) from netbsd. Change-Id: I193e54a6d08900f291550029fe75ce76394d9e22
* AArch64: Add support for AArch64 to stdlib/strtod.cSerban Constantinescu2013-10-281-1/+1
| | | | | | | This patch adds support for AArch64 to strtod.c definitions. Change-Id: I9491c4371d921c00e73ae169877a9a71225731fb Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
* Fix x86_64 build, clean up intermediate libraries.Elliott Hughes2013-10-093-2/+9
| | | | | | | | | | | | | | | | | | | | | | 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
* Make ctype.h a little less unhygienic.Elliott Hughes2013-08-131-1/+11
| | | | | | This caused trouble for stlport. Change-Id: Id40787c5a2b7a3a4e12fb557efe549778a01cbbd
* 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
* Switch to current FreeBSD qsort.Elliott Hughes2013-04-111-161/+0
| | | | Change-Id: Ic46cd0b663dc5fa78c99dd38db0bfe849a25e789
* stdlib: atexit: include <sys/cdefs.h>Chirayu Desai2013-02-161-0/+2
| | | | Change-Id: Ib9eb167710a021e0a2b5c77a06a9338cdc748e6d
* Clean up the argc/argv/envp/auxv handling.Elliott Hughes2013-02-071-0/+4
| | | | | | | | There's now only one place where we deal with this stuff, it only needs to be parsed once by the dynamic linker (rather than by each recipient), and it's now easier for us to get hold of auxv data early on. Change-Id: I6314224257c736547aac2e2a650e66f2ea53bef5
* More upstream NetBSD upgrades.Elliott Hughes2012-10-236-338/+0
| | | | Change-Id: Idb781d37de3b05585271d7d258ecffd5ba87d0b8
* Move non-upstream code into the libc/bionic directory.Elliott Hughes2012-10-017-592/+0
| | | | | | | I'll need at least one more pass, because there's some upstream code lurking in libc/bionic, but this is still a step in the right direction. Change-Id: I55927315972da8327ae01c5240ed587db17e8462
* Upgrade seed48 too.Elliott Hughes2012-10-011-37/+0
| | | | | | Missed this in 774c7f54ff375d71106283d42779b0cc5f238f87. Change-Id: Ic24fd67f003d0e2d192cfb08f96f63024ca817eb
* Upgrade to the current NetBSD rand implementation.Elliott Hughes2012-10-016-170/+0
| | | | | | Also add basic unit tests. Change-Id: I7fc7ef61d47c1e8fdf8b8eff67a635220c3afd56
* 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
* Report errors to the log, not just stderr.Elliott Hughes2012-07-271-16/+16
| | | | | | | | | | In particular this affects assert(3) and __cxa_pure_virtual, both of which have managed to confuse people this week by apparently aborting without reason. (Because stderr goes nowhere, normally.) Bug: 6852995 Bug: 6840813 Change-Id: I7f5d17d5ddda439e217b7932096702dc013b9142
* am 1c0a0381: Merge "Enable functional DSO object destruction"David Turner2011-06-231-0/+2
|\ | | | | | | | | * commit '1c0a0381dfb3648ffadef9537ec9383d63d62473': Enable functional DSO object destruction
| * 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>
* | Bug 3330205 Thread safety for bignum powers of 5Glenn Kasten2011-01-171-0/+5
|/ | | | Change-Id: I739a06f9037a9fb643276f61601f0f3e192581b8
* libc: remove obsolete sha1hash.c source fileDavid 'Digit' Turner2010-12-201-316/+0
| | | | | | | The source file is not part of the C library build, so the Android.mk is unaffected. In other words, this source file was never compiled. Change-Id: Idec3d5b6ec30dc9ee38296d12dc6e522997df29a
* am 958214aa: am 8ad63d74: Merge "stdlib: strtod: Hide internal symbol __dtoa"Jean-Baptiste Queru2010-10-211-1/+1
|\ | | | | | | | | | | | | Merge commit '958214aa998d9378e7d70c7c08ffab4c5f9d3fde' * commit '958214aa998d9378e7d70c7c08ffab4c5f9d3fde': stdlib: strtod: Hide internal symbol __dtoa
| * am 8ad63d74: Merge "stdlib: strtod: Hide internal symbol __dtoa"Jean-Baptiste Queru2010-10-191-1/+1
| |\ | | | | | | | | | | | | | | | | | | Merge commit '8ad63d745d4ec1edea0bbd04fd0644983ad77bf5' into gingerbread-plus-aosp * commit '8ad63d745d4ec1edea0bbd04fd0644983ad77bf5': stdlib: strtod: Hide internal symbol __dtoa
| | * stdlib: strtod: Hide internal symbol __dtoaJim Huang2010-10-151-1/+1
| | | | | | | | | | | | Change-Id: Iaaec7ea4d04c859fe98ad3331fd71e7d000c826b
* | | am cb0f5ed8: am 50ace4fe: Remove compiler warnings when building Bionic.David 'Digit' Turner2010-06-231-1/+1
|\ \ \ | |/ / | | | | | | | | | | | | | | | Merge commit 'cb0f5ed8111d4305cf6798aefdb4f9623570c83a' * commit 'cb0f5ed8111d4305cf6798aefdb4f9623570c83a': Remove compiler warnings when building Bionic.
| * | Remove compiler warnings when building Bionic.David 'Digit' Turner2010-06-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Also add missing declarations to misc. functions. Fix clearerr() implementation (previous was broken). Handle feature test macros like _POSIX_C_SOURCE properly. Change-Id: Icdc973a6b9d550a166fc2545f727ea837fe800c4
* | | Just link fixes for b 2763938.Kristian Monsen2010-06-161-6/+0
|/ / | | | | | | | | | | Added wcsxfrm.c and wmemcmp.c to the src files in Android.mk and removed wcsxfrm from wchar.c Change-Id: Iab9b45cf78c27880d2941c360340a7af6b8964fe
* | wchar.h: improve wchar_t support in BionicDavid 'Digit' Turner2010-06-151-124/+12
|/ | | | Change-Id: Iffd41046fd0933c66542abf7627a1569522dfcb2
* merge from open-source masterThe Android Open Source Project2010-05-0311-223/+221
|\ | | | | | | Change-Id: If02d33af51017dbd85e91c79ac2e848eda6cf253
| * improve readability of stdlib: fix indentation and remove trailing spacesAndré Goddard Rosa2010-04-2911-232/+230
| | | | | | | | | | | | Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com> Change-Id: I7dd90a0816b5376ffc1de4499d56935e0bd574a1
* | merge from open-source masterThe Android Open Source Project2010-03-311-2/+2
|\ \ | |/ | | | | Change-Id: I950e9aca87cbb0c35099b1d53cff6378bd0f26f4
| * stdlib: optimize bsearch()André Goddard Rosa2010-03-281-2/+2
| | | | | | | | | | | | | | ... by checking most probable condition first (elements do differ) Change-Id: I424eab9c32a6d9eb82b686ca04025ec8c9097035 Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
* | Fix strtod security bug.David 'Digit' Turner2010-03-091-28/+142
| | | | | | | | | | | | | | | | | | To avoid introducing NULL checks everytime a Bigint computation is performed, introduce a special value (BIGINT_INVALID) and only check for it when absolutely needed (which means when the code needs to access the Bigint's internal structure fields). Change-Id: Ie3954523b0985b6a8cb62340802d8dcf63cbf16f