[Lldb-commits] [lldb] r242525 - Fix liblldb linking on RHEL 6 (bug #24140)

Pavel Labath labath at google.com
Fri Jul 17 08:26:27 PDT 2015


Author: labath
Date: Fri Jul 17 10:26:27 2015
New Revision: 242525

URL: http://llvm.org/viewvc/llvm-project?rev=242525&view=rev
Log:
Fix liblldb linking on RHEL 6 (bug #24140)

Patch by Eugene Zelenko.

Modified:
    lldb/trunk/cmake/modules/AddLLDB.cmake
    lldb/trunk/cmake/modules/LLDBConfig.cmake
    lldb/trunk/tools/lldb-server/CMakeLists.txt

Modified: lldb/trunk/cmake/modules/AddLLDB.cmake
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/AddLLDB.cmake?rev=242525&r1=242524&r2=242525&view=diff
==============================================================================
--- lldb/trunk/cmake/modules/AddLLDB.cmake (original)
+++ lldb/trunk/cmake/modules/AddLLDB.cmake Fri Jul 17 10:26:27 2015
@@ -3,18 +3,12 @@ function(lldb_link_common_libs name targ
     return()
   endif()
 
-  set(COMPILER_SUPPORTS_GROUPS OFF)
-  if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
-    # The Darwin linker doesn't understand --start-group/--end-group.
-    set(COMPILER_SUPPORTS_GROUPS ON)
-  endif()
-
   if(${targetkind} MATCHES "SHARED")
     set(LINK_KEYWORD ${cmake_2_8_12_PUBLIC})
   endif()
-  
+
   if(${targetkind} MATCHES "SHARED" OR ${targetkind} MATCHES "EXE")
-    if (COMPILER_SUPPORTS_GROUPS)
+    if (LLDB_LINKER_SUPPORTS_GROUPS)
       target_link_libraries(${name} ${LINK_KEYWORD}
                             -Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group)
     else()
@@ -24,7 +18,7 @@ function(lldb_link_common_libs name targ
 endfunction(lldb_link_common_libs)
 
 macro(add_lldb_library name)
-  # only supported parameters to this macro are the optional 
+  # only supported parameters to this macro are the optional
   # MODULE;SHARED;STATIC library type and source files
   cmake_parse_arguments(PARAM
     "MODULE;SHARED;STATIC;OBJECT"
@@ -66,13 +60,13 @@ macro(add_lldb_library name)
 
     lldb_link_common_libs(${name} "${libkind}")
 
-    
-    target_link_libraries(${name})
-    if (COMPILER_SUPPORTS_GROUPS)
+    if (PARAM_SHARED)
+      if (LLDB_LINKER_SUPPORTS_GROUPS)
         target_link_libraries(${name} ${cmake_2_8_12_PUBLIC}
                     -Wl,--start-group ${CLANG_USED_LIBS} -Wl,--end-group)
-    else()
+      else()
         target_link_libraries(${name} ${cmake_2_8_12_PUBLIC} ${CLANG_USED_LIBS})
+      endif()
     endif()
     llvm_config(${name} ${LLVM_LINK_COMPONENTS})
 

Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=242525&r1=242524&r2=242525&view=diff
==============================================================================
--- lldb/trunk/cmake/modules/LLDBConfig.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake Fri Jul 17 10:26:27 2015
@@ -2,6 +2,12 @@ set(LLDB_PROJECT_ROOT ${CMAKE_CURRENT_SO
 set(LLDB_SOURCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/source")
 set(LLDB_INCLUDE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/include")
 
+set(LLDB_LINKER_SUPPORTS_GROUPS OFF)
+if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
+  # The Darwin linker doesn't understand --start-group/--end-group.
+  set(LLDB_LINKER_SUPPORTS_GROUPS ON)
+endif()
+
 if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
   set(LLDB_DEFAULT_DISABLE_PYTHON 0)
   set(LLDB_DEFAULT_DISABLE_CURSES 1)
@@ -21,7 +27,7 @@ set(LLDB_DISABLE_CURSES ${LLDB_DEFAULT_D
   "Disables the Curses integration.")
 
 set(LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION 1 CACHE BOOL
-  "Enables using new Python scripts for SWIG API generation .")  
+  "Enables using new Python scripts for SWIG API generation .")
 set(LLDB_RELOCATABLE_PYTHON 0 CACHE BOOL
   "Causes LLDB to use the PYTHONHOME environment variable to locate Python.")
 
@@ -40,7 +46,7 @@ if (NOT LLDB_DISABLE_PYTHON)
       set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
     endif()
   endif()
-  
+
   if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
     if (NOT "${PYTHON_HOME}" STREQUAL "")
       file(TO_CMAKE_PATH "${PYTHON_HOME}" PYTHON_HOME)
@@ -53,26 +59,26 @@ if (NOT LLDB_DISABLE_PYTHON)
         file(TO_CMAKE_PATH "${PYTHON_HOME}/libs/python27.lib" PYTHON_LIBRARY)
         file(TO_CMAKE_PATH "${PYTHON_HOME}/python27.dll" PYTHON_DLL)
       endif()
-      
+
       file(TO_CMAKE_PATH "${PYTHON_HOME}/Include" PYTHON_INCLUDE_DIR)
       if (NOT LLDB_RELOCATABLE_PYTHON)
         add_definitions( -DLLDB_PYTHON_HOME="${PYTHON_HOME}" )
       endif()
     else()
       message("Embedding Python on Windows without specifying a value for PYTHON_HOME is deprecated.  Support for this will be dropped soon.")
-        
+
       if ("${PYTHON_INCLUDE_DIR}" STREQUAL "" OR "${PYTHON_LIBRARY}" STREQUAL "")
         message("-- LLDB Embedded python disabled.  Embedding python on Windows requires "
                 "manually specifying PYTHON_INCLUDE_DIR *and* PYTHON_LIBRARY")
         set(LLDB_DISABLE_PYTHON 1)
       endif()
     endif()
-    
+
     if (PYTHON_LIBRARY)
       message("-- Found PythonLibs: ${PYTHON_LIBRARY}")
       include_directories(${PYTHON_INCLUDE_DIR})
     endif()
-    
+
   else()
     find_package(PythonLibs REQUIRED)
     include_directories(${PYTHON_INCLUDE_DIRS})
@@ -118,7 +124,7 @@ if( MSVC )
     -wd4521 # Suppress 'warning C4521: 'type' : multiple copy constructors specified'
     -wd4530 # Suppress 'warning C4530: C++ exception handler used, but unwind semantics are not enabled.'
   )
-endif() 
+endif()
 
 set(LLDB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
 set(LLDB_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})

Modified: lldb/trunk/tools/lldb-server/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/CMakeLists.txt?rev=242525&r1=242524&r2=242525&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-server/CMakeLists.txt (original)
+++ lldb/trunk/tools/lldb-server/CMakeLists.txt Fri Jul 17 10:26:27 2015
@@ -42,7 +42,7 @@ else()
     )
 
   # The Darwin linker doesn't understand --start-group/--end-group.
-  if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
+  if (LLDB_LINKER_SUPPORTS_GROUPS)
     target_link_libraries(lldb-server
                           -Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group)
     target_link_libraries(lldb-server





More information about the lldb-commits mailing list