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: I4ba49d364c44d0a42c276aff3a8098300dbdcdf0
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
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
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
[MIPS] Rewrite MIPS crtbegin* as C files.

This updates the MIPS arch to be much more in
sync with the commit Nick Kralevich made last
June; see 9d40326830c2bd407427889c554adeb915ee6b4a.

    Rewrite
     crtbegin.S        -> crtbegin.c
     crtbegin_so.S     -> crtbegin_so.c
     __dso_handle.S    -> __dso_handle.c
     __dso_handle_so.S -> __dso_handle_so.c
     atexit.S          -> atexit.c

Previously __do_global_dtors_aux was in the tasks
__FINI_ARRAY__ linked with crtbegin.S and it now being
removed as there is no need to call a destructor just
before terminating a process.

Shared libraries, on the other hand, are linked with
crtbegin_so.c and have a hidden destructor declared
to allow the bionic linker to call __on_dlclose().

Change-Id: Ieb4da5199b54573de05743990e309db381a11cb8
Signed-off-by: Pete Delaney  <piet.delaney@imgtec.com>
Signed-off-by: Chao-Ying Fu  <chao-ying.fu@imgtec.com>
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Remove some non-unused makefile generality.

MIPS uses .c files like ARM and x86 now.

Change-Id: Ie580647e385121c380316c443ec199dabf657ff8

Conflicts:
	libc/Android.mk
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>
[MIPS] __dso_handle.S and __dso_handle_so.S not needed.

Global hidden variable __dso_handle is now declared in:
       bionic/libc/private/__dso_handle.h

Change-Id: I8e951a8d7c65877bafc1be23a7fff6d44d3a2846
Signed-off-by: Pete Delaney  <piet.delaney@imgtec.com>
Signed-off-by: Chao-Ying Fu  <chao-ying.fu@imgtec.com>
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
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
Update the comments to reflect the current status.

Change-Id: I3a6348b568230fe8b21d121e5b8d30561a9703c2
libgcc_compat: Introduce __aeabi_lasr for cortex-a9 and higher

This is needed when passing -mcpu=cortex-a9 or higher on a modern
toolchain for prebuilt library compatibility

Change-Id: I73eb2393377914ae26216a8c2828ad973d1c1225
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
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>
Fix the detection of alt-network in dns resolver.

Used to determine proper A/AAAA record request.

bug:10132565
Change-Id: I7229f6672e879920a6fae58672cddd72db78546c
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>
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
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
Bionic: Add AOSP master cortex optimizations

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

But this version includes a tweak for performance on misaligned
buffers.

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

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>

Add new optimized strlen for arm.

This optimized version is primarily targeted at cortex-a15.

Tested on all nexus devices using the system/extras/libc_test strlen test.
Tested alignments from 1 to 32 that are powers of 2.
Tested that strlen does not cross page boundaries at all alignments.

Speed improvements listed below:

cortex-a15
- Sizes >= 32 bytes, ~75% improvement.
- Sizes >= 1024 bytes, ~250% improvement.

cortex-a9
- Sizes >= 32 bytes, ~75% improvement.
- Sizes >= 1024 bytes, ~85% improvement.

krait
- Sizes >= 32 bytes, ~95% improvement.
- Sizes >= 1024 bytes, ~160% improvement.

Merge from internal master.

(cherry-picked from 2fc071797743b88a9a47427d46baed7c7b24f4d2)

Change-Id: I1ceceb4e745fd68e9d946f96d1d42e0cdaff6ccf

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

libgcc_compat: Introduce __aeabi_lasr for cortex-a9 and higher

This is needed when passing -mcpu=cortex-a9 or higher on a modern
toolchain for prebuilt library compatibility

Change-Id: I73eb2393377914ae26216a8c2828ad973d1c1225

Conflicts:
	libc/arch-arm/arm.mk
	libc/arch-arm/cortex-a15/bionic/strlen.S
	libc/arch-arm/cortex-a15/cortex-a15.mk
	libc/arch-arm/cortex-a9/cortex-a9.mk
	libc/arch-arm/generic/generic.mk
	libc/arch-arm/krait/krait.mk
libc: arch-arm: strlen: Illegal ARM registry entries fixed
Signed-off-by: Paul Beeler <sparksco@gmail.com>

Change-Id: I52d7e95a8afb8b26f55fe0bc01853a15a95e90c2

Conflicts:
	libc/arch-arm/generic/bionic/strlen.c
Add futimens.

Bug: 10239370
Change-Id: I518340084103dc339ef8a065d4837d6258a1381d

Conflicts:
	tests/Android.mk