summaryrefslogtreecommitdiffstats
path: root/lldb/cmake/platforms/Android.cmake
diff options
context:
space:
mode:
authorChaoren Lin <chaorenl@google.com>2015-07-18 01:09:43 +0000
committerChaoren Lin <chaorenl@google.com>2015-07-18 01:09:43 +0000
commit857a43c70a95efbb76b5d90e38e166cf802507a5 (patch)
treec7770b702b0892f737fce2b166ab980607dac29e /lldb/cmake/platforms/Android.cmake
parente9bbabcc69dd3b6a5f9629635ceb0968bd43f44d (diff)
downloadbcm5719-llvm-857a43c70a95efbb76b5d90e38e166cf802507a5.tar.gz
bcm5719-llvm-857a43c70a95efbb76b5d90e38e166cf802507a5.zip
Add evil hack to workaround the missing libdl.a in the Android toolchain.
Reviewers: vharron, ovyalov Subscribers: tberghammer, danalbert, srhines, lldb-commits Differential Revision: http://reviews.llvm.org/D11321 llvm-svn: 242599
Diffstat (limited to 'lldb/cmake/platforms/Android.cmake')
-rw-r--r--lldb/cmake/platforms/Android.cmake19
1 files changed, 19 insertions, 0 deletions
diff --git a/lldb/cmake/platforms/Android.cmake b/lldb/cmake/platforms/Android.cmake
index df735612d8b..b3a136156e3 100644
--- a/lldb/cmake/platforms/Android.cmake
+++ b/lldb/cmake/platforms/Android.cmake
@@ -119,6 +119,25 @@ endif()
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fdata-sections -ffunction-sections" )
set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,--gc-sections" )
+################# BEGIN EVIL HACK ##################
+# lldb-server links against libdl even though it's not being used and
+# libdl.a is currently missing from the toolchain (b.android.com/178517).
+# Therefore, in order to statically link lldb-server, we need a temporary
+# workaround. This creates a dummy libdl.a stub until the actual
+# libdl.a can be implemented in the toolchain.
+set( ANDROID_LIBDL_STUB "${CMAKE_BINARY_DIR}/libdl_stub" )
+file( MAKE_DIRECTORY ${ANDROID_LIBDL_STUB} )
+file( WRITE "${ANDROID_LIBDL_STUB}/libdl.c" "
+#include <dlfcn.h>
+void * dlopen (const char *filename, int flag) { return 0; }
+const char * dlerror (void) { return 0; }
+void * dlsym (void *handle, const char *symbol) { return 0; }
+int dlclose (void *handle) { return 0; }")
+execute_process( COMMAND ${CMAKE_C_COMPILER} -c ${ANDROID_LIBDL_STUB}/libdl.c -o ${ANDROID_LIBDL_STUB}/libdl.o )
+execute_process( COMMAND ${CMAKE_AR} rcs ${ANDROID_LIBDL_STUB}/libdl.a ${ANDROID_LIBDL_STUB}/libdl.o )
+set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -L${ANDROID_LIBDL_STUB}" )
+################# END EVIL HACK ##################
+
# cache flags
set( CMAKE_CXX_FLAGS "" CACHE STRING "c++ flags" )
set( CMAKE_C_FLAGS "" CACHE STRING "c flags" )
OpenPOWER on IntegriCloud