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
diff --git a/linker/Android.mk b/linker/Android.mk
index d207f95..b519976 100644
--- a/linker/Android.mk
+++ b/linker/Android.mk
@@ -3,13 +3,13 @@
 
 LOCAL_SRC_FILES:= \
 	arch/$(TARGET_ARCH)/begin.S \
-	linker.c \
+	debugger.c \
+	dlfcn.c \
+	linker.cpp \
 	linker_environ.c \
 	linker_format.c \
 	linker_phdr.c \
-	rt.c \
-	dlfcn.c \
-	debugger.c
+	rt.c
 
 LOCAL_LDFLAGS := -shared
 
@@ -23,15 +23,14 @@
 #
 LOCAL_CFLAGS += -DLINKER_DEBUG=0
 
-# we need to access the Bionic private header <bionic_tls.h>
-# in the linker; duplicate the HAVE_ARM_TLS_REGISTER definition
-# from the libc build
+# We need to access Bionic private headers in the linker...
+LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/
+
+# ...one of which is <private/bionic_tls.h>, for which we
+# need HAVE_ARM_TLS_REGISTER.
 ifeq ($(TARGET_ARCH)-$(ARCH_ARM_HAVE_TLS_REGISTER),arm-true)
     LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
 endif
-LOCAL_CFLAGS += \
-    -I$(LOCAL_PATH)/../libc/private \
-    -I$(LOCAL_PATH)/../libc/arch-$(TARGET_ARCH)/bionic
 
 ifeq ($(TARGET_ARCH),arm)
     LOCAL_CFLAGS += -DANDROID_ARM_LINKER