[Lldb-commits] [PATCH] D15379: Switch to gold linker on android x86, x86_64, arm

Tamas Berghammer via lldb-commits lldb-commits at lists.llvm.org
Wed Dec 9 06:57:14 PST 2015


tberghammer created this revision.
tberghammer added reviewers: labath, ovyalov.
tberghammer added a subscriber: lldb-commits.
Herald added subscribers: srhines, danalbert, tberghammer, rengolin, aemerson.

Switch to gold linker on android x86, x86_64, arm

These architectures already using the gold linker for the android framework and switching to gold gives us the opportunity to enable ICF.
Safe ICF (identical code folding) reduces the size of an optimized and striped binary by ~5%

http://reviews.llvm.org/D15379

Files:
  cmake/platforms/Android.cmake

Index: cmake/platforms/Android.cmake
===================================================================
--- cmake/platforms/Android.cmake
+++ cmake/platforms/Android.cmake
@@ -121,6 +121,13 @@
  endif()
 endif()
 
+# Use gold linker and enable safe ICF in case of x86, x86_64 and arm
+if ( ANDROID_ABI STREQUAL "x86"    OR
+     ANDROID_ABI STREQUAL "x86_64" OR
+     ANDROID_ABI STREQUAL "armeabi")
+ set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -fuse-ld=gold -Wl,--icf=safe" )
+endif()
+
 if( NOT LLVM_BUILD_STATIC )
  # PIE is required for API 21+ so we enable it if we're not statically linking
  # unfortunately, it is not supported before API 16 so we need to do something


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15379.42295.patch
Type: text/x-patch
Size: 686 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151209/0e43e898/attachment.bin>


More information about the lldb-commits mailing list