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).

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

Conflicts:

	libc/netbsd/net/getaddrinfo.c
	libc/netbsd/net/getnameinfo.c

Change-Id: I4a6fd36a66b23d963ce137916caece4a424e78ab
Gross fix for IN6_IS_ADDR_TEREDO aliasing... explodes generating ASM with the fix from jb42

Change-Id: I99c7e867e600bbb47309bc89b0c6cacb0883a84d
Merge remote-tracking branch 'cm/cm-10.2' into HEAD
libc: Add missing string functions to tegra2.mk

Change-Id: If4d64639fb796d5156ef1735542bce4e9ddb5a05
Merge remote-tracking branch 'cm/cm-10.2' into HEAD

Conflicts:
	libc/arch-arm/tegra2/bionic/strcpy.S

Change-Id: I1d974fbf6ffd9d96e0f44dd63be6fd4b2548b6cb
Merge remote-tracking branch 'cm/cm-10.2' into HEAD
Squashed commit of the following AOSP/master changes

commit 2badbd8a3a83673c6f1c57d58502e6390031ae2b
Author: Ben Cheng <bccheng@google.com>
Date:   Mon Jun 10 17:01:41 2013 -0700

    Fix abort(3) to raise SIGABRT rather than causing SIGSEGV.

    tgkill() needs the .save stack unwinding directive to get the complete
    stack trace.

    BUG: https://code.google.com/p/android/issues/detail?id=16672

    Change-Id: Ifb447dca2147a592c48baf32769dfc175d8aea72

commit 3ea14cf1b27be17bb66cf039ed96a966b2e4731c
Author: Christopher Ferris <cferris@google.com>
Date:   Thu Aug 29 11:37:33 2013 -0700

    Move stack unwinding test into library.

    Bug: 8291716
    Change-Id: Ia270f074b574a8fe86b5ad435bdef80999c64295

commit 5428f252ec14f028f8a9629e72814f364d200e83
Author: Christopher Ferris <cferris@google.com>
Date:   Tue Aug 27 17:21:37 2013 -0700

    Change hard-coded directory.

    The tests are using /data/data which is not accessible to a non-root
    user. Change this to /data/local/tmp which is accessible to all users.

    Bug: 8291716

    Change-Id: I66476bbbaf5d1dc0c103863abf9219405f06a85b

    Conflicts:
    	tests/statvfs_test.cpp

commit 1e704bd97770a3911932d7045e80d24a5df3fef8
Author: Christopher Ferris <cferris@google.com>
Date:   Tue Aug 27 14:32:15 2013 -0700

    Create bionic unit test library for use with CTS.

    Bug: 8291716

    Change-Id: I46b749348456fae7892eecca6b44aef51a0e4747

    Conflicts:
    	tests/Android.mk

commit f1efc9c58c5e4c55297fef8ff3862d33bad2f0d2
Author: Elliott Hughes <enh@google.com>
Date:   Thu Aug 22 11:37:32 2013 -0700

    Work around tzcode's reliance on signed overflow.

    I've mailed the tz list about this, and will switch to whatever upstream
    fix comes along as soon as it's available.

    Bug: 10310929
    Change-Id: I36bf3fcf11f5ac9b88137597bac3487a7bb81b0f

    Conflicts:
    	tests/time_test.cpp

commit f1504727d5d72340ca595eac0510041ab11de87c
Author: Elliott Hughes <enh@google.com>
Date:   Thu Aug 22 14:13:50 2013 -0700

    Apply upstream commit 943a6621866e9d6e654f5cfe1494378c1fb8957a.

    Author: Paul Eggert <eggert@cs.ucla.edu>
    Date:   Thu Aug 22 12:47:51 2013 -0700

        * localtime.c: Fix another integer overflow bug in mktime.

        (time2sub): Avoid undefined behavior on time_t overflow.
        Reported by Elliott Hughes in
        <http://mm.icann.org/pipermail/tz/2013-August/019580.html>.

    Bug: 10310929
    Change-Id: I3bf26f1f91371552e0a3828457d27e22af55acb2

    Conflicts:
    	libc/Android.mk
    	libc/tzcode/localtime.c

commit c393b06d739340b6621bb1756908f3f44237cbda
Author: Gajendra Singh <wxjg68@motorola.com>
Date:   Thu Aug 22 00:30:43 2013 -0700

    Set pattern die size, to inflate user requested size in order to  change

          memory allocation pattern, would be help full in finding early crashes
          with valid stack trace, rather than dlmalloc's CORRUPTION_ERROR_ACTION
          which dump stack traces mostly on free list validation.

          Note: this property would be used with debug_level 10.

    Change-Id: I44d46824cb332e2f13b6f0a47adbccc9734c3351

commit 2d9fafe613e6ca848f2f538c43c1200e08712705
Author: Jeff Hao <jeffhao@google.com>
Date:   Thu Aug 15 14:51:16 2013 -0700

    Fix pthread_getcpuclockid.

    clock_gettime was returning EINVAL for the values
    produced by pthread_getcpuclockid.

    Bug: 10346183
    Change-Id: Iabe643d7d46110bb311a0367aa0fc737f653208e

commit a35c104960dc12a0b8ee57f3cc73adc5477938cd
Author: Michael Wright <michaelwr@google.com>
Date:   Wed Aug 14 08:50:02 2013 -0700

    Update kernel input headers

    To upstream SHA e1c85813f3832b909d1c4309b213bb0a52c79ba5

    Change-Id: I72ee3d59c105bc0252b5ca0c49c569d12ec685d1

commit 1e2b03b564d3ac96ce3f1169a223d7e7fd656e2b
Author: Elliott Hughes <enh@google.com>
Date:   Tue Aug 13 14:30:59 2013 -0700

    Make ctype.h a little less unhygienic.

    This caused trouble for stlport.

    Change-Id: Id40787c5a2b7a3a4e12fb557efe549778a01cbbd

commit 478f212d19999d3862853838007b9b3f9deffc7c
Author: Elliott Hughes <enh@google.com>
Date:   Thu Aug 8 17:13:33 2013 -0700

    Add futimens.

    Bug: 10239370
    Change-Id: I518340084103dc339ef8a065d4837d6258a1381d

    Conflicts:
    	tests/Android.mk

commit 3585f6d1019ad2732bb26c753c840996ab6e6614
Author: Cédric Cabessa <ccabessa@genymobile.com>
Date:   Sun May 13 17:16:06 2012 +0200

    syslog needs a valid socket path for _PATH_LOG

    /dev/kmsg is a character device already used for different purposes.
    Most distribution use /dev/log for _PATH_LOG but this path is already used
    by logcat.
    I suggest using /dev/syslog.
    This change was tested with busybox's syslogd.

    Change-Id: I75b428123c7a0b3ca4bea656ce06860f6f727dde

commit d533d9780a74750206f14207f1bfab48d071d461
Author: Alexander Ivchenko <alexander.ivchenko@intel.com>
Date:   Thu Jun 27 12:55:46 2013 +0400

    Add ssse3 implementation of __memcmp16.

    __memcmp16 was missing in x86. Also added C-version for backward
    compatibility. Added bionic test for __memcmp16 and for wmemcmp.

    Change-Id: I33718441e7ee343cdb021d91dbeaf9ce2d4d7eb4
    Signed-off-by: Alexander Ivchenko <alexander.ivchenko@intel.com>

    Conflicts:
    	libc/arch-x86/string/ssse3-memcmp3-new.S
    	libc/arch-x86/string/ssse3-wmemcmp-atom.S
    	libc/arch-x86/x86.mk

commit 36616488a5748f71921d00d81dbf6168594cf69c
Author: Pavel Chupin <pavel.v.chupin@intel.com>
Date:   Tue Dec 18 17:25:01 2012 +0400

    Fix stdint.h intptr_t/uintptr_t for x86_64/x32

    Patch is required in NDK headers as well to be able to build multilib
    GCC with libgomp support.
    It's here: https://android-review.googlesource.com/#/c/62982

    Change-Id: I2bec25d8cbca0e5ef1a0857008ececd92f4911be
    Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>

commit 9a775252c9029424ca1c8dfed8099ea3e6549eb0
Author: Robert Greenwalt <rgreenwalt@google.com>
Date:   Fri Aug 2 15:24:45 2013 -0700

    Fix the detection of alt-network in dns resolver.

    Used to determine proper A/AAAA record request.

    bug:10132565
    Change-Id: I7229f6672e879920a6fae58672cddd72db78546c

commit eff3d7917bf7f70421e92bff797687c4a33469e8
Author: Xi Wang <xi.wang@gmail.com>
Date:   Fri Jan 25 20:55:22 2013 -0500

    fix broken pointer overflow check ns_name_unpack()

    Many compilers optimize away the overflow check `msg + l < msg',
    where `msg' is a pointer and `l' is an integer, because pointer
    overflow is undefined behavior in C.

    Use a safe precondition test `l >= eol - msg' instead.

    Change-Id: I3fca2125834073cc36d7e9c4e586e97842265a59
    Signed-off-by: Xi Wang <xi.wang@gmail.com>

commit e2bf03ab207fc5bf1b66cbe959ff033a587407b5
Author: Elliott Hughes <enh@google.com>
Date:   Mon Jul 29 16:51:45 2013 -0700

    Define PTHREAD_KEYS_MAX and _POSIX_THREAD_KEYS_MAX in a POSIX-compliant way.

    Also make sysconf use PTHREAD_STACK_MIN rather than redefining its
    own, different, constant.

    Bug: 9997352
    Change-Id: I9a8e7d2b18e691439abfb45533e82c36eee9e81d

commit 45bfc5d98012bde667d5002de41c1ed476b63e37
Author: Robert Greenwalt <rgreenwalt@google.com>
Date:   Wed Jul 31 16:53:46 2013 -0700

    Tell the dns resolver about our domains.

    A refactor caused us to not tell the resolver about search domains
    until after it had done the domain fanout.

    bug:6799630
    Change-Id: Ibabd8fa5bcc69b1490fc5e329e62eb0f2d1a5e63

commit 0553559ea2d347268ef6b477944f43cd9bee6fda
Author: Elliott Hughes <enh@google.com>
Date:   Thu Jul 25 10:15:07 2013 -0700

    Avoid sign extension of the mmap offset.
    off_t is signed to support seeking backwards, but that's a liability
    when using off_t to represent a subset of a file.

    Change-Id: I2a3615166eb16212347eb47f1242e3bfb93c2022

    Conflicts:
    	libc/bionic/mmap.cpp

commit ff90d54587a9f77a2dfca6b8e88afa4b2ae739e4
Author: Rom Lemarchand <romlem@google.com>
Date:   Tue Jul 23 11:30:52 2013 -0700

    Restore dlmalloc mmap threshold to 64k

    Restoring DEFAULT_MMAP_THRESHOLD to 64k, the way it was before
    999089181ef60bb67e1a49f2cf6f4ec608a7caf8.

    This forces allocations in the 64k-256k range to be mmaped.

    Change-Id: Iace55ed638edd272b3e94fa6cd2ddd349042be84
    Signed-off-by: Rom Lemarchand <romlem@google.com>

commit 6d0e1e1943d8042c28da1bc5a1e819c27be22416
Author: Elliott Hughes <enh@google.com>
Date:   Mon Jul 8 15:05:50 2013 -0700

    Remove <netinet/icmp6.h> ni_* macros.

    glibc doesn't have these, and they prevent ping from building out of
    the box because it assumes it can define them.

    Bug: 9671560
    Change-Id: I815f2a9c4fd96a0ea2952eb5a71ddf51e0763660

commit f4de0b6558d2712c2dbb188061d2cfc8de224e95
Author: Elliott Hughes <enh@google.com>
Date:   Mon Jul 8 11:16:24 2013 -0700

    Make bionic's <netinet/icmp6.h> standalone, like glibc's.

    This removes the need for a bionic-specific hack in external/iproute2.

    Bug: 9671560
    Change-Id: I9f15be0711d26bca863bd66be9a39606500fb948

commit bea3f4b9ee70e71fa0331c7845a8dc1279653b21
Author: Will Newton <will.newton@linaro.org>
Date:   Wed Jul 3 09:44:30 2013 +0100

    libc/arch-arm/bionic/memcpy.a9.S: memcpy from cortex-strings.

    This memcpy code uses NEON/VFP to achieve very good performance
    on ARMv7-A processors. It is specifically tuned for A15 but should
    provide good performance on A9 also. It is equivalent to the code
    in cortex-strings rev 116.

    This patch is a follow up the existing gerrit change:

    I7f6f77995f3ca903ad9c66d14261441667a2a935

    This version includes a tweak for performance on misaligned
    buffers and splits the header comment into license and
    documentation sections.

    Change-Id: Ibd2e23c8d8e01357ba0247be1d05192de3ceba69
    Signed-off-by: Will Newton <will.newton@linaro.org>

    Conflicts:
    	libc/NOTICE

commit abf05fbcc1e3eb8520452598df7e6e78e27bdbf0
Author: Jack Ren <jack.ren@intel.com>
Date:   Tue Apr 17 21:57:51 2012 +0800

    bionic: add memory barrier in fclose/fopen

    That ensures that the fp is really freed when fp->flags == 0 even in SMP
    case.

    Change-Id: Ic540d7f11654f9d67adae7e6702f2b25406bf05f
    Signed-off-by: Fengwei Yin <fengwei.yin@intel.com>
    Signed-off-by: Jack Ren <jack.ren@intel.com>
    Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>

commit b001ecbf9cf7b4f2f0bed831cda9838529e5a206
Author: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
Date:   Thu Sep 5 14:55:27 2013 +0200

    Adjust includes in sincos() for their 4.3 paths

    Change-Id: I225654a9d623720d7f1eda38d0dbb052e73b0227
    Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>

    Conflicts:
    	libm/sincos.c

commit 294fb752c0760f64e01a81e364771421360c9866
Author: Jack Ren <jack.ren@intel.com>
Date:   Tue Apr 17 22:34:18 2012 +0800

    bionic: add memory barrier to make sure __sinit( ) is SMP-safe

    Change-Id: Ic72cf3885a32af804fee2ee786c6a7884b90532b
    Signed-off-by: Jack Ren <jack.ren@intel.com>

commit a9ba64cd2411617835d3ba8930d9425619f2cbcb
Author: synergydev <synergye@codefi.re>
Date:   Sat Sep 14 00:11:33 2013 -0700

    tests: memcmp and memcpy unaligned benchmarks

    Unaligned benchmarks for memcmp and memcpy were missing.
    These are basic and aggressively unaligned by +10/+13.

    Change-Id: I0ce081f155b4288a0d41aad0399298bf2834ec4d

commit 93554ecbb28cc6dfaf1fcdb058978ff753171a40
Author: Brian Carlstrom <bdc@google.com>
Date:   Fri Sep 13 16:34:43 2013 -0700

    Simplify main thread stack size initialization

    Change-Id: Iec09433d9de501031cce09dc75848a5e8f3d96bf

    Conflicts:
    	libc/bionic/pthread_attr.cpp
    	libc/bionic/pthread_internal.h

commit 5632eb5b7c0a88ca4aed05e9393648de1403077c
Author: Brian Carlstrom <bdc@google.com>
Date:   Thu Sep 12 21:47:20 2013 -0700

    Use kernel default for initial thread size

    Bug: 10697851

    Change-Id: I8d980f5e0b584799536f6e6b891056c968d26cdf

Change-Id: I4cd9c920d25b00f708bdc67680312eb2c63dd802
DISGUSTING HACK to keep mediaserver from aborting when a picture is taken on S4

Change-Id: I99e08ad8d2562bd56f40daef88f82145126da4f7
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>
Fix mismatch between declaration and forward declaration

KernelArgumentBlock is defined as a class in KernelArgumentBlock.h, but
forward declarations refer to it as a struct.

While this is essentially the same, the mismatch causes a compiler
warning in clang (and may cause warnings in future versions of gcc) in
code that is supposed to be compiled with -Werror.

Change-Id: I58c34563d6b9f78b47f40e4a92ee0c0aa3992ecd
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
Redo clang patch in a way that doesn't break gcc 4.8

Change-Id: I6b0ed3cf05b552c982f851d161c5bcb7f1cd5930
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
Revert "Detect userspace memory leak for JB_MR2"

This reverts commit bba493121c8e135bd9cd145ab35e53cac1702a9e.
Merge remote-tracking branch 'cm/cm-10.2' into nuts

Conflicts:
	libc/arch-x86/x86.mk

Change-Id: I344a8d44959ac083113ac3676e7c81648b312658
libc: fix __cxa_atexit implicit declaration

Change-Id: Iacad18b332a717e4485c83df4bd42a850ff7699f
[ARM] libm: reimplement reimplementation of a few fp functions

combination of vanir's sin/cos/sqrt/sqrtf optimizations for krait/etc. + 2 commits by synergydev:

https://github.com/codefireXperiment/bionic/commit/5b1ece28ccc897c302c83b85bf86e2d736db72e6
https://github.com/codefireXperiment/bionic/commit/a1fcb3341f592f57e9ac845e1be92de23e3a9820

Change-Id: I879a2cefa2fa4415895f3afb7a3182c9af090495
Fix e_pow issue on non-krait stuff

Change-Id: I82675ee4c9762d141c2ff005d56de1a28ce5cea6
Revert all of those tweaks because something in them broke LPA playback on S4

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

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.

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.

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