[Lldb-commits] [PATCH] D16678: Fix linking of lldb-server with BUILD_SHARED_LIBS

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 28 03:18:08 PST 2016


labath created this revision.
labath added reviewers: zturner, tfiala.
labath added a subscriber: lldb-commits.

The BUILD_SHARED_LIBS branch of lldb-server link flags was hopelessly broken, at least since we
started restricting the symbols exported by liblldb. lldb-server depends on symbols from the
lldb_private namespace, so it cannot link to the public interface of liblldb. Instead I make it
link to the individual libraries constituting liblldb, just like it does in the
!BUILD_SHARED_LIBS case.

This does not make the BUILD_SHARED_LIBS build of lldb fully functional yet, due to the way
liblldb dependencies are managed, but it's a step in that direction.

http://reviews.llvm.org/D16678

Files:
  tools/lldb-server/CMakeLists.txt

Index: tools/lldb-server/CMakeLists.txt
===================================================================
--- tools/lldb-server/CMakeLists.txt
+++ tools/lldb-server/CMakeLists.txt
@@ -33,24 +33,19 @@
     LLDBServerUtilities.cpp
 )
 
-if (BUILD_SHARED_LIBS )
-  target_link_libraries(lldb-server liblldb)
-  target_link_libraries(lldb-server ${LLDB_SYSTEM_LIBS})
+# The Darwin linker doesn't understand --start-group/--end-group.
+if (LLDB_LINKER_SUPPORTS_GROUPS)
+  target_link_libraries(lldb-server
+                        -Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group)
+  target_link_libraries(lldb-server
+                        -Wl,--start-group ${CLANG_USED_LIBS} -Wl,--end-group)
 else()
-  # The Darwin linker doesn't understand --start-group/--end-group.
-  if (LLDB_LINKER_SUPPORTS_GROUPS)
-    target_link_libraries(lldb-server
-                          -Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group)
-    target_link_libraries(lldb-server
-                          -Wl,--start-group ${CLANG_USED_LIBS} -Wl,--end-group)
-  else()
-    target_link_libraries(lldb-server ${LLDB_USED_LIBS})
-    target_link_libraries(lldb-server ${CLANG_USED_LIBS})
-  endif()
-  llvm_config(lldb-server ${LLVM_LINK_COMPONENTS})
-
-  target_link_libraries(lldb-server ${LLDB_SYSTEM_LIBS})
+  target_link_libraries(lldb-server ${LLDB_USED_LIBS})
+  target_link_libraries(lldb-server ${CLANG_USED_LIBS})
 endif()
+llvm_config(lldb-server ${LLVM_LINK_COMPONENTS})
+
+target_link_libraries(lldb-server ${LLDB_SYSTEM_LIBS})
 
 set_target_properties(lldb-server PROPERTIES VERSION ${LLDB_VERSION})
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16678.46254.patch
Type: text/x-patch
Size: 1604 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160128/5751b21d/attachment.bin>


More information about the lldb-commits mailing list