Add abi flag to make-standalone-toolchain.sh.

Allow the invoker to specify a subset of ABIs for a given architecture when
creating a standalone toolchain.

Change-Id: I7b5dbce4d4c3eb9e3e38f4c0f54cdc7fa085f64d
Replace -nostdlib with -nodefaultlibs when crtbegin/end are needed.

Using -nodefaultlibs allows the compiler to still specify the startup files
removing the need for manually wrapping the link line with crtbegin and crtend.

Change-Id: Ibb362325ff2aa663dc49ac7b715988c0dbbeb410
Merge "Add abi flag to make-standalone-toolchain.sh."
Merge "Replace -nostdlib with -nodefaultlibs when crtbegin/end are needed."
cpu-features: Support 32-bit ARM binaries running on an ARM64 kernel.

This addresses several issues related to 32-bit ARM binaries running
on an ARMv8 CPU.

The first one is that API level 20 exposes getauxval() in <sys/auxv.h>
which provides a reliably way to extract the ARM ELF HwCaps, so try
to use it when possible. Note that this adds -ldl as a LDLIBS
export for the library.

The second one is that /proc/self/auxv should always be the preferred
to /proc/cpuinfo for a process to access the 32-bit ARM ELF HWCaps.
Unfortunately, this file is not always accessible on some recent
Android platform versions, even though this may be fixed in the future.

When the file is not accessible, parse /proc/cpuinfo as a fallback,
but deal with the fact that the 'Features' field only list features
that are optional for the device's CPU reference architecture revision.
I.e. when running on an ARMv8 CPU, it will not list the typical
ARMv7 extensions that became mandatory in ARMv8.

+ Refresh and clarify documentation to explain that the output of
  android_getCpuFamily() depends on the process' bitness, not the
  target device's CPU.

+ Check that android_getCpuFeatures() returns 0 as expected on
  anything except 32-bit ARM and 32-bit Intel.

+ Fix the reporting of ARM IDIV instruction by Goldfish kernels
  / Android emulators.

BUG=13679666

Change-Id: Icad8a9d0a7cf651f42a717219c597205586a0a72
Fix cxx-stl builds

Fail introduced here: Ibb362325ff2aa663dc49ac7b715988c0dbbeb410
It doesn't fix mips builds because when building DSO under --sysroot it
is looking for crtbegin_dynamic.o instead of crtbegin_so.o

Change-Id: Ia1561cc08bb2a79abf18df4c432cb441e8de9251
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
Fix libc++ build with android-20 and llvm-3.4

Change-Id: I1cd6652f0141c1d3fcbbb82bb2b67fb0602d17d1
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
Merge "Fix cxx-stl builds"
Merge "Fix libc++ build with android-20 and llvm-3.4"
Merge "cpu-features: Support 32-bit ARM binaries running on an ARM64 kernel."
Generate 32-bit part of multilibs based on 32-bit symbols

Since libraries symbols are different for 32-bit and 64-bit image we
should generate 32-bit libs based on 32-bit symbols.

In particular __floatsitf() is available on 64-bits only.

Change-Id: Iebe856f11f7a82c781d7bc5e819b6a7eaaf79de4
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
Merge "Generate 32-bit part of multilibs based on 32-bit symbols"
Use toolchains/prebuilt/$HOST_TAG/ to compile target prebuilts

Previously we always choose 32-bit $HOST_TAG32 toolchains to compile
target prebuilts, when most developers are on 64-bit host and only
download the 64-bit host NDK.  On 64-bit host, this CL will try
64-bit host toolchains first before falling back to 32-bit host
toolchains

Change-Id: I4eb3f6ce2e56d0a4c79a1cb70a6a47562b8a1a0c
Add testcase for fix to aarch64/arm_aeon.h about FP_LO_REGS

See https://android-review.googlesource.com/#/c/95156

Change-Id: Idf346d51b573eab06221f6d57614180522044039
Fix shared library generation flags.

When generating a shared library, it is important to use -shared instead
of -Wl,-shared to indicate the type of the final binary to the linker.

With -shared, the frontend (e.g. g++ or clang++) will pick the right
set of C runtime files automatically (i.e. crtbegin_so.o crtend_so.o).

With -Wl,-shared, wrappers like clang++3.4 will insist on using the
C runtime files for executables (i.e. crtbegin_dynamic.o crtend_android.o).

When building for MIPS targets, this can result in a link error that looks like:

   .../ndk/toolchains/mipsel-linux-android-4.8/prebuilt/linux-x86/lib/gcc/mipsel-linux-android/4.8/../../../../mipsel-linux-android/bin/ld: .../ndk/platforms/android-9/arch-mips/usr/lib/../lib/crtbegin_dynamic.o: .preinit_array section is not allowed in DSO
   .../ndk/toolchains/mipsel-linux-android-4.8/prebuilt/linux-x86/lib/gcc/mipsel-linux-android/4.8/../../../../mipsel-linux-android/bin/ld: .../ndk/platforms/android-9/arch-mips/usr/lib/../lib/crtend_android.o: .preinit_array section is not allowed in DSO
   .../ndk/toolchains/mipsel-linux-android-4.8/prebuilt/linux-x86/lib/gcc/mipsel-linux-android/4.8/../../../../mipsel-linux-android/bin/ld: failed to set dynamic section sizes: Nonrepresentable section on output

This patch fixes the issue.

Change-Id: I9e7908c1b8c0e87bf4a818d6a38e6f67a750ea14
crazy_linker: Fix isnanf symbol lookup in clang builds.

Clang builds for arm32 generate calls to isnanf.  Android's libm.so isnanf
is weak.  Android's dlsym() returns NULL for weak symbols.  In libm.so,
isnanf is a synonym for a (strong) __isnanf.

If resolving isnanf from Android libm.so fails, retry __isnanf.

http://code.google.com/p/chromium/issues/detail?id=376828

Change-Id: Ib04f933e6a317e5a65cd2762b02027b0388b0e4a
Signed-off-by: Simon Baldwin <simonb@google.com>
Merge "Fix shared library generation flags."
Merge "crazy_linker: Fix isnanf symbol lookup in clang builds."
Merge "Use toolchains/prebuilt/$HOST_TAG/ to compile target prebuilts"
Merge "Add testcase for fix to aarch64/arm_aeon.h about FP_LO_REGS"