Commit graph

138 commits

Author SHA1 Message Date
Ben Cheng
12cbf0605e Merge "Implement the "abort" stub in assembly for ARM." 2012-05-08 14:01:22 -07:00
Ben Cheng
017f438534 Implement the "abort" stub in assembly for ARM.
So that we can always get the full stack trace regardless of gcc's handling
of the "noreturn" attribute associated with abort().

BUG:6455193
Change-Id: Id264a5167e7cabbf11515fbc48f5469c527e34d4
2012-05-08 13:43:12 -07:00
Elliott Hughes
e34c7ffc57 am e636e1f2: am 8657eafc: Merge "Adjust memcpy for ARM Cortex A9 cache line size"
* commit 'e636e1f2c17d7097b6638cb4ae2b4857765b502d':
  Adjust memcpy for ARM Cortex A9 cache line size
2012-05-08 11:32:55 -07:00
Nick Kralevich
a2758f19ce libc: stop using the custom linker script
stop using the custom linker script. It prevents relro from
working on libc.

This reverts commit b091dd9bf2.
2012-05-07 14:33:32 -07:00
Elliott Hughes
e636e1f2c1 am 8657eafc: Merge "Adjust memcpy for ARM Cortex A9 cache line size"
* commit '8657eafc3552f36c176667c1591beab255308da6':
  Adjust memcpy for ARM Cortex A9 cache line size
2012-05-07 13:59:58 -07:00
Henrik Smiding
fe6338da91 Adjust memcpy for ARM Cortex A9 cache line size
ARM Cortex A8 use 64 bytes and ARM Cortex A9 use 32 bytes cache line
size.

The following patch:
  Adds code to adjust memcpy cache line size to match A9 cache line
  size.
  Adds a flag to select between 32 bytes and 64 bytes cache line
  size.

  Copyright (C) ST-Ericsson SA 2010
    Modified neon implementation to fit Cortex A9 cache line size
    Author: Henrik Smiding henrik.smiding@stericsson.com for
            ST-Ericsson.

Change-Id: I8a55946bfb074e6ec0a14805ed65f73fcd0984a3
Signed-off-by: Christian Bejram <christian.bejram@stericsson.com>
2012-05-07 14:18:02 +02:00
Nick Kralevich
b091dd9bf2 libc: continue to use Android's custom linker script
By default, Android no longer compiles code using it's custom
linker script /build/core/armelf.xsc. However, this causes
problems for libc. Certain programs linked using older versions
of GOLD expect libc.so to export __exidx_start and __exidx_end.
Removing the custom linker script causes libc.so not to export
those symbols.

For now, continue using the old linker script, until we can
figure out a better solution.

Change-Id: Iaf002afd63a58b848818da24e5a4525620dc4d74
2012-04-26 11:04:44 -07:00
Kenny Root
03273f8fc0 __on_dlclose should be aligned
Marking segments read-only was pushing the alignment of __on_dlclose by
2 bytes making it unaligned. This change makes sure the ARM code is
aligned to the 4 byte boundary.

Bug: 6313309
Change-Id: Ic2bf475e120dd61225ec19e5d8a9a8b1d0b7f081
2012-04-10 17:53:11 -07:00
Ben Cheng
21eab513e7 New additions/bug fixes required/found when porting perf.
New functions:
	tfind
	tsearch
	tdelete
	twalk
	tdestroy (GNU extension)

Bug fix: the current implementation for realpath would crash
	if the second argument (resolved_path) is NULL.

New headers:
	ar.h
	search.h

Change-Id: Ib6c1e42fc186a6d597a6e5a9692b16acaa155804
2012-03-20 12:54:55 -07:00
Jean-Baptiste Queru
25b7a16a6e Merge c4cb87f3
Change-Id: I4cc14eba43fde75a7702fdc7ad07d3d949e9c092
2012-02-01 09:46:08 -08:00
David 'Digit' Turner
70b1668a76 remove obsolete SuperH support
We don't have a toolchain anymore, we don't have working original
kernel headers, and nobody is maintaining this so there is really
no point in keeping this here. Details of the patch:

- removed code paths from Android.mk files related to the SuperH
  architecture ("sh")

- removed libc/arch-sh, linker/arch-sh, libc/kernel/arch-sh

- simplified libc/SYSCALLS.TXT

- simplified the scripts in libc/tools/ and libc/kernel/tools

Change-Id: I26b0e1422bdc347489e4573e2fbec0e402f75560

Signed-off-by: David 'Digit' Turner <digit@android.com>
2012-01-31 20:28:23 +01:00
Mathias Agopian
68d03fdbd8 Merge "implement pthread mutex deadlock detection" 2012-01-05 14:05:30 -08:00
David 'Digit' Turner
a5cb76bca0 libc: x86: Use SSE2 or SSSE3 optimized routines when possible.
This patch uses the new hardware feature macros for x86 to define
various compile-time macros used to make the C library use
SSE2 and/or SSSE3 optimized memory functions for target CPUs
that support these features.

Note that previously, we relied on the macros being defined by
build/core/combo/TARGET_linux-x86.mk, but this is no longer the
case.

Change-Id: Ieae5ff5284c0c839bc920953fb6b91d2f2633afc
2011-12-14 18:23:40 +01:00
Bruce Beare
e2bb45a7c0 am f3087c6e: am af96d4da: x86: libc may use the gcc flags from TARGET_linux-x86.mk
* commit 'f3087c6e86f54874538669d899d8a2ede59f7433':
  x86: libc may use the gcc flags from TARGET_linux-x86.mk
2011-12-12 15:39:04 -08:00
Mathias Agopian
7c0c379372 implement pthread mutex deadlock detection
this works by building a directed graph of acquired
pthread mutexes and making sure there are no loops in
that graph.

this feature is enabled with:

    setprop debug.libc.pthread 1

when a potential deadlock is detected, a large warning is
output to the log with appropriate back traces.

currently disabled at compile-time. set PTHREAD_DEBUG_ENABLED=1
to enable.

Change-Id: I916eed2319599e8aaf8f229d3f18a8ddbec3aa8a
2011-12-09 14:38:57 -08:00
Bruce Beare
af96d4dadc x86: libc may use the gcc flags from TARGET_linux-x86.mk
Change-Id: Iaf4d864d4b6fe388bd3c2d7c4d7d6e42aebb0d35
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2011-12-09 13:54:20 -08:00
David 'Digit' Turner
de44d0b2bd Merge "libc: provide atomic operations will full barriers for NDK apps." 2011-11-22 02:10:06 -08:00
Jeff Brown
10c8ce59a4 Add tgkill syscall.
Use tgkill instead of tkill to implement pthread_kill.
This is safer in the event that the thread has already terminated
and its id has been reused by a different process.

Change-Id: Ied715e11d7eadeceead79f33db5e2b5722954ac9
2011-11-18 16:40:48 -08:00
David 'Digit' Turner
0fec6b9d88 libc: provide atomic operations will full barriers for NDK apps.
__atomic_cmpxchg and other related atomic operations did not
provide memory barriers, which can be a problem for non-platform
code that links against them when it runs on multi-core devices.

This patch does two things to fix this:

- It modifies the existing implementation of the functions
  that are exported by the C library to always provide
  full memory barriers. We need to keep them exported by
  the C library to prevent breaking existing application
  machine code.

- It also modifies <sys/atomics.h> to only export
  always-inlined versions of the functions, to ensure that
  any application code compiled against the new header will
  not rely on the platform version of the functions.

  This ensure that said machine code will run properly on
  all multi-core devices.

This is based on the GCC built-in sync primitives.

The end result should be only slightly slower than the
previous implementation.

Note that the platform code does not use these functions
at all. A previous patch completely removed their usage in
the pthread and libstdc++ code.

+ rename arch-arm/bionic/atomics_arm.S to futex_arm.S
+ rename arch-x86/bionic/atomics_x86.S to futex_x86.S
+ remove arch-x86/include/sys/atomics.h which already
  provided inlined functions to the x86 platform.

Change-Id: I752a594475090cf37fa926bb38209c2175dda539
2011-11-16 17:37:15 +01:00
David 'Digit' Turner
30e30acf10 am 6b6ebeca: am 3a131026: resolved conflicts for merge of 50a83255 to gingerbread-plus-aosp
* commit '6b6ebeca985fb3843b56b507ac4ac1be44080a9c':
  enable support for large files (> 2G)
  Enable functional DSO object destruction
  x86: Enable -fstack-protector
  Update X86 Bionic CRT files for unwind/exceptions
  bionic, libthread_db x86 fixes
  Updated gcc 4.4.3 IA toolchain doesn't require the .ctors list
  Remove an extra register move.
  Replace __atomic_XXX with GCC __sync_XXX intrinsics.
  move some typedefs to procfs.h required by gdbserver build
  use consistent guards for off_t and size_t defines for IA
  Simplify variable typing for IA builds
  sigsetmask.c was not processing the "mask" argument.
  Add defines for CAIF support
  Remove extra/unneeded copy of fenv.h
  Use proper variable typing
  Update ATOM string routines to latest
  Fix undefined reference to dl_iterate_phdr for x86
  Fix missing NL
  ptrace.c Fix source file format to unix from dos
2011-07-13 14:53:56 -07:00
David 'Digit' Turner
6b6ebeca98 am 3a131026: resolved conflicts for merge of 50a83255 to gingerbread-plus-aosp
* commit '3a13102637c8be53edf28f96598ac11aaa3e14df':
  enable support for large files (> 2G)
  Enable functional DSO object destruction
  x86: Enable -fstack-protector
  Update X86 Bionic CRT files for unwind/exceptions
  bionic, libthread_db x86 fixes
  Updated gcc 4.4.3 IA toolchain doesn't require the .ctors list
  Remove an extra register move.
  Replace __atomic_XXX with GCC __sync_XXX intrinsics.
  move some typedefs to procfs.h required by gdbserver build
  use consistent guards for off_t and size_t defines for IA
  Simplify variable typing for IA builds
  sigsetmask.c was not processing the "mask" argument.
  Add defines for CAIF support
  Remove extra/unneeded copy of fenv.h
  Use proper variable typing
  Update ATOM string routines to latest
  Fix undefined reference to dl_iterate_phdr for x86
  Fix missing NL
  ptrace.c Fix source file format to unix from dos
2011-07-11 13:25:01 -07:00
David 'Digit' Turner
3a13102637 resolved conflicts for merge of 50a83255 to gingerbread-plus-aosp
Change-Id: Idf1971120bbdd52676f95aa3aa69f62342dc012e
2011-07-11 21:39:14 +02:00
Bruce Beare
afb0167ad9 Enable functional DSO object destruction
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>
2011-07-07 22:51:43 +02:00
Bruce Beare
a0aec0bd30 x86: Enable -fstack-protector
Change-Id: Iff9e3a3ba0e2d0faa7c6d98154aa5be0cc8a6c50
Orig-Change-Id: Ib69514c3afcb4c1f5e5f3f8cd91acfd145a0866c
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2011-07-07 22:51:37 +02:00
Bruce Beare
832a86eaba Update ATOM string routines to latest
Orig-Change-Id: I22a600e7f172681cfd38ff73a64e3fd07b284959
Signed-off-by: Lu, Hongjiu <hongjiu.lu@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2011-07-07 22:46:15 +02:00
Bruce Beare
88bb394c0d Fix undefined reference to dl_iterate_phdr for x86
Orig-Change-Id: I22410b27939e8f54da932d7a1104102550c4685f
Signed-off-by: Bruce Beare <brucex.j.beare@intel.com>
2011-07-07 22:46:15 +02:00
Jean-Baptiste Queru
681c4bd782 Merge b3773e9c
Change-Id: I5787d9ac5e745a08e1c891e9ce9efc4e7f97ace8
2011-07-06 13:00:05 -07:00
David 'Digit' Turner
b3773e9cc8 am 9c95cbf7: Merge "Really fix the build."
* commit '9c95cbf75094c15d251bb3d57a55ce47d7c6c2c8':
  Really fix the build.
2011-07-06 10:27:49 -07:00
David 'Digit' Turner
c51871d4b2 Really fix the build.
libcutils/mspace.c includes libc/bionic/dlmalloc.c, we need to
take care of the fact that any internal C library function cannot
be used from it.

Change-Id: I0bc81ae090b7ac2d464f26b97fc6b94a08cdad9c
2011-07-06 19:02:15 +02:00
David 'Digit' Turner
2d2dbd3024 x86: fix full_x86-eng build
The latest merge conflict resolution worked only for ARM, but not for x86
Both ARM and x86 builds have been tested with this fix.

Change-Id: I4ec1f1b0ea32fa86e7e2515b221133473d6550a3
NOTE: Care has been taken to not change the compiler flags for ARM builds.
      In particular, when building crtbegin_so.so, the -fPIC flag is only
      used for x86 (previous reports indicate that it breaks the ARM
      build at runtime for obscure reasons).
2011-06-25 17:26:38 +02:00
David 'Digit' Turner
67cbb25865 resolved conflicts for merge of b4896660 to master
Change-Id: I40451873c006e5bbcbd17d3bddc1a44773ba16a0
2011-06-24 18:00:04 +02:00
David Turner
b489666086 am 1c0a0381: Merge "Enable functional DSO object destruction"
* commit '1c0a0381dfb3648ffadef9537ec9383d63d62473':
  Enable functional DSO object destruction
2011-06-23 05:28:13 -07:00
Bruce Beare
3964084282 Enable functional DSO object destruction
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>
2011-06-20 14:44:44 -07:00
Martijn Coenen
a903811819 Revert "x86: Enable -fstack-protector"
This reverts commit e0b4844a20,
causes netd to crash.
2011-06-07 17:19:12 +02:00
David Turner
65fb884d28 am 204d1f65: am b2c7e0c1: Merge "x86: Enable -fstack-protector"
* commit '204d1f65dbfc6d5a14a90627d9d1efcfce8261ee':
  x86: Enable -fstack-protector
2011-06-06 12:57:08 -07:00
David Turner
204d1f65db am b2c7e0c1: Merge "x86: Enable -fstack-protector"
* commit 'b2c7e0c18b7ab04cfe306277c79165de0612a2d1':
  x86: Enable -fstack-protector
2011-06-06 11:32:49 -07:00
Bruce Beare
e0b4844a20 x86: Enable -fstack-protector
Change-Id: Ib69514c3afcb4c1f5e5f3f8cd91acfd145a0866c
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2011-05-24 13:32:14 -07:00
David Turner
b609bfd048 am a9e409a0: am a7a9dddb: Merge "bionic: Add ARM optimized strcmp()"
* commit 'a9e409a03530c79bc7ad8144d08e8921ebe0dd02':
  bionic: Add ARM optimized strcmp()
2011-05-17 04:51:45 -07:00
David Turner
a9e409a035 am a7a9dddb: Merge "bionic: Add ARM optimized strcmp()"
* commit 'a7a9dddb5dfe783d65fec4d3b0dee9f734345a29':
  bionic: Add ARM optimized strcmp()
2011-05-17 04:47:09 -07:00
Jim Huang
f50e9be593 bionic: Add ARM optimized strcmp()
Reference results of the experiments on TI OMAP3430 at 600 MHz

$ bench_strcmp -N "strcmp_1k" -s 1k -I 200

[original C code]
             prc thr   usecs/call      samples   errors cnt/samp     size
strcmp_1k      1   1     10.38000          102        0    15000     1024

[ARM optimized code]
             prc thr   usecs/call      samples   errors cnt/samp     size
strcmp_1k      1   1      3.08840           88        0    15000     1024

The work was derived from ARM Ltd, contributed to newlib, and reworked
for Android by Linaro.

Change-Id: Ib0d5755e1eb9adb07d80ef0252f57a5c4c57a425
Signed-off-by: Jim Huang <jserv@0xlab.org>
2011-04-20 15:39:43 +08:00
Iliyan Malchev
368070454b bionic: remove LOCAL_PRELINK_MODULE
Change-Id: Iad65ae18446b20d2aace7b8fe19b1a032b616e9c
Signed-off-by: Iliyan Malchev <malchev@google.com>
2011-03-14 14:25:58 -07:00
Andy McFadden
4ce737f5df Added _memmove_words
Added a memmove() variant for Dalvik's System.arraycopy()
implementation.  It guarantees 16-bit or 32-bit atomicity depending
on the alignment of the arguments.

Bug 3398352

Change-Id: Ie7bd246305ef0ff8290513663327c5b81680368d
2011-02-04 14:49:49 -08:00
Jean-Baptiste Queru
53c3e86fae am 3d302be4: Merge "android-x86: add sigsetjmp.S"
* commit '3d302be485bc2f62a889fac85e386c9b8775eb59':
  android-x86: add sigsetjmp.S
2010-12-29 11:29:33 -08:00
Chih-Wei Huang
18635d9c17 android-x86: add sigsetjmp.S
It adds two functions sigsetjmp and siglongjmp
that fix compiling errors in bluetooth and mksh.

Copy directly from sigsetjmp.S of OpenBSD.

Change-Id: I4696f82ee6f85d1c93cbdd3c9e40f4917d50f3a6
2010-12-26 09:22:13 -08:00
David 'Digit' Turner
95d751feac libc: Add ftruncate64 and improve 64-bit parameter syscall handling.
This patch improves the handling of 64-bit parameters in syscalls on ARM.
The ARM EABI mandates that 64-bit quantities be passed in even/odd register
pairs, which requires special treatment.

This allows us to simplify our implementations of pread() and pwrite()
and remove the C stubs for pread64() and pwrite64().

Also add ftruncate64() to <unistd.h>

Change-Id: I407e2fd223ba0093dd2d0b04c6152fadfc9ce3ef

Bug 3107933
2010-12-16 17:04:41 +01:00
David 'Digit' Turner
72e6fd4242 <sched.h>: Add sched_getcpu() and cpu_set_t
This adds the cpu_set_t type definition and related functions
and macros used to handle CPU thread affinity.

  sched_getcpu()
  sched_setaffinity()
  sched_getaffinity()

Change-Id: If382ecafde8926341a88478062b275553645065b
2010-12-06 13:42:54 +01:00
Kenny Root
72e64e0869 Add support for pread64/pwrite64
64-bit pread() and pwrite() is needed for ZipFileRO to be able to read
ludicrously large ZIP files just in case someone is crazy enough to do
it.

Also fix a license header that was apparently mangled.

Change-Id: I6819ef8b36e46b63b40749c95717b1ecf9307033
2010-11-24 13:14:50 -08:00
Jean-Baptiste Queru
9c8ea7fa3f am 24dc9363: resolved conflicts for merge of 1bc98ccb to gingerbread-plus-aosp
* commit '24dc936346b4a31005ac28c4bd464320cca9320a':
  bionic: Add ARM optimized strcpy()
2010-11-22 13:38:44 -08:00
Jean-Baptiste Queru
24dc936346 resolved conflicts for merge of 1bc98ccb to gingerbread-plus-aosp
Change-Id: Ief9ec3d0472660e26864e082e03c26e09a043b9d
2010-11-22 13:34:59 -08:00
Jim Huang
73c04b3269 bionic: Add ARM optimized strcpy()
Reference results of the experiments on Qualcomm MSM7x25 (524MHz):

[original C code]
             prc thr   usecs/call      samples   errors cnt/samp
size
strcpy_1k      1   1     14.56159           99        0     1000
1024

[ARM optimized code]
             prc thr   usecs/call      samples   errors cnt/samp
size
strcpy_1k      1   1      3.46653           99        0     1000
1024

The work was derived from ARM Ltd.

Change-Id: I906ac53bb7a7285e14693c77d3ce8d4ed6f98bfd
2010-11-22 13:01:32 -08:00