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
libc: krait: Re-factor high-performance memcpy for thumb2

The majority of libc under bionic is built for thumb2.  Refactor the
high performance memcpy used in previous builds for thumb2, including
information that can be used for stack-unwinding.

Change-Id: Ib5f7ab354f39313758402ec02b0aea27b15d45fa

Conflicts:
	libc/arch-arm/krait/bionic/memcpy_base.S
(cherry picked from commit cdeb493351044c3116fc0d42a64f33f8215a5886)
(cherry picked from commit 0c524faa937b40178915c9478599b754b6f8f78d)
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
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: 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
Merge tag 'android-4.4.1_r1' into HEAD

Android 4.4.1 Release 1
libc: krait: Implement optimized versions of memmove and bcopy

Restore a jellybean optimization for memmove and bcopy on krait.
Code has been refactored to thumb2 for consistency with the rest of
bionic libc, as well as performance and correctness.

Change-Id: I8f2f77dce4534fbce1bdf0188ab353bf34ab8637
Fix dns search domain use in gethostbyname.

Need to load search domain data before we attempt to use it.
bug:6799630

Change-Id: Ib228f4ca260339f71a2e28d5930c0a722bd43c92
__strnlen_chk: avoid recursive strlen calls

Don't use FORTIFY_SOURCE on functions which implement
FORTIFY_SOURCE.

Bug: 12216860
Change-Id: I61db1b47ccdd6bdcf41eab3303f4806494016199
Clean up more recursive FORTIFY_SOURCE calls

Don't use FORTIFY_SOURCE on functions which implement
FORTIFY_SOURCE, to avoid infinite recursion problems.

The previous patch only addressed one of the problems.

Bug: 12216860
Change-Id: I6f30ae7cb5b481be9942add18182ea4839d348a6
libc: Enable high-performance memmove and bcopy for cortex-a15

Change-Id: Id8e4e595021dd13bf4ab5620f5fb0b0d80333616
libc: Unbreak build for scorpion

Use cortex-a15 memcpy and krait memset routines

Change-Id: I02cb178b33b01fc91e903f1f7b620640fd0f3310
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.

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.

Change-Id: I291e741c98a64c86f3a3cf99811bbf1e714ac9aa
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
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
Merge remote-tracking branch 'cm/cm-11.0' into kk4.4