linker: add -Wl,--exclude-libs,ALL to LDFLAGS

The linker is essentially a shared library, and incorporates
it's own copy of libc. Even though it's unnecessary, currently
/system/bin/linker is exporting various libc symbols (only to
apps which explicitly dlopen /system/bin/linker)

Add --exclude-libs,ALL, which tells the static linker to mark
all of the imported libc symbols as hidden. This reduces the
size of /system/bin/linker from 92K to 67K with no obvious
loss in functionality.

  $ adb shell ls -l /system/bin/linker
  -rwxrwxrwx root     root        92260 2013-01-16 16:52 linker

  $ adb shell ls -l /system/bin/linker
  -rwxrwxrwx root     root        67660 2013-01-16 16:49 linker

Documentation on exclude-libs can be found at
http://sourceware.org/binutils/docs-2.21/ld/Options.html

Change-Id: I4508287770e4b7a845def2e6b4af969f9c866c6a
This commit is contained in:
Nick Kralevich 2013-01-16 16:43:15 -08:00
parent 1271cdc1c9
commit d89ce40d8e

View File

@ -17,7 +17,7 @@ LOCAL_SRC_FILES:= \
linker_phdr.cpp \
rt.cpp
LOCAL_LDFLAGS := -shared
LOCAL_LDFLAGS := -shared -Wl,--exclude-libs,ALL
LOCAL_CFLAGS += -fno-stack-protector \
-Wstrict-overflow=5 \