[llvm-branch-commits] [lldb] r311377 - Merging r311122, r311354 and r311355:
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Aug 21 13:21:43 PDT 2017
Author: hans
Date: Mon Aug 21 13:21:43 2017
New Revision: 311377
URL: http://llvm.org/viewvc/llvm-project?rev=311377&view=rev
Log:
Merging r311122, r311354 and r311355:
------------------------------------------------------------------------
r311122 | mgorny | 2017-08-17 13:33:21 -0700 (Thu, 17 Aug 2017) | 20 lines
[cmake] Add explicit linkage from Core to curses
The Core library calls functions provided by the curses library. Add
an appropriate explicit LINK_LIBS to ${CURSES_LIBRARIES} to propagate
the dependency correctly within the build system.
It seems that so far the linkage was handled by some kind of implicit
magic LLDB_SYSTEM_LIBS variable. However, it stopped working for
unittests as the curses libraries are passed before the LLDBCore
library, resulting in `-Wl,--as-needed` stripping the yet-unused library
before it is required by LLDBCore, and effectively breaking the build.
I think it's better to focus on listing all the dependencies explicitly
and let CMake propagate them rather than trying to figure out why this
hack stopped working.
This is also more consistent with LLVM where the curses linkage
in LLVMSupport is expressed directly in the library rather than deferred
to the final programs.
Differential Revision: https://reviews.llvm.org/D36358
------------------------------------------------------------------------
------------------------------------------------------------------------
r311354 | mgorny | 2017-08-21 10:41:33 -0700 (Mon, 21 Aug 2017) | 19 lines
[cmake] Explicitly link dependency libraries in the Host library
Add explicit linkage to the necessary system libraries in the Host
library. Otherwise, the library fails to build with -Wl,--as-needed.
The system libraries ended up being listed on the linker command-line
before the static libraries needing them, resulting in --as-needed
stripping them.
Listing the dependent libraries explicitly is the canonical way of
declaring libraries in CMake. It guarantees that the system library
dependencies will be correctly propagated to reverse dependencies.
The code used to link libraries reuses existing EXTRA_LIBS variable,
copying code from other parts of LLDB. We might eventually remove
the direct use of system libraries in the programs; however, I would
prefer if we focused on fixing the build regressions in 5.0 branch
first, and went further after the release.
Differential Revision: https://reviews.llvm.org/D36885
------------------------------------------------------------------------
------------------------------------------------------------------------
r311355 | mgorny | 2017-08-21 10:41:39 -0700 (Mon, 21 Aug 2017) | 10 lines
[unittests] Build LLVMTestingSupport for out-of-source builds
The Process/gdb-remote test now requires the LLVMTestingSupport library
that is not installed by LLVM. As a result, when doing an out-of-source
build it fails being unable to find the library. To solve that, build
a local copy of the library when building LLDB with unittests and LLVM
sources available. This is based on how we deal with bundled gtest
sources.
Differential Revision: https://reviews.llvm.org/D36886
------------------------------------------------------------------------
Modified:
lldb/branches/release_50/ (props changed)
lldb/branches/release_50/source/Core/CMakeLists.txt
lldb/branches/release_50/source/Host/CMakeLists.txt
lldb/branches/release_50/unittests/CMakeLists.txt
Propchange: lldb/branches/release_50/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Aug 21 13:21:43 2017
@@ -1,2 +1,3 @@
/lldb/branches/apple/python-GIL:156467-162159
/lldb/branches/iohandler:198360-200250
+/lldb/trunk:311122,311354-311355
Modified: lldb/branches/release_50/source/Core/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/release_50/source/Core/CMakeLists.txt?rev=311377&r1=311376&r2=311377&view=diff
==============================================================================
--- lldb/branches/release_50/source/Core/CMakeLists.txt (original)
+++ lldb/branches/release_50/source/Core/CMakeLists.txt Mon Aug 21 13:21:43 2017
@@ -1,3 +1,12 @@
+set(LLDB_CURSES_LIBS)
+
+if (NOT LLDB_DISABLE_CURSES)
+ list(APPEND LLDB_CURSES_LIBS ${CURSES_LIBRARIES})
+ if(LLVM_ENABLE_TERMINFO AND HAVE_TERMINFO)
+ list(APPEND LLDB_CURSES_LIBS ${TERMINFO_LIBS})
+ endif()
+endif()
+
add_lldb_library(lldbCore
Address.cpp
AddressRange.cpp
@@ -62,6 +71,7 @@ add_lldb_library(lldbCore
lldbPluginCPlusPlusLanguage
lldbPluginObjCLanguage
lldbPluginObjectFileJIT
+ ${LLDB_CURSES_LIBS}
LINK_COMPONENTS
BinaryFormat
Modified: lldb/branches/release_50/source/Host/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/release_50/source/Host/CMakeLists.txt?rev=311377&r1=311376&r2=311377&view=diff
==============================================================================
--- lldb/branches/release_50/source/Host/CMakeLists.txt (original)
+++ lldb/branches/release_50/source/Host/CMakeLists.txt Mon Aug 21 13:21:43 2017
@@ -156,9 +156,23 @@ if (${get_python_libdir})
endif()
endif()
+set(EXTRA_LIBS)
if (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
- set(EXTRA_LIBS kvm)
+ list(APPEND EXTRA_LIBS kvm)
endif ()
+if (APPLE)
+ list(APPEND EXTRA_LIBS xml2)
+else ()
+ if (LIBXML2_FOUND)
+ list(APPEND EXTRA_LIBS ${LIBXML2_LIBRARIES})
+ endif()
+endif ()
+if (HAVE_LIBDL)
+ list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS})
+endif()
+if (NOT LLDB_DISABLE_LIBEDIT)
+ list(APPEND EXTRA_LIBS edit)
+endif()
add_lldb_library(lldbHost
${HOST_SOURCES}
Modified: lldb/branches/release_50/unittests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/release_50/unittests/CMakeLists.txt?rev=311377&r1=311376&r2=311377&view=diff
==============================================================================
--- lldb/branches/release_50/unittests/CMakeLists.txt (original)
+++ lldb/branches/release_50/unittests/CMakeLists.txt Mon Aug 21 13:21:43 2017
@@ -19,6 +19,12 @@ if (LLDB_BUILT_STANDALONE)
if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest AND NOT TARGET gtest)
add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/unittest utils/unittest)
endif()
+ # LLVMTestingSupport library is needed for Process/gdb-remote.
+ if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
+ AND NOT TARGET LLVMTestingSupport)
+ add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
+ lib/Testing/Support)
+ endif()
endif()
function(add_lldb_unittest test_name)
More information about the llvm-branch-commits
mailing list