From d89ce40d8e6b4a6a8074a6fddca9570abbfa4b9d Mon Sep 17 00:00:00 2001 From: Nick Kralevich Date: Wed, 16 Jan 2013 16:43:15 -0800 Subject: [PATCH] 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 --- linker/Android.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linker/Android.mk b/linker/Android.mk index 5fccf9bfa..c85b09ebd 100644 --- a/linker/Android.mk +++ b/linker/Android.mk @@ -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 \