fix compile

Change-Id: I0b4ab1d110eab373e4bc8df1c0f0fa79c625a19c

libc: Add Scorpion-optimized memcpy and memset

 * Optimized routines from Qualcomm for msm8660 class SoCs
 * Enable with TARGET_CPU_VARIANT := scorpion

Change-Id: I01d0f22efba5a418ddd20fca0d0c570d855e0f6f

Conflicts:
	libc/arch-arm/scorpion/scorpion.mk

libc: Use the fast strlen on Scorpion too

Change-Id: I9ba50a469de27269adc008c2a96767830ad6b70b

libc: krait: Use performance version of bcopy and memmove

Change-Id: I587085aeb0c30ceccaa3f420594a194b129632b5

Conflicts:
	libc/Android.mk
	libc/arch-arm/generic/generic.mk
	libc/arch-arm/krait/krait.mk

libc: Add NEON optimized memmove

ported from cm10.1

bionic-benchmarks on cortex-a9
generic:
BM_string_memmove/8    50000000         67   119.35 MiB/s
BM_string_memmove/64   10000000        175   364.59 MiB/s
BM_string_memmove/512   1000000       1078   474.86 MiB/s
BM_string_memmove/1K    1000000       2072   494.20 MiB/s
BM_string_memmove/8K     100000      16400   499.50 MiB/s
BM_string_memmove/16K     50000      32293   507.35 MiB/s
BM_string_memmove/32K     50000      66585   492.12 MiB/s
BM_string_memmove/64K     10000     160435   408.49 MiB/s

NEON-optimized:
BM_string_memmove/8   100000000         25   319.06 MiB/s
BM_string_memmove/64   50000000         43  1472.60 MiB/s
BM_string_memmove/512  10000000        247  2069.74 MiB/s
BM_string_memmove/1K    5000000        463  2210.08 MiB/s
BM_string_memmove/8K     500000       3465  2363.69 MiB/s
BM_string_memmove/16K    500000       6894  2376.30 MiB/s
BM_string_memmove/32K    100000      15490  2115.38 MiB/s
BM_string_memmove/64K     50000      42097  1556.75 MiB/s

Change-Id: I89253a01fb811438089e16320ac265177a2ca152

Conflicts:
	libc/Android.mk
libc: add tegra2 TARGET_CPU_VARIANT

Tegra2 is a Dual Cortex A9 without FP neon SIMD

based on 'generic' arm (memcpy, memset)
on cortex-a15 and a8 (strcmp)
and armv7-a (memchr and strlen)

These applets are no more common since recent optimisations

strcpy from cortex-a9
strcat : keep standard one

Change-Id: I1e7207e2d1ba02012fb5306f46b688903d31386c
Signed-off-by: Tanguy Pruvot <tanguy.pruvot@gmail.com>
bionic: linker: fix prelink support

load_bias_ needs to be calculated from the min_vaddr, not the
prelink address

Fixes

couldn't map "libraryname.so" segment 1: Invalid argument

Change-Id: Ibf1fd1d5a0f2c81ce515f5d47412a043ba768247
bionic: call stdio cleanup on exit

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
Merge bionic optimizations

Conflicts:
	libc/arch-arm/arm.mk

Change-Id: I8dbbd1a4520ca862f188daaaf13615877df41712
libc: krait: Use performance version of bcopy and memmove

Ported from CM10.2.

bionic-benchmarks on mako:
before:
                     iterations      ns/op
BM_string_memmove/8    50000000         32   243.54 MiB/s
BM_string_memmove/64   20000000        143   446.41 MiB/s
BM_string_memmove/512    2000000        885   578.14 MiB/s
BM_string_memmove/1K    1000000       1733   590.55 MiB/s
BM_string_memmove/8K     200000      13618   601.54 MiB/s
BM_string_memmove/16K     100000      27276   600.66 MiB/s
BM_string_memmove/32K      50000      59115   554.30 MiB/s
BM_string_memmove/64K      10000     118162   554.63 MiB/s

after:
                     iterations      ns/op
BM_string_memmove/8    50000000         20   381.94 MiB/s
BM_string_memmove/64  100000000         17  3636.07 MiB/s
BM_string_memmove/512   50000000         50 10116.80 MiB/s
BM_string_memmove/1K   20000000         98 10429.23 MiB/s
BM_string_memmove/8K    2000000        876  9346.43 MiB/s
BM_string_memmove/16K    1000000       1836  8923.09 MiB/s
BM_string_memmove/32K     500000       4392  7459.79 MiB/s
BM_string_memmove/64K     200000       8562  7653.85 MiB/s

Change-Id: Id64913a71857d9cfdf6bd1bbe2c66cfc49d72748
new gerrit replication test

Change-Id: I83a4134f1147430b195f3773db126d187bcc4cb4
Merge remote-tracking branch 'aosp/kitkat-mr1-release' into HEAD
linker: Avoid logcat spam with some blobs

Many of pre-kitkat blobs would emit a "text relocations" warning which makes logcat completely unreadable.
This commit will hide this warning to prevent it.

Change-Id: I8f32b5bbfea33d732320b3ac29da6b0027fbd521
libc: Unbreak build for scorpion

Use cortex-a15 memcpy and krait memset routines

Change-Id: I02cb178b33b01fc91e903f1f7b620640fd0f3310
libm: add fmal long double stub

PS2: Fix dependencies

Summary:
This is needed in some target cases, and has since been fixed internally in the AOSP.

From enh@google.com regarding this change:
you were right, and this was the way we should have done it, but i didn't work that out until i fixed this in the same way as part of the aarch64 work (where the weak reference didn't work).

Test Plan: verified

Reviewers: randall.rushing, jriordan001, synergy

Reviewed By: synergy

Differential Revision: http://review.codefirex.com/D234

Change-Id: Ia57674b89e110a7fff4a90c534f67a6bbef57c68
Signed-off-by: DHOMD <DHO@dho.im>
Make use of new memcpy, tweak settings

Summary:
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The new memcpy() is slightly faster than the cortex-strings version,
and fixes the Galaxy Nexus camera issue.

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>

Test Plan: verified in micro bench

Reviewers: randall.rushing, jriordan001, anders3408, synergy

Reviewed By: synergy

Differential Revision: http://review.codefirex.com/D235

Conflicts:
	libc/Android.mk

Change-Id: I89fd0f71c271e047595199e5a6c2f83dd39305a3
Signed-off-by: DHOMD <DHO@dho.im>
libc: support __errno_location

Summary:
Android's errno behavior is the same as glibc's __errno_location.
Support __errno_location for compatibility.

Test Plan: verified fully

Reviewers: randall.rushing, synergy

Reviewed By: synergy

Differential Revision: http://review.codefirex.com/D236

Change-Id: I2f48168d31a870836271319460e3a941c6498022
Signed-off-by: DHOMD <DHO@dho.im>
libc stdlib: implement C99 _Exit and C11 quick_exit API

Summary: needed for some newer changes shortly :)

Test Plan: verified

Reviewers: randall.rushing, jriordan001, synergy

Reviewed By: synergy

Differential Revision: http://review.codefirex.com/D237

Change-Id: I2b34a9cfc2a71721e4bda47b9b06553a096a813c
Signed-off-by: DHOMD <DHO@dho.im>
[ARM] libc: optimized strnlen, strncat, strncmp, and strlcat

PS2: Fix dependencies

Summary:
Date:   Mon Sep 23 14:45:06 2013 -0700

    [ARM] libc: use basic ASM strnlen implementation

    Summary:
    This is based on the current naive strlen routine from
    netbsd

    Test Plan: significant implemented bench gains

    Reviewers: randall.rushing, synergy

    Reviewed By: synergy

    Differential Revision: http://review.codefirex.com/D499

    Conflicts:
        libc/Android.mk

Author: synergydev <synergye@codefi.re>
Date:   Mon Sep 23 14:43:27 2013 -0700

    [ARM] libc: use optimized ASM strncmp implementation

    Summary:
    This strncmp implementation is based on the current
    arm netbsd implementation

    Test Plan: https://sourceware.org/git/?p=glibc.git;a=blob;f=benchtests/bench-strncmp.c;h=25df3dbc2eb25346d9a897f8d7a2ada9725584e3;hb=master and integrated bionic-benchmark

    Reviewers: randall.rushing

Author: synergydev <synergye@codefi.re>
Date:   Sat Sep 21 23:45:58 2013 -0700

    [ARM] libc: use basic ASM strncat implementation

    Summary:
    This implementation is the naive strncat implementation
    for ARM from netbsd upstream.

    Test Plan: Someone else test please, bench gain is significant with http://repo.or.cz/w/glibc.git/blob_plain/ec901dcf2886cfb81d88f9a63cfcd62b9efe6381:/benchtests/bench-strncat.c (no currently integrated bench, only test which is good with this change).

    Reviewers: randall.rushing, ConnorBaker, synergy

    Reviewed By: synergy

Author: synergydev <synergye@codefi.re>
Date:   Mon Sep 23 14:42:47 2013 -0700

    [ARM] libc: use basic ASM strlcat implementation

    Summary: This is based on the netbsd naive strlcat implementation

    Test Plan: +1 here

    Reviewers: randall.rushing, synergy

    Reviewed By: synergy

Test Plan: significant implemented bench gains

Reviewers: randall.rushing, synergy

Reviewed By: synergy

Differential Revision: http://review.codefirex.com/D238

Conflicts:
	libc/Android.mk

Change-Id: Ie9409391cab54527e8949fc879788cf0288db161
Signed-off-by: DHOMD <DHO@dho.im>
[ARM] libc: define return and conditional return macros

Summary: Required by the new strncat, strlcat, strncmp, and strnlen

Test Plan: verified

Reviewers: randall.rushing, jriordan001, anders3408, synergy

Reviewed By: synergy

Differential Revision: http://review.codefirex.com/D239

Change-Id: Id0f59bdf3efafdb06f8ea588bcc08b8fdc5483c5
Signed-off-by: DHOMD <DHO@dho.im>
Clean up some ARMv4/ARMv5 cruft.

Change-Id: I29e836fea4b53901e29f96c6888869c35f6726be
Clean up the pthread-only atomic stuff a little.

It looks like we can probably just use the generic GCC stuff instead;
the generated code looks pretty similar. We should come back to that.

These routines are only used by the pthread implementation, and
__bionic_atomic_inc isn't used, so we can remove it.

Conflicts:
	libc/private/bionic_atomic_arm.h

Change-Id: I8b5b8cb30a1b159f0e85c3675aee06ddef39b429
ARM: Change dmb domain for bionic_atomic_barrier()

This patch changes the domain that the memory barrier operates on. Assumes
that the scope of bionic_atomic_barrier() does not include device memory,
memory shared with the GPU or any other memory external to the processor
cluster.

Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>

Conflicts:
	libc/private/bionic_atomic_arm.h
	libc/private/bionic_atomic_gcc_builtin.h

Change-Id: I291e741c98a64c86f3a3cf99811bbf1e714ac9aa
Remove harmful attempts to be helpful in pthread_mutex functions.

Most callers won't check for EINVAL, so it's best to fail early.
GCC takes the nonnull attribute as a guarantee that an argument
won't be NULL, so these hacks were already ineffective, which is
how we found that at least one commercial game was using NULL
as if it's a mutex, but actually getting no-op behavior.

Bug: 11971278
Change-Id: I89646e043d931778805a8b692e07a34d076ee6bf