Re-landing r242318 after buildbot update.

llvm-svn: 242488
This commit is contained in:
Chaoren Lin 2015-07-16 23:45:08 +00:00
parent 7feaf7c60b
commit 109ef8cf6b
2 changed files with 21 additions and 5 deletions

View File

@ -155,7 +155,12 @@ endif()
list(APPEND LLDB_SYSTEM_LIBS ${system_libs})
if (LLVM_BUILD_STATIC)
list(APPEND LLDB_SYSTEM_LIBS python2.7 z util termcap gpm ssl crypto bsd)
if (NOT LLDB_DISABLE_PYTHON)
list(APPEND LLDB_SYSTEM_LIBS python2.7 util)
endif()
if (NOT LLDB_DISABLE_CURSES)
list(APPEND LLDB_SYSTEM_LIBS gpm)
endif()
endif()
set( LLVM_LINK_COMPONENTS

View File

@ -38,6 +38,15 @@ add_definitions( -DANDROID -D__ANDROID_NDK__ -DLLDB_DISABLE_LIBEDIT )
set( ANDROID True )
set( __ANDROID_NDK__ True )
# linking lldb-server statically for Android avoids the need to ship two
# binaries (pie for API 21+ and non-pie for API 14-). It's possible to use
# a non-pie shim on API 14-, but that requires lldb-server to dynamically export
# its symbols, which significantly increases the binary size. Static linking, on
# the other hand, has little to no effect on the binary size.
if ( NOT DEFINED LLVM_BUILD_STATIC )
set( LLVM_BUILD_STATIC True )
endif()
set( ANDROID_ABI "${ANDROID_ABI}" CACHE INTERNAL "Android Abi" FORCE )
if( ANDROID_ABI STREQUAL "x86" )
set( CMAKE_SYSTEM_PROCESSOR "i686" )
@ -99,10 +108,12 @@ elseif( ANDROID_ABI STREQUAL "armeabi" )
endif()
endif()
# PIE is required for API 21+ so we enable it
# unfortunately, it is not supported before API 14 so we need to do something else there
# see http://llvm.org/pr23457
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -pie -fPIE" )
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 14 so we need to do something else there
# see http://llvm.org/pr23457
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -pie -fPIE" )
endif()
# linker flags
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fdata-sections -ffunction-sections" )