linker: restore prelink support

Prelink support is required to load old vendor binary blobs
on many devices properly

This solves Baseband issue on legacy devices.

Change-Id: Ic32ed1a5f851c0d03951ad0ef16ec51942ba033f
[ARM] libm: squashed CAF e_pow implementation made generic

Summary:
The following commits have been edited to be more
general than just for qcom devices. Any arm neon device
will benefit from this change.

commit 5587d4f73977774f12f7e459edf05881ca4d4367
Author: Lucas Crowthers <lucasc@codeaurora.org>
Date:   Thu Apr 25 15:56:16 2013 -0400

    libm: optimistic pow calling.

    Call optimized pow optimistically and revert to full range
    implementation if we detect an out-of-range input.

    Change-Id: I6f3aa734adbf99484b7ff70736ef83a41e5815b8

commit 1801b320beeae4ec6078e46d45bbf65d6c8e8bee
Author: Lucas Crowthers <lucasc@codeaurora.org>
Date:   Mon Aug 27 14:35:57 2012 -0400

    Bionic/libm: Pow optimizations and bug fixes.

    Use VFP calling convention for pow_neon handoff function by default.
    Fix register usage collision between two different polynomial
    coefficients in pow_neon.  Remove conditional execution in pow_neon
    and replace with branching.

    Change-Id: I76095f4a006e2fb01a53943b66fd69bfa1fd3033

commit 688c9786420309ee660e9641c6523ec8b78f30d2
Author: Lucas Crowthers <lucasc@codeaurora.org>
Date:   Mon Aug 27 14:27:59 2012 -0400

    Bionic/libm: Prefer branches and VFP ABI.

    For internal functions set gcc attribute "aapcs-vfp" for ARM
    and use -fno-if-conversion to prefer branches over predicated
    instructions (improves performance on architectures with good
    branch prediction).

    Change-Id: I8424e0e82a19d35e7e3b6e3e122dcdecdd5426fd

commit eb45d36b9c23707551f73581c5bf181e46acd381
Author: Lucas Crowthers <lucasc@codeaurora.org>
Date:   Fri Jun 15 19:27:46 2012 -0400

    Bionic/libm: fast neon pow() for small x,y.

    Add a fast neon version of pow() suitable for relatively small
    positive x and y (between 0 and 4).  Run the standard
    implementation in all other cases.  Gives approximately 60%
    performance improvement to AnTuTu FPU scores

    Change-Id: I97e0712daeb2740764b26a44be0caaa39c481453

Test Plan: verified, test it out on any ARM NEON device.

Reviewers: randall.rushing, jriordan001, anders3408

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

Conflicts:
	libm/Android.mk

Change-Id: I4dc0e54a482b1bd5194de10f169e5b3fe5194781
libm: sync with upstream freebsd

Summary:
New long double functions have been included,
but are not in use due to the android double long
handling. imprecise.c is not built for the same reason.

Test Plan: verified

Reviewers: randall.rushing

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

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

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: I0e49f2a33cf3b178b0dae7b703b252aad7183563
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.

Change-Id: I5e81ae96cefa52d590ac5adb8ebd30ef3a87222a
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
[ARM] libc: optimized strnlen, strncat, strncmp, and strlcat

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: I021fcba75f452d5f2fc43311ac1ad63e4e87c223
[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: Ia77f7cfd69076a9ceb65d13279c8768add4dbeec
libm: Squashed CAF sin/cos implementation for ARM NEON

Summary:
Bionic/libm: Add precision-correct de-serialize sin/cos.

Modify sin/cos to improve performance while retaining bit-for-bit
accuracy with existing algorithm.

Change-Id: Iaba2dd731cd015732744705dad8bddb713b43067
(cherry picked from commit df55e67573e176042c5d2ae084c758bc2e9e0025)
(cherry picked from commit 6a688d7aa4512731c430673ccd4f0d6e3999d439)
(cherry picked from commit 47bb7bc2962bff835000dca016f6319c20734398)

Bionic/libm: add assembly versions of sin/cos.

Add assembly versions of sin/cos with integrated remainder pi/2
calculation.  Directly extracted from binary libm.so compiled with
__ieee754_rem_pio2 calls inlined.

Change-Id: Ia093f420e58e794635e3a5f09e8236ae7601f1f6
(cherry picked from commit 19a356a1ed6384a9161739d5833cf5cfd88a8d3b)
(cherry picked from commit 1c9bdcfa6a68cd1a13a1e3b1a51616bddffeefad)
(cherry picked from commit cdaad8ab61325e958926b57a6a726d0cfa6f7511)

Bionic/libm: Remove extra vmov from sin/cos.

Move integer representations of x bits on the integer side rather
than moving them to and from the FP registers.

Change-Id: I1895db385c9616cdae9ab6403f392dfbae292adc
libm:also use optimized sqrt/sqrtf on ARM NEON

Summary: Depends on D270 and stacks on top. Fixed from initial patch that was reverted

Test Plan: verified

Reviewers: randall.rushing, jriordan001

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

Change-Id: I3909d74c67a24f0f6decdeebe7660c9d7e0c558a
libc: krait: optimized memmove and bcopy routines

Summary:
Depends on D271 and Depends on D272. To be stacked on top.

libc: arm: Allow optional optimization of memmove and bcopy

The libc functions memmove and bcopy are not configurable target-by-
target.  This change allows per-target optimization for best perfor-
mance.

Change-Id: Id684672fbf0bcffbe68c36a28b64186a6c2554f3

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
[ARM] libc: Improve how we set memcpy and memcmp flags
Summary: Check by cpu variant, and also that NEON_MEMCPY_ALIGNMENT_DIVIDER wasn't set elsewhere.

from synergy

Change-Id: Ia867f62a14288916014122f72c5a10ab20fe9f20
bionic: Fix aliasing violations

This makes bionic compile with compilers enforcing
strict adherence to aliasing rules (e.g. gcc 4.6+
with -Wstrict-aliasing=2 -Werror=strict-aliasing).

Change-Id: Ia43773da621d7d8ca33d411376aa7e20490c5734
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
bionic:Add new header files for graphics

The header files "hwmem.h" and "b2r2_blt.h" are needed
by the ST-Ericsson graphics implementation.

Change-Id: Ied4595c24aac140090c3feaed9fbc36e6c70f2a7
Signed-off-by: Patrik Ryd <patrik.ryd@stericsson.com>
bionic: Add ARMv7 optimized string handling routines

Add ARMv7 - and especially Cortex-A9 - optimized string handling
routines based on the versions found in the cortex-strings library.

Change-Id: I9ec0aeef588cc4f99bb7ca662f9233607a4a84b2
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Add workarounds for current compilers

With current compilers, we're getting "this function cannot be inlined"
errors on vsnprintf and strlcpy because the always_inline attribute is
set.

Before marking this a "fix" instead of a "workaround", we should figure
out why the functions can't be inlined.

Change-Id: I1ec7aab324a8891e99d98b95fc8e706288d03fd3
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Make use of new memcpy, tweak settings

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.

Change-Id: I9fc8c5ac6f30e2d1ced7054ae636152522adfbc3
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
bionic: Add Cortex-A15 optimized version of memcpy

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

Add the memcpy implementation from cortex-strings -- faster than
the current implementation on both A9 and A15.

To be investigated: Breaks saving pictures from the camera in
Galaxy Nexus builds

Change-Id: I15fde93282e07626a6e20c092b25c76923513f84
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
remove typos and multiple declarations

Change-Id: Iff32874c2f801519b57f19a3cc1c2c76b7c7f6fa
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
revert cortex string optimization routines for now

Change-Id: I410bdef93efd51277b494bde0300a01c49e926f7
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Declare __page_shift and __page_size with C linkage

__page_shift and __page_size are defined in asm/page.h with
C linkage - their implementation needs to use the same linkage.

The different linkage types cause a compiler error with clang.
Fixing them seems to be a good idea regardless of the compiler.

Change-Id: I35ed66a08989ced1db422eb03e4d154a5d6b5bda
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>