The visibility control in pthread_atfork.h is incorrect.
It breaks 64bit libc.so by hiding pthread_atfork.
This reverts commit 6df122f852.
Change-Id: I21e4b344d500c6f6de0ccb7420b916c4e233dd34
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
* 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
* 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
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
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
The OpenBSD doesn't support C99, and the extent to which we support
locales is trivial, so just do it ourselves.
Change-Id: If0a06e627ecc593f7b8ea3e9389365782e49b00e
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>
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
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
As of 61e699a133, 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
This patch adds support for AArch64 to strtod.c definitions.
Change-Id: I9491c4371d921c00e73ae169877a9a71225731fb
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
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
* 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
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
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
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>
__cxa_finalize() modifies the access permissions of __atexit
global variable without acquiring _ATEXIT_LOCK(). Fix it prevent
any possible races.
Change-Id: I11939d0ebcbf6f360c14163222d40a449d96948e
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
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>
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
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
... by checking most probable condition first (elements do differ)
Change-Id: I424eab9c32a6d9eb82b686ca04025ec8c9097035
Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
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
Merge commit 'f197147a787d7415e6e0a1bad15566836c55befb'
* commit 'f197147a787d7415e6e0a1bad15566836c55befb':
Revert "Add qsort_r() implementation to the C library."