labath created this revision. labath added a reviewer: zturner. labath added a subscriber: lldb-commits.
The dependencies of our libraries (only liblldb, really) we marked as public, which caused all their dependencies to be repeated when linking any executables to them. This is a problem because then all the .a files would be linked twice, once to liblldb and once again to lldb. I am not sure why, but for some reason this only surfaced when doing a LLVM_LINK_LLVM_DYLIB=ON build, where we ended having two copies of some symbols and different parts of code referring to different copies. Setting the dependencies as private required a fixup of the argdumper link command, as it was not actually linking to liblldb (it was referring to symbols from the lldb_private namespace, which are not exposed in liblldb), but rather to the individual component libraries (where these symbols are still available). Since these symbols are now not added to the command line as dependencies of liblldb, I needed to add them explicitly. http://reviews.llvm.org/D16293 Files: cmake/modules/AddLLDB.cmake tools/argdumper/CMakeLists.txt Index: tools/argdumper/CMakeLists.txt =================================================================== --- tools/argdumper/CMakeLists.txt +++ tools/argdumper/CMakeLists.txt @@ -1,8 +1,16 @@ +include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake) + add_lldb_executable(lldb-argdumper argdumper.cpp ) -target_link_libraries(lldb-argdumper liblldb) +if (LLDB_LINKER_SUPPORTS_GROUPS) + target_link_libraries(lldb-argdumper -Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group) +else() + target_link_libraries(lldb-argdumper ${LLDB_USED_LIBS}) +endif() +llvm_config(lldb-argdumper ${LLVM_LINK_COMPONENTS}) + install(TARGETS lldb-argdumper RUNTIME DESTINATION bin) Index: cmake/modules/AddLLDB.cmake =================================================================== --- cmake/modules/AddLLDB.cmake +++ cmake/modules/AddLLDB.cmake @@ -4,7 +4,7 @@ endif() if(${targetkind} MATCHES "SHARED") - set(LINK_KEYWORD ${cmake_2_8_12_PUBLIC}) + set(LINK_KEYWORD ${cmake_2_8_12_PRIVATE}) endif() if(${targetkind} MATCHES "SHARED" OR ${targetkind} MATCHES "EXE") @@ -62,10 +62,10 @@ if (PARAM_SHARED) if (LLDB_LINKER_SUPPORTS_GROUPS) - target_link_libraries(${name} ${cmake_2_8_12_PUBLIC} + target_link_libraries(${name} ${cmake_2_8_12_PRIVATE} -Wl,--start-group ${CLANG_USED_LIBS} -Wl,--end-group) else() - target_link_libraries(${name} ${cmake_2_8_12_PUBLIC} ${CLANG_USED_LIBS}) + target_link_libraries(${name} ${cmake_2_8_12_PRIVATE} ${CLANG_USED_LIBS}) endif() endif() llvm_config(${name} ${LLVM_LINK_COMPONENTS})
Index: tools/argdumper/CMakeLists.txt =================================================================== --- tools/argdumper/CMakeLists.txt +++ tools/argdumper/CMakeLists.txt @@ -1,8 +1,16 @@ +include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake) + add_lldb_executable(lldb-argdumper argdumper.cpp ) -target_link_libraries(lldb-argdumper liblldb) +if (LLDB_LINKER_SUPPORTS_GROUPS) + target_link_libraries(lldb-argdumper -Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group) +else() + target_link_libraries(lldb-argdumper ${LLDB_USED_LIBS}) +endif() +llvm_config(lldb-argdumper ${LLVM_LINK_COMPONENTS}) + install(TARGETS lldb-argdumper RUNTIME DESTINATION bin) Index: cmake/modules/AddLLDB.cmake =================================================================== --- cmake/modules/AddLLDB.cmake +++ cmake/modules/AddLLDB.cmake @@ -4,7 +4,7 @@ endif() if(${targetkind} MATCHES "SHARED") - set(LINK_KEYWORD ${cmake_2_8_12_PUBLIC}) + set(LINK_KEYWORD ${cmake_2_8_12_PRIVATE}) endif() if(${targetkind} MATCHES "SHARED" OR ${targetkind} MATCHES "EXE") @@ -62,10 +62,10 @@ if (PARAM_SHARED) if (LLDB_LINKER_SUPPORTS_GROUPS) - target_link_libraries(${name} ${cmake_2_8_12_PUBLIC} + target_link_libraries(${name} ${cmake_2_8_12_PRIVATE} -Wl,--start-group ${CLANG_USED_LIBS} -Wl,--end-group) else() - target_link_libraries(${name} ${cmake_2_8_12_PUBLIC} ${CLANG_USED_LIBS}) + target_link_libraries(${name} ${cmake_2_8_12_PRIVATE} ${CLANG_USED_LIBS}) endif() endif() llvm_config(${name} ${LLVM_LINK_COMPONENTS})
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits