History log of /bionic/linker/linker.cpp
Revision Date Author Comments
9ef1fbb644bf85fa211588853316efa4848547c6 21-Aug-2013 Brian Carlstrom <bdc@google.com> Make mips_relocate_got tolerate a missing got

Bug: 10094803

(cherry picked from commit 7ee26878065abb494600595349ce58b2b2db3709)

Change-Id: I9fbb65d20011f2f625fde3b15ac8c6887dd03ae4
c45087bffa528c0809f0df2e0a3708eba7018b33 25-Jan-2013 Sergey Melnikov <sergey.melnikov@intel.com> Kernel dso support for 'dl_iterate_phdr' function

Kernel provides virtual DSO for stack unwinding/exception handlind info for
signal usage case. Stack unwinding routines use 'dl_iterate_phdr' function
for additional DWARF info gathering from DSOs. Patch enables virtual DSO
enumeration via dl_iterate_phdr function.

Signed-off-by: Sergey Melnikov <sergey.melnikov@intel.com>
Change-Id: Ic2882b28f40b456a088bc1e63c50cbfda7e4a102
c9084427aa15259c8bfb9b13b979597a4abd1805 21-Jun-2013 Nick Kralevich <nnk@google.com> linker: Emit a warning on text relocations

Text relocations unnecessarily mark pages as dirty, preventing them
from being swapped out, wasting memory. Also, text relocations
prevent the code from running on certain hardened systems.

Print a message in logcat and stderr when we see a text relocation,
to encourage developers to fix their code.

Change-Id: I6051a7463911e090ae5727a355397d539669d5b9
7e5a8cc5230dcc027686813e51a1b001cee4c602 18-Jun-2013 Elliott Hughes <enh@google.com> Make LD_PRELOAD failures just warnings.

This matches glibc and makes life easier for developers who want to
sometimes preload a library from init (which has no conditionals); they
can simply move/remove the library to disable.

Change-Id: I579b8633f958235af6e46bb53b378b9e363afb1f
6bec5b792a5f034089a942cb28cab26d36408235 04-Jun-2013 Christopher Ferris <cferris@google.com> Small cleanup of soinfo_elf_lookup.

- Remove unnecessary line.
- Move declarations to first use.

Change-Id: I1d8398d6c13f7cb86bffe0b68af849e35a4b234d
738370d9387396922c10910edb61272e585be107 09-May-2013 Elliott Hughes <enh@google.com> Don't fail to run DT_INIT and DT_INIT_ARRAY constructors if a shared library has DT_PREINIT_ARRAY constructors.

The GNU dynamic linker silently ignores a DT_PREINIT_ARRAY section
in a shared library. We had ineffectual code that tried to report
an error, which I tried to fix but got wrong --- my version still
wouldn't report the error to the caller, but would prevent us from
continuing to call constructors.

Bug: 8825226

(cherry picked from commit 8147d3c284932896ab6095232b355979b9eb33d3)

Change-Id: Iad8e7e3743d1a5e6bd1d44ef40b1ab3499cb64f2
8147d3c284932896ab6095232b355979b9eb33d3 09-May-2013 Elliott Hughes <enh@google.com> Don't fail to run DT_INIT and DT_INIT_ARRAY constructors if a shared library has DT_PREINIT_ARRAY constructors.

The GNU dynamic linker silently ignores a DT_PREINIT_ARRAY section
in a shared library. We had ineffectual code that tried to report
an error, which I tried to fix but got wrong --- my version still
wouldn't report the error to the caller, but would prevent us from
continuing to call constructors.

Bug: 8825226
Change-Id: I4fd8450ecc44d8767a1cb808aeecfbfbfc77c070
8d3e91d4f842911366155845afb3cfbdad0b4cad 25-Apr-2013 Nick Kralevich <nnk@google.com> linker: only re-open std* for setuid programs.

get_AT_SECURE() was getting called before linker_env_init() had
been called, and returning the default value ("true"). This was
causing us to reopen closed stdin, stdout, and stderr for ALL
processes, not just privileged (setuid) processes.

Calling path:
- __linker_init
- soinfo_link_image
- get_AT_SECURE
- __linker_init_post_relocation
- linker_env_init

This change restores the intended behavior of only re-opening
stdin, stdout, and stderr for privileged processes.

Change-Id: I8b085ea6597710ac4c1a3c93f1bf8b81eecb08c0
7b4d77e400d321ccc7cdadd1cd225ebb1a69d358 04-Apr-2013 Elliott Hughes <enh@google.com> Make abort messages available to debuggerd.

This adds __libc_fatal, cleans up the internal logging code a bit more,
and switches suitable callers over to __libc_fatal. In addition to logging,
__libc_fatal stashes the message somewhere that the debuggerd signal handler
can find it before calling abort.

In the debuggerd signal handler, we pass this address to debuggerd so that
it can come back with ptrace to read the message and present it to the user.

Bug: 8531731

(cherry picked from commit 0d787c1fa18c6a1f29ef9840e28a68cf077be1de)

Change-Id: I5daeeaa36c1fc23f7f437d73a19808d9d558dd4d
0d787c1fa18c6a1f29ef9840e28a68cf077be1de 04-Apr-2013 Elliott Hughes <enh@google.com> Make abort messages available to debuggerd.

This adds __libc_fatal, cleans up the internal logging code a bit more,
and switches suitable callers over to __libc_fatal. In addition to logging,
__libc_fatal stashes the message somewhere that the debuggerd signal handler
can find it before calling abort.

In the debuggerd signal handler, we pass this address to debuggerd so that
it can come back with ptrace to read the message and present it to the user.

Bug: 8531731
Change-Id: I416ec1da38a8a1b0d0a582ccd7c8aaa681ed4a29
8f7120bbacb0bb7a8aca1102f76f64a462f40231 22-Mar-2013 Kito Cheng <kito@0xlab.org> Drop unnecessary execution permission for .cpp/.c/.h

Change-Id: I9ac2b9d8f6bdb4fab8962210c5ec8f9c3e8c0ebf
8f2a5a0b40fc82126c691d5c30131d908772aab7 15-Mar-2013 Elliott Hughes <enh@google.com> Clean up internal libc logging.

We only need one logging API, and I prefer the one that does no
allocation and is thus safe to use in any context.

Also use O_CLOEXEC when opening the /dev/log files.

Move everything logging-related into one header file.

Change-Id: Ic1e3ea8e9b910dc29df351bff6c0aa4db26fbb58
ca0c11bd823f37f03cc8067cb182876827d5275a 12-Mar-2013 Elliott Hughes <enh@google.com> Use more types than just 'unsigned' in the linker.

Still chipping away at the situation where every variable in the
linker was of type 'unsigned'. This patch switches counts over to
being size_t and adds an explicit type for init/fini function pointers
and arrays of function pointers.

Also improve logging from CallArray.

Also remove trailing "\n"s from log messages.

Change-Id: Ie036d2622caac50f4d29f0570888bb527661d77e
fa8c05dc00bb41ae8fe5cb5e4f82816e30f7f7b2 12-Mar-2013 Kito Cheng <kito@0xlab.org> Use Elf32_Addr instead of unsigned in linker

Change-Id: I52dcbb4b0ff0a4052e0ad7a9bbeb2df65c9d2f66
2d4b9b7cff78b9a378d7fc0f28c702dc43002020 07-Mar-2013 Brian Carlstrom <bdc@google.com> Fix typo of DT_NEEDED for DT_NULL

(cherry-pick of 138b205ea9efc117fe522c2d7191378023a6e2cd)

Change-Id: Ia895cb3018df55554627f1f61dcdfdada4a961ce
5e2492eb89b778ee71e37e7406fe290d986ece70 06-Mar-2013 Kito Cheng <kito@0xlab.org> Fix TIMING/STATS/COUNT_PAGES dynamic linker build

Change-Id: I6432ac378816da253b83d1c7fb1d3fb64647b89e
43cc7f795b48e9c13a54e15af829369805f11652 06-Mar-2013 Brian Carlstrom <bdc@google.com> Fix MIPS linker build

(cherry-picked from 8c7d8c2057e303985f78eab96da747ddaa013c78)

Change-Id: Idcf62ab95f8fccbc2d7c3e771a4cfbe768a1555e
650be4e584eeab3591b9e273bfd6d169eea60853 06-Mar-2013 Elliott Hughes <enh@google.com> More linker cleanup.

Change-Id: I9fb3c7c0d4b4ffef0eeaf092d4e30ffe63a08671
d4ee82dfa3ba01baa10e3ca48fcb31a27b8a4e81 01-Mar-2013 Brian Carlstrom <bdc@google.com> Minor linker cleanup, primarily to use Elf32_Dyn

Change-Id: Ifa9408e9859c6f79444715bed4808b7c13fdced5
d3920b3a996b358e48232f417aa0a1e44a60f155 08-Feb-2013 Elliott Hughes <enh@google.com> Switch to using AT_RANDOM for the stack guards.

Bug: 7959813
Change-Id: I8db4b8912ba649bfe668c6f22aa44690ddd401a2
42b2c6a5eed5e4ef35315b8cd32d1355f12a69b6 07-Feb-2013 Elliott Hughes <enh@google.com> Clean up the argc/argv/envp/auxv handling.

There's now only one place where we deal with this stuff, it only needs to
be parsed once by the dynamic linker (rather than by each recipient), and it's
now easier for us to get hold of auxv data early on.

Change-Id: I6314224257c736547aac2e2a650e66f2ea53bef5
d2b1a7311f023a1c532b5b418fc4bc7bd835be34 06-Feb-2013 Elliott Hughes <enh@google.com> Remove partial implementation of MIPS non-PIC support.

Change-Id: I3c287e52aae10559508174e73113367aea40e5c2
1e980b6bc8315d00a07312b25486531247abd98c 18-Jan-2013 Elliott Hughes <enh@google.com> Fix the duplication in the debugging code.

We had two copies of the backtrace code, and two copies of the
libcorkscrew /proc/pid/maps code. This patch gets us down to one.

We also had hacks so we could log in the malloc debugging code.
This patch pulls the non-allocating "printf" code out of the
dynamic linker so everyone can share.

This patch also makes the leak diagnostics easier to read, and
makes it possible to paste them directly into the 'stack' tool (by
using relative PCs).

This patch also fixes the stdio standard stream leak that was
causing a leak warning every time tf_daemon ran.

Bug: 7291287
Change-Id: I66e4083ac2c5606c8d2737cb45c8ac8a32c7cfe8
36bd371e26c716cbc18e11801b13eff0352d91b0 16-Jan-2013 Nick Kralevich <nnk@google.com> Revert "stack protector: use AT_RANDOM"

The AT_RANDOM changes broke setuid / setgid executables
such as "ping". When the linker executes a setuid program,
it cleans the environment, removing any invalid environment
entries, and adding "NULL"s to the end of the environment
array for each removed variable. Later on, we try to determine
the location of the aux environment variable, and get tripped
up by these extra NULLs.

Reverting this patch will get setuid executables working again,
but getauxval() is still broken for setuid programs because of
this bug.

This reverts commit e3a49a8661125f24aec8a1453e54b3b78005e21e.

Change-Id: I05c58a896b1fe32cfb5d95d43b096045cda0aa4a
e3a49a8661125f24aec8a1453e54b3b78005e21e 14-Jan-2013 Nick Kralevich <nnk@google.com> stack protector: use AT_RANDOM

Populate the stack canaries from the kernel supplied
AT_RANDOM value, which doesn't involve any system calls.
This is slightly faster (6 fewer syscalls) and avoids
unnecessarily reading /dev/urandom, which depletes entropy.

Bug: 7959813

Change-Id: If2b43100a2a9929666df3de56b6139fed969e0f1
99c32055cb50443f722c55914869c1f6bb941959 14-Jan-2013 Elliott Hughes <enh@google.com> Fix my git mistake.

This was the formatting change that was supposed to be in
cf23905a4bcc7bfdd109be5b6d69ad06877aa217.

Change-Id: Ib79fa031b68f6f541f532507eb589afeaedb831f
cf23905a4bcc7bfdd109be5b6d69ad06877aa217 12-Jan-2013 Chris Dearman <chris@mips.com> [MIPS] Set DT_DEBUG dyntab entry if it is writable

This is primarily for MIPS exutables that do not have a
DT_MIPS_RLD_MAP entry.

Change-Id: I4c221d92debcfed961eeee2515123f3fb21ec8e6
Signed-off-by: Chris Dearman <chris@mips.com>
db492b3ca753c4ef688d0daf648294de0c89145e 04-Jan-2013 Elliott Hughes <enh@google.com> Fix debug malloc.

...which has been broken since the linker data structures went read-only.

Bug: 7941716
Change-Id: If28f6bac0fcb13e371e4d85b064544f561c8d692
cade4c36e7c9c62db3f476a0f9cfc329bac9acb7 20-Dec-2012 Elliott Hughes <enh@google.com> Support System.loadLibrary for libraries with transitive dependencies.

Also fix the FLAG_ERROR annoyance --- it's not helpful to cache failures.

Bug: 7896159
Bug: http://code.google.com/p/android/issues/detail?id=34416
Bug: http://code.google.com/p/android/issues/detail?id=22143
Change-Id: I60f235edb4ea4756e1f7ce56f7739f18e8a50789
e66190d2a97a713ae4b4786e60ca3d67ab8aa192 19-Dec-2012 Elliott Hughes <enh@google.com> Check for unknown flags passed to dlopen(3).

Change-Id: I56f4aab0e5a1487bc32d2c4d231e8bd15c4ac8da
20a24403bc333cd92996cd43cef2e6a79c72d055 31-Oct-2012 Chris Dearman <chris@mips.com> Do not include '\0' when writing error messages to stderr

Change-Id: I6adc806c3920e5a4ae61ca55c40613fcf338b18c
Signed-off-by: Chris Dearman <chris@mips.com>
c5db969aa4a24a76fc0964f2ff89533e832b47a6 15-Nov-2012 Chao-Ying Fu <fu@mips.com> We should use load_bias. This patch fixes MIPS NDK device exception test failures.

Change-Id: I4b718c36666e66062c1f13e4deea1ec7a7951c54
9c94fc9fbefe55836c1e1b949850f7726e64c118 05-Nov-2012 Elliott Hughes <enh@google.com> Tone down some of the overly-verbose linker logging.

We don't need to see every dlopen(3)/dlsym(3) failure unless LD_DEBUG is on.

Change-Id: I1edfe8b72f32ff54dd30e1acf32e20d470d5e9f7
61a9ccb41eba8c35cae6e21318aca7160a402c5b 02-Nov-2012 Elliott Hughes <enh@google.com> Make dynamic linker debugging always available.

If you need to build your own linker to get debugging, the debugging
is never available when you need it.

Change-Id: I5ff7e55753459d49a2990f25d9aa155e0b8602e0
c77c434149959e135ba21d1dd8a78a408fef2489 31-Oct-2012 Pavel Chupin <pavel.v.chupin@intel.com> Adjust symbol lookup for DT_SYMBOLIC case

According ELF spec re. DT_SYMBOLIC:
This element's presence in a shared object library alters the dynamic
linker's symbol resolution algorithm for references within the library.
Instead of starting a symbol search with the executable file, the
dynamic linker starts from the shared object itself. If the shared
object fails to supply the referenced symbol, the dynamic linker then
searches the executable file and other shared objects as usual.

This change implements the last part.

Change-Id: Iae95d53d455313a4306f11733941bcd3596ac85f
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
6971fe4ca52ebdaa85ba676a044412b01d2ef1bf 02-Nov-2012 Elliott Hughes <enh@google.com> Allow dlopen("egl/blah.so").

NVIDIA binary blobs construct strings to pass to dlopen(3) that
contain '/' but require that we fall back to LD_LIBRARY_PATH.

Change-Id: Iad831899986baace6962f4b335eeb288250a1e22
d23736e4f228e46304b7cbc674a1d0094d73e0f5 01-Nov-2012 Elliott Hughes <enh@google.com> Keep the dynamic linker's soinfo pools mostly read-only.

We'll need a lot more refactoring of this code before we can reduce
the granularity, but this is a step forward.

Change-Id: I07061720e734b571a8399c1d5b4f2f35cd681307
1a6961650c82168864afe040dbdc05977db701df 01-Nov-2012 Elliott Hughes <enh@google.com> Stop defining our own PAGE_SIZE and PAGE_MASK, and test dlclose(3) too.

Also remove an unnecessary #include and a now-obsolete TODO.

Change-Id: I36d923721e349a286934b9534090a67ce0786e7b
ba98d9237b0eabc1d8caf2600fd787b988645249 12-Sep-2012 Magnus Malmborn <magnus.malmborn@sonymobile.com> Dynamically allocate soinfo-structs in linker

Request memory from the system when needed instead of having a fixed
array for soinfo structs. Note that malloc() et al can't be used in
linker, so use mmap() instead.

Change-Id: I4b495995931d7752b0e8c944e64d1fe41b9f7144
124fae9eabd7a25d80dfa8c3b56bed0f0fba16f1 31-Oct-2012 Elliott Hughes <enh@google.com> Reject .so files with no sysv hash table.

Also ensure that dlopen(3) errors always include the name of the library we
failed to open.

Also fix a bug where we'd fall back to searching LD_LIBRARY_PATH and the
built-in paths for names that include slashes.

Bug: http://code.google.com/p/android/issues/detail?id=38479
Change-Id: Ib2c009ed083344a7a012749d58f8679db2f26c78
5ae44f302b7d1d19f25c4c6f125e32dc369961d9 30-Aug-2012 Ard Biesheuvel <ard.biesheuvel@gmail.com> linker: handle R_ARM_COPY relocations in a proper way

If an executable contain copy relocations, other references
to the symbol it points to should be preempted and made to
point to the copy instead.

Also, the linker should make sure the target area has
sufficient space to contain the copy. It also checks
whether the library that supplies the symbol is built
with -Bsymbolic, and errors out if this is the case.

Change-Id: If135c83590092741cfd8f82f54816f363a4a4a3b
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@gmail.com>
18a206c81d9743481e364384affd43306911283d 30-Oct-2012 Elliott Hughes <enh@google.com> More dynamic linker cleanup.

I still want to break linker_format out into its own library so we can reuse
it for malloc debugging and so forth. (There are many similar pieces of code
in bionic, but the linker's one seems to be the most complete/functional.)

Change-Id: If3721853d28937c8e821ca1d23cf200e228a409a
5419b9474753d25dff947c7740532f86d130c0be 17-Oct-2012 Elliott Hughes <enh@google.com> Make dlerror(3) thread-safe.

I gave up trying to use the usual thread-local buffer idiom; calls to
calloc(3) and free(3) from any of the "dl" functions -- which live in
the dynamic linker -- end up resolving to the dynamic linker's stubs.
I tried to work around that, but was just making things more complicated.
This alternative costs us a well-known TLS slot (instead of the
dynamically-allocated TLS slot we'd have used otherwise, so no difference
there), plus an extra buffer inside every pthread_internal_t.

Bug: 5404023
Change-Id: Ie9614edd05b6d1eeaf7bf9172792d616c6361767
3b297c40794b23d50cb5240f9b03f6ef25fd98db 12-Oct-2012 Elliott Hughes <enh@google.com> Fix dlerror(3).

Add unit tests for dlerror(3) in various situations. I think We're at least
as good as glibc now.

Also factor out the ScopedPthreadMutexLock and use it here too.

Bug: http://code.google.com/p/android/issues/detail?id=38398
Change-Id: I040938b4366ab836e3df46d1d8055b92f4ea6ed8
9c3449ecd9d5e9cdb1e995e35e53334a4a288a5e 13-Sep-2012 Xiaokang Qin <xiaokang.qin@intel.com> bionic: linker: Need update the map->l_addr for execution.

Currently, linker doesn't update the map->l_addr for execution.
Which could break the Unwind_Backtrace with PT_GNU_EH_FRAME enabled
in new toolchain.

Change-Id: Ifbd853134da64a962f7e4c4105e56a3f20def1b2
Author: Fengwei Yin <fengwei.yin@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 57077
e9b6fc6f82276188404a2839e31a2f4c19f6c336 29-Aug-2012 Elliott Hughes <enh@google.com> Improve the dynamic linker diagnostics.

Lose the pid, only show the name of the function (not its whole signature),
and include the name of the library we failed to load. (I hadn't noticed
that the library name was missing before because in Java we add that into
the UnsatisfiedLinkError detail message.)

The new output looks like this:

Cannot load library: soinfo_relocate(linker.cpp:968): cannot locate symbol "__libc_malloc_default_dispatch" referenced by "libc_malloc_debug_leak.so"...

Change-Id: I3bb5c9780d9aaf3a9e4418ea55bc98122a81f80f
d39c3abd5ad8600fb1d79a0b95a58197197087e0 24-Aug-2012 Nick Kralevich <nnk@google.com> linker: Fix ARM_R_COPY relocations

Per http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044d/IHI0044D_aaelf.pdf
Section 4.7.1.10, ARM_R_COPY relocations are only suppose to reference shared
libraries, not the executable itself. When resolving an R_ARM_COPY symbol,
ensure we don't look in our own symbol.

This partially addresses
http://code.google.com/p/android/issues/detail?id=28598 . After this
patch, the printfs generated by the test program are:

global = 0x42 (0x401c7000)
global = 0x42 (0x11000)

before, the output was:

global = 0x42 (0x40071000)
global = 0x0 (0x11000)

I'm still not very happy with this patch, but I think it's an improvement
over where we were at before.

This change was modeled after https://android-review.googlesource.com/38871

Change-Id: Id7ad921e58395e76a36875bcc742ec5eeba53f08
bedfe38b8ba512dd6236c00e8b4a9b01c2bd1281 14-Aug-2012 Elliott Hughes <enh@google.com> More cleanup.

Make more stuff static, remove some dead code, and fix a few typos.

Change-Id: I010b0eadeaf61e2899c37014ad1e7082c70bd510
12c78bbded8ec03f821dfa09174464c04836e4ea 14-Aug-2012 Ard Biesheuvel <ard.biesheuvel@gmail.com> linker: avoid clobbering the .dynamic section of shared libs

This patch removes the DT_NEEDED hack which stores pointers
to soinfo structs in the .dynamic section of the library
being loaded.

Instead, it caches the soinfo struct pointers on the stack
during relocation time. After relocation time, i.e. when
calling constructors and destructors of the shared library
and its dependencies, uncached access is used instead,
doing lookups using the string table entries pointed to by
the DT_NEEDED entries.

By removing this hack, it is no longer needed to undo the
PT_GNURELRO protection, i.e., all non-writable mappings
can remain non-writable during their entire lifespan.

Even though, strictly speaking, the algorithmic complexity
has increased somewhat, the real-world adverse effect
is negligible on the systems I have tested.

Change-Id: I2361502560b96b5878f7f94a8e8a215350d70d64
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@gmail.com>
9181a5dcfe69199415c7aebf93524cc3dd6f8a6f 13-Aug-2012 Evgeniy Stepanov <eugenis@google.com> Fix module constructor order.

.preinit_array goes before the constructors of LD_PRELOAD-ed libraries.

Change-Id: I1af32ce29eaf3ca4351ae8a0f7f5da5165853216
5135b3ae6ebc460418f7917bd36b368340e48d5a 11-Aug-2012 Nick Kralevich <nnk@google.com> linker: don't perform unnecessary mprotects

The linker only needs to mark the text segment as
writable iff the file has text relocations. Unnecessarily
calling mprotect when it isn't necessary is slow, and some
security enhanced kernels don't like it. Pages which are
simultaneously writable and executable are considered a no-no.

The vast majority of executables / shared libraries on Android
do NOT have text relocations.

Change-Id: Ic38ce30a99b7e33ecf21efd9c108547a58eafa35
06f0e74a2b957db93fed3fdd49fe939ab2fe1595 11-Aug-2012 Ben Cheng <bccheng@google.com> Set the dynamic field in the link map for the linker itself.

Otherwise gdb will print a spurious warning each time gdb is used:

warning: .dynamic section for "/system/bin/linker" is not at the expected
address (wrong library or version mismatch?)

BUG:6946614
Change-Id: Ib21b8db0615751189c1601140deb43bc089289b6
4688279db5dcc4004941e7f133c4a1c3617d842c 04-Aug-2012 Elliott Hughes <enh@google.com> Clean up the linker a bit, remove prelinking support.

Also make the errors more readable, since none of us seemed to know
what they actually meant. The new style is still as verbose as the
old, but that's probably necessary in the absence of chained exceptions
in C. Here's what you'd see if you try to boot after removing
libsurfaceflinger.so:

32267 32267 E AndroidRuntime: java.lang.UnsatisfiedLinkError: Cannot load library: (linker.c:1629, pid 32259) soinfo_link_image: could not load library "libsystem_server.so" needed by "libandroid_servers.so"; caused by (linker.c:1629, pid 32259) soinfo_link_image: could not load library "libsurfaceflinger.so" needed by "libsystem_server.so"; caused by (linker.c:709, pid 32259) load_library: library "libsurfaceflinger.so" not found

This patch also fixes almost all of the compiler warnings.

Change-Id: I64bb59aed6d4e039c15ea45be2367f319ef879f8