forked from OSchip/llvm-project
Fixes compilation/run error with BUILD_SHARED_LIBS=TRUE
BUILD_SHARED_LIBS=TRUE currently isn't working for Linux x86_64 This patch fixes the link errors and also some runtime errors Test Plan: CC=clang CXX=clang++ cmake -GNinja -DBUILD_SHARED_LIBS=TRUE -DCMAKE_LINKER=ld.gold -DCMAKE_BUILD_TYPE=Debug ../../llvm ninja ninja check-lldb llvm-svn: 226039
This commit is contained in:
parent
fad1639a12
commit
4d2857321d
|
@ -236,7 +236,15 @@ else ()
|
|||
endif ()
|
||||
|
||||
macro(add_lldb_library name)
|
||||
llvm_process_sources(srcs ${ARGN})
|
||||
# only supported parameters to this macro are the optional
|
||||
# MODULE;SHARED;STATIC library type and source files
|
||||
cmake_parse_arguments(PARAM
|
||||
"MODULE;SHARED;STATIC"
|
||||
""
|
||||
""
|
||||
${ARGN})
|
||||
llvm_process_sources(srcs ${PARAM_UNPARSED_ARGUMENTS})
|
||||
|
||||
if (MSVC_IDE OR XCODE)
|
||||
string(REGEX MATCHALL "/[^/]+" split_path ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
list(GET split_path -1 dir)
|
||||
|
@ -244,13 +252,17 @@ macro(add_lldb_library name)
|
|||
../../include/lldb${dir}/*.h)
|
||||
set(srcs ${srcs} ${headers})
|
||||
endif()
|
||||
if (MODULE)
|
||||
if (PARAM_MODULE)
|
||||
set(libkind MODULE)
|
||||
elseif (SHARED_LIBRARY)
|
||||
elseif (PARAM_SHARED)
|
||||
set(libkind SHARED)
|
||||
else()
|
||||
elseif (PARAM_STATIC)
|
||||
set(libkind STATIC)
|
||||
else ()
|
||||
# library type unspecified - controlled by BUILD_SHARED_LIBS
|
||||
unset(libkind)
|
||||
endif()
|
||||
|
||||
#PIC not needed on Win
|
||||
if (NOT MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
||||
|
|
|
@ -18,14 +18,12 @@ set( LLDB_USED_LIBS
|
|||
lldbPluginDynamicLoaderPosixDYLD
|
||||
lldbPluginDynamicLoaderHexagonDYLD
|
||||
|
||||
lldbPluginObjectFileMachO
|
||||
lldbPluginObjectFileELF
|
||||
lldbPluginObjectFileJIT
|
||||
lldbPluginSymbolVendorELF
|
||||
lldbPluginObjectContainerBSDArchive
|
||||
lldbPluginObjectContainerMachOArchive
|
||||
lldbPluginProcessGDBRemote
|
||||
lldbPluginProcessMachCore
|
||||
lldbPluginProcessUtility
|
||||
lldbPluginPlatformGDB
|
||||
lldbPluginPlatformFreeBSD
|
||||
|
@ -33,7 +31,6 @@ set( LLDB_USED_LIBS
|
|||
lldbPluginPlatformLinux
|
||||
lldbPluginPlatformPOSIX
|
||||
lldbPluginPlatformWindows
|
||||
lldbPluginObjectFileMachO
|
||||
lldbPluginObjectContainerMachOArchive
|
||||
lldbPluginObjectContainerBSDArchive
|
||||
lldbPluginPlatformMacOSX
|
||||
|
@ -106,6 +103,8 @@ if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
|
|||
set_source_files_properties(${LLDB_VERS_GENERATED_FILE} PROPERTIES GENERATED 1)
|
||||
list(APPEND LLDB_USED_LIBS
|
||||
lldbPluginDynamicLoaderDarwinKernel
|
||||
lldbPluginObjectFileMachO
|
||||
lldbPluginProcessMachCore
|
||||
lldbPluginProcessMacOSXKernel
|
||||
lldbPluginSymbolVendorMacOSX
|
||||
lldbPluginSystemRuntimeMacOSX
|
||||
|
@ -165,6 +164,7 @@ set( LLVM_LINK_COMPONENTS
|
|||
mcdisassembler
|
||||
executionengine
|
||||
option
|
||||
support
|
||||
)
|
||||
|
||||
if ( NOT LLDB_DISABLE_PYTHON )
|
||||
|
|
|
@ -30,6 +30,7 @@ endif ()
|
|||
if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows" )
|
||||
add_subdirectory(API)
|
||||
endif ()
|
||||
|
||||
add_subdirectory(Breakpoint)
|
||||
add_subdirectory(Commands)
|
||||
add_subdirectory(Core)
|
||||
|
@ -44,8 +45,6 @@ add_subdirectory(Utility)
|
|||
|
||||
include(../cmake/LLDBDependencies.cmake)
|
||||
|
||||
set(SHARED_LIBRARY 1)
|
||||
|
||||
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
|
||||
add_definitions( -DEXPORT_LIBLLDB )
|
||||
endif()
|
||||
|
@ -56,7 +55,7 @@ if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
|
|||
# On Non-Windows, the corresponding file list is maintained in
|
||||
# source\API\CMakeLists.txt. When editing this list, do not forget to make a
|
||||
# corresponding change in that file as well (when appropriate).
|
||||
add_lldb_library(liblldb
|
||||
add_lldb_library(liblldb SHARED
|
||||
lldb.cpp
|
||||
lldb-log.cpp
|
||||
API/SBAddress.cpp
|
||||
|
|
|
@ -17,26 +17,33 @@ include_directories(../../source)
|
|||
|
||||
include(../../cmake/LLDBDependencies.cmake)
|
||||
|
||||
# have to include lldb and lldb-log files since those are not libraries and llgs depends on them
|
||||
add_lldb_executable(lldb-gdbserver
|
||||
lldb-gdbserver.cpp
|
||||
../../source/lldb-log.cpp
|
||||
../../source/lldb.cpp
|
||||
)
|
||||
if ( BUILD_SHARED_LIBS )
|
||||
add_lldb_executable(lldb-gdbserver
|
||||
lldb-gdbserver.cpp
|
||||
)
|
||||
|
||||
# The Darwin linker doesn't understand --start-group/--end-group.
|
||||
if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
|
||||
target_link_libraries(lldb-gdbserver
|
||||
-Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group)
|
||||
target_link_libraries(lldb-gdbserver liblldb)
|
||||
else()
|
||||
target_link_libraries(lldb-gdbserver ${LLDB_USED_LIBS})
|
||||
endif()
|
||||
target_link_libraries(lldb-gdbserver ${CLANG_USED_LIBS})
|
||||
llvm_config(lldb-gdbserver ${LLVM_LINK_COMPONENTS})
|
||||
# have to include lldb and lldb-log files since those are not libraries and llgs depends on them
|
||||
add_lldb_executable(lldb-gdbserver
|
||||
lldb-gdbserver.cpp
|
||||
../../source/lldb-log.cpp
|
||||
../../source/lldb.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(lldb-gdbserver ${LLDB_SYSTEM_LIBS})
|
||||
# The Darwin linker doesn't understand --start-group/--end-group.
|
||||
if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
|
||||
target_link_libraries(lldb-gdbserver
|
||||
-Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group)
|
||||
else()
|
||||
target_link_libraries(lldb-gdbserver ${LLDB_USED_LIBS})
|
||||
endif()
|
||||
target_link_libraries(lldb-gdbserver ${CLANG_USED_LIBS})
|
||||
llvm_config(lldb-gdbserver ${LLVM_LINK_COMPONENTS})
|
||||
|
||||
target_link_libraries(lldb-gdbserver ${LLDB_SYSTEM_LIBS})
|
||||
endif()
|
||||
|
||||
set_target_properties(lldb-gdbserver PROPERTIES VERSION ${LLDB_VERSION})
|
||||
|
||||
install(TARGETS lldb-gdbserver
|
||||
RUNTIME DESTINATION bin)
|
||||
|
|
|
@ -164,7 +164,7 @@ add_lldb_executable(lldb-mi
|
|||
)
|
||||
endif ()
|
||||
|
||||
target_link_libraries(lldb-mi liblldb)
|
||||
target_link_libraries(lldb-mi liblldb pthread)
|
||||
# TODO: why isn't this done by add_lldb_executable?
|
||||
#target_link_libraries(lldb-mi ${LLDB_USED_LIBS})
|
||||
#llvm_config(lldb-mi ${LLVM_LINK_COMPONENTS})
|
||||
|
|
Loading…
Reference in New Issue