summaryrefslogtreecommitdiffstats
path: root/libc/private
Commit message (Collapse)AuthorAgeFilesLines
* FORTIFY_SOURCE: fortify strchrNick Kralevich2012-12-041-0/+1
| | | | | | Detect when strchr reads off the end of a buffer. Change-Id: I0e952eedcff5c36d646a9c3bc4e1337b959224f2
* Merge branch 'jb-mr1-release' of ↵Steve Kondik2012-11-187-34/+160
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | https://android.googlesource.com/platform/bionic into mr1 Conflicts: libc/Android.mk libc/bionic/system_properties.c libc/kernel/common/linux/msm_mdp.h libc/tools/gensyscalls.py libm/Android.mk linker/linker.c Change-Id: I11944300d7fcf2fd9dc587d8c7a937bf5366bcc0
| * DO NOT MERGE Revert "Add the libcutils localtime_tz and mktime_t extensions ↵Elliott Hughes2012-09-241-6/+1
| | | | | | | | | | | | | | | | to bionic." This reverts commit 3a936a4980046a7eeb8d53a3296058d8f3a1f770. We don't want this in jb-mr1.
| * Add the libcutils localtime_tz and mktime_t extensions to bionic.Elliott Hughes2012-09-111-1/+6
| | | | | | | | | | Bug: 7012465 Change-Id: Ib66f061e29199ba134545111dc79f9b50c8f4a21
| * Rename __dso_handle_so.c to __dso_handle_so.hAndrew Hsieh2012-09-071-0/+0
| | | | | | | | | | | | | | Also chang libc/arch-arm/bionic/crtbegin_so.c to include it as a header. Change-Id: Ib91b0b8caf5c8b936425aa8a4fc1a229b2b27929
| * ARM: make CRT_LEGACY_WORKAROUND work as intendedArd Biesheuvel2012-08-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * Clean up the linker a bit, remove prelinking support.Elliott Hughes2012-08-071-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Also make the errors more readable, since none of us seemed to know what they actually meant. The new style is still as verbose as the old, but that's probably necessary in the absence of chained exceptions in C. Here's what you'd see if you try to boot after removing libsurfaceflinger.so: 32267 32267 E AndroidRuntime: java.lang.UnsatisfiedLinkError: Cannot load library: (linker.c:1629, pid 32259) soinfo_link_image: could not load library "libsystem_server.so" needed by "libandroid_servers.so"; caused by (linker.c:1629, pid 32259) soinfo_link_image: could not load library "libsurfaceflinger.so" needed by "libsystem_server.so"; caused by (linker.c:709, pid 32259) load_library: library "libsurfaceflinger.so" not found This patch also fixes almost all of the compiler warnings. Change-Id: I64bb59aed6d4e039c15ea45be2367f319ef879f8
| * [MIPS] Support for TLS registerRaghu Gandham2012-08-021-2/+13
| | | | | | | | | | Change-Id: I6b5194e5e379b573e3b1203d8015e20fb3edd647 Signed-off-by: Chris Dearman <chris@mips.com>
| * Report errors to the log, not just stderr.Elliott Hughes2012-07-271-4/+4
| | | | | | | | | | | | | | | | | | | | 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
| * Fix implementation of generic atomic operationsChris Dearman2012-07-241-6/+5
| | | | | | | | Change-Id: Ie1ea5aacc561e2d6d40125d2952ed0e9116b7b0d
| * [MIPS] Add atomic routinesRaghu Gandham2012-07-242-0/+104
| | | | | | | | Change-Id: I2cb20ce44dd230d222b7fc1ede2e1e3dce6e692b
| * am c5cab345: am 028ccf5d: Merge "Avoid multiple dns lookups for the same query"Robert Greenwalt2012-06-121-0/+6
| |\ | | | | | | | | | | | | * commit 'c5cab3452d5ced55474e56497594579108670b51': Avoid multiple dns lookups for the same query
| | * am 028ccf5d: Merge "Avoid multiple dns lookups for the same query"Robert Greenwalt2012-06-121-0/+6
| | |\ | | | | | | | | | | | | | | | | * commit '028ccf5d40dd9a945ea92aa79822c08c6f6aa1d2': Avoid multiple dns lookups for the same query
| | | * Avoid multiple dns lookups for the same queryMattias Falk2012-05-071-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If two or more rapid dns requests for the same server are done from different threads it turns into separate dns reques, if the response of the request isn't found in the cache. This patch avoid multiple request for the same server by letting subsequents request wait until the first request has finished. Change-Id: Ic72ea0e7d3964a4164eddf866feb4357ec4dfe54
| * | | Added actual event logging calls to the FORTIFY_SOURCE methods.Geremy Condra2012-06-111-0/+15
| | | | | | | | | | | | | | | | Change-Id: I3bf4fa8678c33187cb8ce4b75e666ddcd24403ab
| * | | Adding event logging to libc.Geremy Condra2012-06-081-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've basically just copied the relevant bits out of liblog and EventLog.cpp. While this will let us do the uid logging we want to address the concerns in 245c07027f78565858dd489eb0d94c3d48743e9d it doesn't give us much else. Change-Id: Icac6ff20bc0a3ade5927f6f76fedffe1ae6f8522
| * | | arm: rewrite crtbegin* as C files.Nick Kralevich2012-06-012-23/+9
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rewrite crtbegin.S -> crtbegin.c crtbegin_so.S -> crtbegin_so.c This change allows us to generate PIC code without relying on text relocations. As a consequence of this rewrite, also rewrite __dso_handle.S -> __dso_handle.c __dso_handle_so.S -> __dso_handle_so.c atexit.S -> atexit.c In crtbegin.c _start, place the __PREINIT_ARRAY__, __INIT_ARRAY__, __FINI_ARRAY__, and __CTOR_LIST__ variables onto the stack, instead of passing a pointer to the text section of the binary. This change appears sorta wonky, as I attempted to preserve, as much as possible, the structure of the original assembly. As a result, you have C files including other C files, and other programming uglyness. Result: This change reduces the number of files with text-relocations from 315 to 19 on my Android build. Before: $ scanelf -aR $OUT/system | grep TEXTREL | wc -l 315 After: $ scanelf -aR $OUT/system | grep TEXTREL | wc -l 19 Change-Id: Ib9f98107c0eeabcb606e1ddc7ed7fc4eba01c9c4
* | | armv6: REX routines are currently broken, use alternativesPaul Mongold2012-08-151-4/+9
| | | | | | | | | | | | Change-Id: I7ac05ab6add7802a4cc24fe36f7181e7cdfe07e0
* | | Avoid multiple dns lookups for the same queryMattias Falk2012-07-101-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If two or more rapid dns requests for the same server are done from different threads it turns into separate dns reques, if the response of the request isn't found in the cache. This patch avoid multiple request for the same server by letting subsequents request wait until the first request has finished. Change-Id: Ic72ea0e7d3964a4164eddf866feb4357ec4dfe54
* | | TLS: Call kernel helper in additional situationsMichael Bohan2012-07-101-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ARMv6 has HW TLS support, and thus we should be using it rather than hacking the Linux Kernel to use the software mechanism. Unfortunately, ARMv6 targets without Thumb2 do not support the necessary TLS instructions in Thumb Mode. Converting the tls libc routines to ARM Mode will require an additional branch to switch modes. Therefore, let's simply use the Kernel's Helper Routine which already operates in ARM Mode. This changed behavior only applies if the HAVE_ARM_TLS_REGISTER option is defined. Otherwise, the existing paradigm is used. Change-Id: I282697b0ab97cb62affd018494076e6ffa4d392a
* | | implement work around for tegra errata 657451Gary King2012-07-101-0/+7
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | tegra 2 processors have a bug in the register read path of bit 20 of the CP15 c13, 3 register (used for software thread local storage) the kernel work-around for this bug is to mux the value from bit 20 into bit 0; since the TLS value used by Android is an aligned address, bit 0 is known to be available. Change-Id: If70afa52585d327f9dd5eca479c14ca92532ddd8a Reviewed-on: http://git-master/r/773 Reviewed-by: Gary King <gking@nvidia.com> Tested-by: Gary King <gking@nvidia.com>
* | Initialize TLS before any application code is run.Evgeniy Stepanov2012-04-131-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since e19d702b8e33, dlsym and friends use recursive mutexes that require the current thread id, which is not available before the libc constructor. This prevents us from using dlsym() in .preinit_array. This change moves TLS initialization from libc constructor to the earliest possible point - immediately after linker itself is relocated. As a result, pthread_internal_t for the initial thread is available from the start. As a bonus, values stored in TLS in .preinit_array are not lost when libc is initialized. Change-Id: Iee5a710ee000173bff63e924adeb4a4c600c1e2d
* | Handle pthread-related changes (mutex/atfork)Jean-Baptiste Queru2012-03-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First commit: Revert "Revert "am be741d47: am 2f460fbe: am 73b5cad9: Merge "bionic: Fix wrong kernel_id in pthread descriptor after fork()""" This reverts commit 06823da2f0c8b4a4ce4c45113032f03df85c94b8. Second commit: bionic: fix atfork hanlder_mutex deadlock This cherry-picks commit 34e89c232dd5645fe3b5f9b40856d8e3e4cae57a After applying the kernel_id fix, the system refused to boot up and we got following crash log: I/DEBUG ( 113): pid: 618, tid: 618 >>> org.simalliance.openmobileapi.service:remote <<< I/DEBUG ( 113): signal 16 (SIGSTKFLT), code -6 (?), fault addr -------- I/DEBUG ( 113): eax fffffe00 ebx b77de994 ecx 00000080 edx 00724002 I/DEBUG ( 113): esi 00000000 edi 00004000 I/DEBUG ( 113): xcs 00000073 xds 0000007b xes 0000007b xfs 00000000 xss 0000007b I/DEBUG ( 113): eip b7761351 ebp bfdf3de8 esp bfdf3dc4 flags 00000202 I/DEBUG ( 113): #00 eip: 00015351 /system/lib/libc.so I/DEBUG ( 113): #01 eip: 0000d13c /system/lib/libc.so (pthread_mutex_lock) I/DEBUG ( 113): #02 eip: 00077b48 /system/lib/libc.so (__bionic_atfork_run_prepare) I/DEBUG ( 113): #03 eip: 00052cdb /system/lib/libc.so (fork) I/DEBUG ( 113): #04 eip: 0009ae91 /system/lib/libdvm.so (_Z18dvmOptimizeDexFileillPKcjjb) I/DEBUG ( 113): #05 eip: 000819d6 /system/lib/libdvm.so (_Z14dvmJarFileOpenPKcS0_PP7JarFileb) I/DEBUG ( 113): #06 eip: 000b175e /system/lib/libdvm.so (_ZL40Dalvik_dalvik_system_DexFile_openDexFilePKjP6JValue) I/DEBUG ( 113): #07 eip: 0011fb94 /system/lib/libdvm.so Root cause: The atfork uses the mutex handler_mutex to protect the atfork_head. The parent will call __bionic_atfork_run_prepare() to lock the handler_mutex, and need both the parent and child to unlock their own copy of handler_mutex after fork. At that time, the owner of hanlder_mutex is set as the parent. If we apply the kernel_id fix, then the child's kernel_id will be set as child's tid. The handler_mutex is a recursive lock, and pthread_mutex_unlock(&hander_mutex) will fail because the mutex owner is the parent, while the current tid (__get_thread()->kernel_id) is child, not matched with the mutex owner. At that time, the handler_mutex is left in lock state.If the child wants to fork other process after than, then it will try to lock handler_mutex, and then be deadlocked. Fix: Since the child has its own copy of vm space from the the parent, the child space's handler_mutex should be reset to the initialized state. Change-Id: I3907dd9a153418fb78862f2aa6d0302c375d9e27 Signed-off-by: Jack Ren <jack.ren@intel.com> Signed-off-by: Chenyang Du <chenyang.du@intel.com> Signed-off-by: Bruce Beare <bruce.j.beare@intel.com> Change-Id: Ic8072f366a877443a60fe215f3c00b3df5a259c8
* | Revert "am be741d47: am 2f460fbe: am 73b5cad9: Merge "bionic: Fix wrong ↵Guang Zhu2012-03-121-1/+0
| | | | | | | | | | | | | | | | | | kernel_id in pthread descriptor after fork()"" This reverts commit 76d56cf4a94e875a8b621025e2780775247adb6e, reversing changes made to c59ba4595be25a1213955233fcf9bcd1afe6438e. Bug: 6157577
* | am be741d47: am 2f460fbe: am 73b5cad9: Merge "bionic: Fix wrong kernel_id in ↵Elliott Hughes2012-03-121-0/+1
|\ \ | |/ | | | | | | | | | | pthread descriptor after fork()" * commit 'be741d472868a8ffcb455588f18cda889b0f465c': bionic: Fix wrong kernel_id in pthread descriptor after fork()
| * bionic: Fix wrong kernel_id in pthread descriptor after fork()Jack Ren2012-03-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After forking, the kernel_id field in the phtread_internal_t returned by pthread_self() is incorrect --- it's the tid from the parent, not the new tid of the child. The root cause is that: currently the kernel_id is set by _init_thread(), which is called in 2 cases: (1) called by __libc_init_common(). That happens when the execv( ) is called after fork( ). But when the zygote tries to fork the android application, the child application doesn't call execv( ), instread, it tries to call the Java main method directly. (2) called by pthread_create(). That happens when a new thread is created. For the lead thread which is the thread created by fork(), it should call execv() but it doesn't, as described in (1) above. So its kernel_id will inherit the parent's kernel_id. Fixed it in this patch. Change-Id: I63513e82af40ec5fe51fbb69456b1843e4bc0fc7 Signed-off-by: Chenyang Du <chenyang.du@intel.com> Signed-off-by: Jack Ren <jack.ren@intel.com> Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
* | libc: Copy private C library declarations to private/David 'Digit' Turner2012-01-132-0/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is the first in a series that aims at cleaning up the public C library headers (which end up being distributed with the NDK). <resolv.h> and <time.h> contain declarations that should not be public. They are used by other parts of the platform, but NDK applications should not use or rely on them. So copy them to private <bionic_time.h> and <resolv_iface.h> headers and use a guard macro to avoid conflicts when both headers are included at the same time. The idea is that we're going to fix the other platform modules to include these private headers. After this is done, we will remove the duplicate definitions from <resolv.h> and <time.h> Change-Id: I121c11936951c98ca7165e811126ed8a4a3a394d
* | bionic: Do not use <sys/atomics.h> for platform code.David 'Digit' Turner2011-11-164-50/+443
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We're going to modify the __atomic_xxx implementation to provide full memory barriers, to avoid problems for NDK machine code that link to these functions. First step is to remove their usage from our platform code. We now use inlined versions of the same functions for a slight performance boost. + remove obsolete atomics_x86.c (was never compiled) NOTE: This improvement was benchmarked on various devices. Comparing a pthread mutex lock + atomic increment + unlock we get: - ARMv7 emulator, running on a 2.4 GHz Xeon: before: 396 ns after: 288 ns - x86 emulator in KVM mode on same machine: before: 27 ns after: 27 ns - Google Nexus S, in ARMv7 mode (single-core): before: 82 ns after: 76 ns - Motorola Xoom, in ARMv7 mode (multi-core): before: 121 ns after: 120 ns The code has also been rebuilt in ARMv5TE mode for correctness. Change-Id: Ic1dc72b173d59b2e7af901dd70d6a72fb2f64b17
* Add non-NDK internal API __pthread_gettidGlenn Kasten2011-09-161-0/+41
| | | | | | Tracking bugs 5267571 and 5090073 (for deadlock detection logs). Change-Id: Icb90f91ec1525607551c2234ef921bf88296484f
* Revert "Revert "libc: Add logcat error message for memory corruption""Jean-Baptiste Queru2011-07-061-0/+1
| | | | This reverts commit 368ee1e4d65c555fdb0fa4b3a91d75a397936908.
* Revert "libc: Add logcat error message for memory corruption"Mathew Inwood2011-07-061-1/+0
| | | | | | This fixes the build. This reverts commit 7708a89c60e7b024d31c48c8034932c5e9f0aceb.
* libc: Add logcat error message for memory corruptionDavid 'Digit' Turner2011-07-051-0/+1
| | | | | | | | | | | | | | | | | | Our dlmalloc implementation currently calls abort() when it detects that the heap is corrupted, or that an invalid pointer is passed to one of its functions. The only way to detect this is because abort() will force-fully crash the current program with a magic fault address of '0xdeadbaad'. However, this is not really well documented, and a frequent topic on the android-ndk forum (among others). This change makes our dlmalloc code dump a simple message to the log just before the abort() call (and hence before the stack trace) to better help identify the problem. Change-Id: Iebf7eb7fe26463ecadfaca8f247d237edb441e3c
* Merge "Add support for a dns cache per interface"android-sdk-adt_r12Robert Greenwalt2011-06-231-3/+35
|\
| * Add support for a dns cache per interfaceMattias Falk2011-06-081-3/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | Initial commit for dns cache per interface. Added a type that holds a reference to a cache and name of associated interface, address of interface, name server(s) associated with an interface etc. New functions to set default interface, address of name servers etc. Change-Id: Ie991bc5592fd998409853d8bf77d7fe69035dac5
* | Enable functional DSO object destructionBruce Beare2011-06-202-0/+42
|/ | | | | | | | | | | 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>
* Update X86 Bionic CRT files for unwind/exceptionsMark D Horn2011-05-241-0/+1
| | | | | | | | | | | | | | Several updates to Bionic crt*.o files to implement Linux/x86 stack unwind/exception handling. Mark __dso_handle as hidden. Note: Requires complete rebuild due to CRT changes. Google will need to regenerate and check-in all the prebuilt x86 CRT object files and libraries which link to them. Change-Id: I191ce1afb0dee7bbc28dcd9694e5919226dbd070 Signed-off-by: Bruce J Beare <bruce.j.beare@intel.com> Signed-off-by: Mark D Horn <mark.d.horn@intel.com> Author: Lu, Hongjiu <hongjiu.lu@intel.com>
* Fix __get_tls() in static C library to use kernel helpers.David 'Digit' Turner2010-08-271-9/+35
| | | | | | | This is needed to fix gdbserver's handling of threaded programs, among other things. Change-Id: I823387c602cef9891532da946a01db14be780ab0
* Remove compiler warnings when building Bionic.David 'Digit' Turner2010-06-221-0/+41
| | | | | | | | 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
* Allow static C++ destructors to be properly called on dlclose().David 'Digit' Turner2010-06-181-0/+37
| | | | | | | | | | | | | | | | | | | | | | | 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.
* libc: remove cutils dependenciesDavid 'Digit' Turner2010-06-111-0/+107
| | | | | | | | We simply copy the stuff we need from cutils headers. A future patch will change cutils to include the private <bionic_atomic_inline.h> Change-Id: Ib6fd9a03bc9e337ce867bd606dc94c2b4438480a
* Use private futexes for semaphores, unless they are initialized with pshared ↵David 'Digit' Turner2010-06-081-0/+57
| | | | | | | != 0. Change-Id: I534e36a7171cd37037ae03b910ba71ea6968286d Note: previously, sem_init() would return an error if pshared != 0.
* Fix spurious DNS lookups in the C library.David 'Digit' Turner2010-03-081-0/+8
| | | | | | | | | | | | | | | | | | | | | | | The problem was that the 'defdname' field of res_state structure was not properly initialized in __res_vinit(). This field is used to store the default domain name, which is normally build from calling gethostname() (see line 549 of res_init.c). Unfortunately, in the typical Android case, gethostname() returns an error (the hostname is configured) and a random stack string is used later to build the DNS search list (see lines 556+ in res_init.c) For the sake of illustration, let's say the search list is set to a random value like 'xWLK'. The end result is that when trying to result an unknown domain name (e.g. 'www.ptn'), the query fails then the resolver tries to make a new query with the DNS search list path(s) appended (e.g. 'www.ptn.xWLK'). The patch simply initializes 'defdname' to an empty string to avoid this when the net.dns.search system property is not set. Also contains whitespace/formatting fixes
* resolved conflicts for merge of 4a05d12c to eclair-plus-aospDavid 'Digit' Turner2009-09-221-3/+13
|\
| * Fix TLS access for ARMv6 and beyond.David 'Digit' Turner2009-09-221-1/+12
| | | | | | | | | | | | | | | | | | | | For performance reasons, we don't call the kernel helper. Instead, we directly access the TLS register on ARMv6 and higher. For ARMv5TE, keep using the hard-coded address populated by the kernel on each task switch. NOTE: Since we don't call the kernel helper, this must precisely match your kernel configuration. This is controlled by setting the ARCH_ARM_HAVE_TLS_REGISTER variable to 'true' in your board configuration file.
* | Linux kernel helpers support is provided to android for its TLS ↵vinay harugop2009-09-161-1/+3
|/ | | | | | | | implementation. This fix addresses this by modifying the TLS access functions to use the kernel helper. This Fix is verified on ST Ericsson's U8500 platform and Submitted on behalf of a third-party: Surinder-pal SINGH from STMicroelectronics.
* Pass the elfdata pointer in a slot of the temporary TLS area.David 'Digit' Turner2009-07-171-0/+7
| | | | | | | | | | | | | | | | This is needed to properly initialize the C runtime when libc.so is loaded by the dynamic linker. Move the temporary TLS setup before the first system call, just in case something really horrible happens, we won't crash when trying to write an error code in 'errno' Remove the broken TLS_SLOT_THREAD_ID setup. First, this slot should normally receive the address of a pthread_internal_t, not a kernel thread identifier. Second, it is never used by the linker anyway. Also remove an obsolete comment.
* Prevent a crash in the memory leak checker (which happened in chk_free())David 'Digit' Turner2009-07-101-0/+3
| | | | | | Simplify the code a little, removing un-necessary mutex locks/unlocks. Provide slightly better diagnostic message in case of corruption. Use snprintf/strlcat instead of sprintf/strcat
* Revert "Fix the C library initialization to avoid calling static C++ ↵David 'Digit' Turner2009-06-032-191/+0
| | | | | | constructors twice." This reverts commit 03eabfe65e1e2c36f4d26c78a730fa19a3bdada3.
* Fix the C library initialization to avoid calling static C++ constructors twice.David 'Digit' Turner2009-06-022-0/+191
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-0318-0/+2737
|