Skip to content

Commit

Permalink
Switch to gold linker on android x86, x86_64, arm
Browse files Browse the repository at this point in the history
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%.

Differential revision: http://reviews.llvm.org/D15379

llvm-svn: 255240
  • Loading branch information
Tamas Berghammer committed Dec 10, 2015
1 parent 8b59062 commit 7b93d66
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lldb/cmake/platforms/Android.cmake
Expand Up @@ -121,6 +121,13 @@ elseif( ANDROID_ABI STREQUAL "mips" )
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
Expand Down

0 comments on commit 7b93d66

Please sign in to comment.