Commit graph

149 commits

Author SHA1 Message Date
Nick Kralevich
83a73d1afe crtbegin: eliminate duplicate code
crtbegin_dynamic and crtbegin_static are essentially identical,
minus a few trivial differences (comments and whitespace).

Eliminate duplicates.

Change-Id: Ic9fae6bc9695004974493b53bfc07cd3bb904480
2012-05-30 11:45:12 -07:00
Ying Wang
fc9e525fe0 Rename the misleading var name TARGET_OUT_STATIC_LIBRARIES
TARGET_OUT_STATIC_LIBRARIES is actually the same as
TARGET_OUT_INTERMEDIATE_LIBRARIES.

Change-Id: I11ac35256031d461d20156cd4c19ed7eae781d22
2012-05-15 15:15:11 -07:00
Iliyan Malchev
83a38b8c44 am 8034415d: resolved conflicts for merge of 08e72d01 to jb-dev-plus-aosp
* commit '8034415ddd8404f8788199ed993af89692235dc5':
  bionic: add support for non-NEON memcpy() on NEON SoCs
2012-05-10 09:24:46 -07:00
Iliyan Malchev
8034415ddd resolved conflicts for merge of 08e72d01 to jb-dev-plus-aosp
Change-Id: If00e354a5953ed54b31963d4f8ea77e1603c321e
2012-05-10 09:19:59 -07:00
Prajakta Gudadhe
08e72d0161 bionic: add support for non-NEON memcpy() on NEON SoCs
Some SoCs that support NEON nevertheless perform better with a non-NEON than a
NEON memcpy().  This patch adds build variable ARCH_ARM_USE_NON_NEON_MEMCPY,
which can be set in BoardConfig.mk.  When ARCH_ARM_USE_NON_NEON_MEMCPY is
defined, we compile in the non-NEON optimized memcpy() even if the SoC supports
NEON.

Change-Id: Ia0e5bee6bad5880ffc5ff8f34a1382d567546cf9
2012-05-09 13:34:31 -07:00
Elliott Hughes
fd8bd2c432 am 58a00b49: am 7eb1cc23: Merge "bionic: allow the board to customize MALLOC_ALIGNMENT"
* commit '58a00b4977b6fa073a8f56d94d741b1e4cb49856':
  bionic: allow the board to customize MALLOC_ALIGNMENT
2012-05-09 12:56:15 -07:00
Elliott Hughes
58a00b4977 am 7eb1cc23: Merge "bionic: allow the board to customize MALLOC_ALIGNMENT"
* commit '7eb1cc23f8976a2062ba0cf92f030216a8e64e60':
  bionic: allow the board to customize MALLOC_ALIGNMENT
2012-05-09 12:53:16 -07:00
Jack Ren
2fd81ef71c bionic: allow the board to customize MALLOC_ALIGNMENT
Currently the dlmalloc allocates the memory with 8-byte alignment.
According to the com.aurorasoftworks.quadrant.ui.professional benchmark data:
We can get much better memory performance if we change it to be 16-byte aligned.
For example, On Nexus-S:
8-byte aligned :
    1378 1070  1142 1665 1765  1163 1179  1263  1404 avg: 1336.555555556
16-byte aligned:
    1691 1731  1780 1691 1671  1678 1802  1758  1780 avg: 1731.333333333
                                                    gain: 29.53%

That patch provides flexibity to customize the MALLOC_ALIGNMENT from the
board config.The macro MALLOC_ALIGNMENT defaults to 8.
To change it, please define BOARD_MALLOC_ALIGNMENT in the BoardConfig.mk:
BOARD_MALLOC_ALIGNMENT := <whatever>

Change-Id: I8da0376944a0bbcef1d0fc026bfb6d9125db9739
Signed-off-by: Jin Wei <wei.a.jin@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Signed-off-by: Beare, Bruce J <bruce.j.beare@intel.com>
2012-05-09 09:52:22 -07:00
Ben Cheng
da0d8534f1 am 08b51e2c: Implement the "abort" stub in assembly for ARM.
* commit '08b51e2c091d036c124259ae59eb7be6bbe346af':
  Implement the "abort" stub in assembly for ARM.
2012-05-09 01:48:40 -07:00
Ben Cheng
eda7be454d 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().

(Cherry pick of Id264a5167e7cabbf11515fbc48f5469c527e34d4.)

Bug: 6455193

Conflicts:

	libc/Android.mk

Change-Id: I568fc5303fd1d747075ca933355f914122f94dac
2012-05-08 14:47:20 -07:00
Ben Cheng
08b51e2c09 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().

[cherry-picked from master]

BUG:6455193
Change-Id: I0102355f5bf20e636d3feab9d1424495f38e39e2
2012-05-08 14:39:35 -07:00
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