[lld] r291432 - [lld][cmake] Fix LLVM_LINK_LLVM_DYLIB build

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 26 10:15:09 PST 2017


Rui, should we merge this to the release branch?

On Mon, Jan 9, 2017 at 1:57 AM, Pavel Labath via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: labath
> Date: Mon Jan  9 03:57:08 2017
> New Revision: 291432
>
> URL: http://llvm.org/viewvc/llvm-project?rev=291432&view=rev
> Log:
> [lld][cmake] Fix LLVM_LINK_LLVM_DYLIB build
>
> Summary:
> Lld's build had a couple of issues which prevented a successfull
> LLVM_LINK_LLVM_DYLIB compilation.
>
> - add_llvm_library vs llvm_add_library: One adds a library to libLLVM.so, other
>   one doesn't. Lld was using the wrong one, causing symbols to be mupltiply
>   defined in things linking to libLLVM.
> - confusion when to use LINK_LIBS vs LINK_COMPONENTS in llvm_add_library
> - not using LLVM_LINK_COMPONENTS for add_lld_tool
>
> With these fixes lld compiles and it's test suite passes both in
> LLVM_LINK_LLVM_DYLIB mode and without it.
>
> Reviewers: ruiu, beanz
>
> Subscribers: llvm-commits, mgorny
>
> Differential Revision: https://reviews.llvm.org/D28397
>
> Modified:
>     lld/trunk/cmake/modules/AddLLD.cmake
>     lld/trunk/lib/Config/CMakeLists.txt
>     lld/trunk/lib/Core/CMakeLists.txt
>     lld/trunk/lib/Driver/CMakeLists.txt
>     lld/trunk/lib/ReaderWriter/CMakeLists.txt
>     lld/trunk/lib/ReaderWriter/MachO/CMakeLists.txt
>     lld/trunk/lib/ReaderWriter/YAML/CMakeLists.txt
>     lld/trunk/tools/lld/CMakeLists.txt
>
> Modified: lld/trunk/cmake/modules/AddLLD.cmake
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/cmake/modules/AddLLD.cmake?rev=291432&r1=291431&r2=291432&view=diff
> ==============================================================================
> --- lld/trunk/cmake/modules/AddLLD.cmake (original)
> +++ lld/trunk/cmake/modules/AddLLD.cmake Mon Jan  9 03:57:08 2017
> @@ -1,5 +1,5 @@
>  macro(add_lld_library name)
> -  add_llvm_library(${name} ${ARGN})
> +  llvm_add_library(${name} ${ARGN})
>    set_target_properties(${name} PROPERTIES FOLDER "lld libraries")
>  endmacro(add_lld_library)
>
>
> Modified: lld/trunk/lib/Config/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Config/CMakeLists.txt?rev=291432&r1=291431&r2=291432&view=diff
> ==============================================================================
> --- lld/trunk/lib/Config/CMakeLists.txt (original)
> +++ lld/trunk/lib/Config/CMakeLists.txt Mon Jan  9 03:57:08 2017
> @@ -4,6 +4,6 @@ add_lld_library(lldConfig
>    ADDITIONAL_HEADER_DIRS
>    ${LLD_INCLUDE_DIR}/lld/Config
>
> -  LINK_LIBS
> -    LLVMSupport
> +  LINK_COMPONENTS
> +    Support
>    )
>
> Modified: lld/trunk/lib/Core/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/CMakeLists.txt?rev=291432&r1=291431&r2=291432&view=diff
> ==============================================================================
> --- lld/trunk/lib/Core/CMakeLists.txt (original)
> +++ lld/trunk/lib/Core/CMakeLists.txt Mon Jan  9 03:57:08 2017
> @@ -12,6 +12,6 @@ add_lld_library(lldCore
>    ADDITIONAL_HEADER_DIRS
>    ${LLD_INCLUDE_DIR}/lld/Core
>
> -  LINK_LIBS
> -    LLVMSupport
> +  LINK_COMPONENTS
> +    Support
>    )
>
> Modified: lld/trunk/lib/Driver/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/CMakeLists.txt?rev=291432&r1=291431&r2=291432&view=diff
> ==============================================================================
> --- lld/trunk/lib/Driver/CMakeLists.txt (original)
> +++ lld/trunk/lib/Driver/CMakeLists.txt Mon Jan  9 03:57:08 2017
> @@ -8,15 +8,17 @@ add_lld_library(lldDriver
>    ADDITIONAL_HEADER_DIRS
>    ${LLD_INCLUDE_DIR}/lld/Driver
>
> +  LINK_COMPONENTS
> +    Object
> +    Option
> +    Support
> +
>    LINK_LIBS
>      lldConfig
>      lldMachO
>      lldCore
>      lldReaderWriter
>      lldYAML
> -    LLVMObject
> -    LLVMOption
> -    LLVMSupport
>    )
>
>  add_dependencies(lldDriver DriverOptionsTableGen)
>
> Modified: lld/trunk/lib/ReaderWriter/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/CMakeLists.txt?rev=291432&r1=291431&r2=291432&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/CMakeLists.txt (original)
> +++ lld/trunk/lib/ReaderWriter/CMakeLists.txt Mon Jan  9 03:57:08 2017
> @@ -11,9 +11,11 @@ add_lld_library(lldReaderWriter
>    ADDITIONAL_HEADER_DIRS
>    ${LLD_INCLUDE_DIR}/lld/ReaderWriter
>
> +  LINK_COMPONENTS
> +    Object
> +    Support
> +
>    LINK_LIBS
>      lldCore
>      lldYAML
> -    LLVMObject
> -    LLVMSupport
>    )
>
> Modified: lld/trunk/lib/ReaderWriter/MachO/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/CMakeLists.txt?rev=291432&r1=291431&r2=291432&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/MachO/CMakeLists.txt (original)
> +++ lld/trunk/lib/ReaderWriter/MachO/CMakeLists.txt Mon Jan  9 03:57:08 2017
> @@ -18,13 +18,16 @@ add_lld_library(lldMachO
>    StubsPass.cpp
>    TLVPass.cpp
>    WriterMachO.cpp
> +
> +  LINK_COMPONENTS
> +    DebugInfoDWARF
> +    Object
> +    Support
> +    Demangle
> +
>    LINK_LIBS
>      lldCore
>      lldYAML
> -    LLVMDebugInfoDWARF
> -    LLVMObject
> -    LLVMSupport
> -    LLVMDemangle
>      ${PTHREAD_LIB}
>    )
>
>
> Modified: lld/trunk/lib/ReaderWriter/YAML/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/YAML/CMakeLists.txt?rev=291432&r1=291431&r2=291432&view=diff
> ==============================================================================
> --- lld/trunk/lib/ReaderWriter/YAML/CMakeLists.txt (original)
> +++ lld/trunk/lib/ReaderWriter/YAML/CMakeLists.txt Mon Jan  9 03:57:08 2017
> @@ -1,6 +1,9 @@
>  add_lld_library(lldYAML
>    ReaderWriterYAML.cpp
> +
> +  LINK_COMPONENTS
> +    Support
> +
>    LINK_LIBS
>      lldCore
> -    LLVMSupport
>    )
>
> Modified: lld/trunk/tools/lld/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/tools/lld/CMakeLists.txt?rev=291432&r1=291431&r2=291432&view=diff
> ==============================================================================
> --- lld/trunk/tools/lld/CMakeLists.txt (original)
> +++ lld/trunk/tools/lld/CMakeLists.txt Mon Jan  9 03:57:08 2017
> @@ -1,3 +1,7 @@
> +set(LLVM_LINK_COMPONENTS
> +  Support
> +  )
> +
>  add_lld_tool(lld
>    lld.cpp
>    )
> @@ -6,7 +10,6 @@ target_link_libraries(lld
>    lldDriver
>    lldCOFF
>    lldELF
> -  LLVMSupport
>    )
>
>  install(TARGETS lld
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list