Exclude sha1.c when building libdex for device

In bionic, there is already an optimized SHA-1 hash implementation,
and the file 'sha1.c' in libdex is almost identical.  It is only
necessary to build sha1.c for host version of libdex.

In addition, the SHA-1 hash implementation in bionic is slightly faster
than the one included in libdex.

Here is the reference SHA-1 benchmark on Nexus S:

[libdex]
Rounds: 100000, size: 6250K, time: 1.28s,  speed: 4.768 MB/s

[bionic]
Rounds: 100000, size: 6250K, time: 1.184s, speed: 5.156 MB/s

(manually cherry-picked commit 55ac5b0a908b85c050f34dc603f62dd4b1fc4e9f)
dalvik: Fix various compile failures with gcc 4.6

This fixes numerous compile errors with gcc 4.6, and combinations
of -DNDEBUG, -DLOG_NDEBUG resulting in variables being defined but
not used - resulting in a compiler warning (or build breakage
with -Werror).

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

dalvik: Fix aliasing violation

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

dalvik/libdex: Change to -O2 if we're building with -O3

This is a workaround for an apparent gcc bug.
https://bugs.launchpad.net/linaro-android/+bug/948255

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

dalvik: Fix build with ISO C++11

Fixes some confusion between jchar and the new char16_t

Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
dalvik/libdex: Don't reduce optimization level to -O2

Don't reduce optimization level to -O2: It's sufficient to disable
function inlining

Rebased from: http://review.cyanogenmod.org/#/c/26538
Change-Id: Ie6d9978cf0bf0e49cfa296c09c4eba913f22c303
Author: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
Some changes added to compile and run with Java 6 and Java 7.

* correction of errors with Javac 6:
- target 1.5 and source empty.
Zygote: Restrict slave mountspace so Dalvik apps can mount system-wide volumes

Android 4.2 implements multi-user storage using per-process mount
namespaces.  Originally, everything under "/" (the entire filesystem
hierarchy) is marked as a recursive-slave mountspace for all zygote
instances.  This is done so that user-storage sandbox mounts under
/storage/emulated are hidden from other apps and users.

Unfortunately this means that any Dalvik app (actually, any program whose
clone/fork ancestry includes a Dalvik zygote, which is everything except
services spawned directly from init) cannot mount system-wide volumes.
Thus, apps like CifsManager are effectively broken in Android 4.2, since
its cifs mounts are only visible to the CifsManager app itself.  All other
apps see empty mountpoints instead of the mounted volume.  Furthermore,
Linux provides no provision for a process to "escape" a recursive-slave
mountspace in versions prior to Linux 3.8 (setns syscall).

Here, we restrict the slave mountspace to /storage (and, due to a possible
kernel bug, /mnt/shell/emulated) so that Dalvik apps can mount system-wide
volumes elsewhere (with appropriate permission, as in earlier versions of
Android), while retaining full multi-user storage compatibility.

This change requires that a tmpfs volume is mounted as /storage in init.rc.
If this volume is unavailable, then Zygote falls back to the previous
behavior of marking the entire filesystem hierarchy as slave.  It also
implicitly requires that EMULATED_STORAGE_TARGET is path-prefixed by (part
of the subhierarchy of) ANDROID_STORAGE, which is the typical case.
GC triggering performance optimizations

Copy the correct starting heap size at process init.
Interfaces to set GC/managed heap parameters.

Change-Id: I1080ba60ae64d546c0f35925bc7c931b89c7600b
Reclaiming attribute obj after pthread_create

call pthread_attr_destroy in order to reclaim attribute object.

Change-Id: I2592903ef67101a7c656a3ab0ad243a9716298b5
Revert "Reclaiming attribute obj after pthread_create"

This reverts commit fc5819ba81bfeb8a2edecc9f8ce60a1aedfd38ca.
Use -fno-strict-aliasing for libdvm
Signed-off-by: Paul Beeler <sparksco@gmail.com>
Reclaiming attribute obj after pthread_create

call pthread_attr_destroy in order to reclaim attribute object.

Change-Id: I2592903ef67101a7c656a3ab0ad243a9716298b5
Revert "Reclaiming attribute obj after pthread_create"

This reverts commit 82e33abd3e1ff233e9c5390d0ceee3a83f58c63e.