https://github.com/rnk updated https://github.com/llvm/llvm-project/pull/138187
>From 7e23666e3366101d635648faf95aaf7245643b4e Mon Sep 17 00:00:00 2001 From: Reid Kleckner <r...@google.com> Date: Wed, 30 Apr 2025 16:32:32 -0700 Subject: [PATCH 1/4] [llvm] Enable LLVM_LINK_LLVM_DYLIB by default on non-Windows platforms As discussed in the RFC thread [1], this build configuration is a better default because it uses less RAM and disk to build LLVM, which makes it more accessible to beginners. The downside to the libLLVM build is that it increases tool binary startup time, which can have major impacts on configuration script times and the LLVM test suite itself. However, it is better for new users configuring LLVM builds for the first time. Long-time developers with beefy machines who prefer the finer grained dependencies of static linking can still use the old model by opting out with -DLLVM_LINK_LLVM_DYLIB=OFF. The fine-grained shared lib build is also still supported via -DBUILD_SHARED_LIBS=ON. MLIR's dylib build is configured to follow the LLVM dylib build, so this changes the default for MLIR as well. [1] https://discourse.llvm.org/t/rfc-llvm-link-llvm-dylib-should-default-to-on-on-posix-platforms/85908/1 --- llvm/CMakeLists.txt | 16 ++++++++++++++-- llvm/docs/ReleaseNotes.md | 5 +++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt index dd9040400530b..fde0988a737bc 100644 --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -904,14 +904,26 @@ if(NOT MSVC OR LLVM_BUILD_LLVM_DYLIB_VIS) set(CAN_BUILD_LLVM_DYLIB ON) endif() -cmake_dependent_option(LLVM_LINK_LLVM_DYLIB "Link tools against the libllvm dynamic library" OFF +# Link the tools against the libllvm DSO by default. +set(LLVM_LINK_LLVM_DYLIB_default ON) +if (BUILD_SHARED_LIBS OR WIN32) + set(LLVM_LINK_LLVM_DYLIB_default OFF) +endif() + +cmake_dependent_option(LLVM_LINK_LLVM_DYLIB "Link tools against the libllvm dynamic library" + "${LLVM_LINK_LLVM_DYLIB_default}" "CAN_BUILD_LLVM_DYLIB" OFF) +message("LLVM_LINK_LLVM_DYLIB_default ${LLVM_LINK_LLVM_DYLIB_default}") +message("BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}") +message("LLVM_LINK_LLVM_DYLIB ${LLVM_LINK_LLVM_DYLIB}") + set(LLVM_BUILD_LLVM_DYLIB_default OFF) if(LLVM_LINK_LLVM_DYLIB OR LLVM_BUILD_LLVM_C_DYLIB) set(LLVM_BUILD_LLVM_DYLIB_default ON) endif() -cmake_dependent_option(LLVM_BUILD_LLVM_DYLIB "Build libllvm dynamic library" ${LLVM_BUILD_LLVM_DYLIB_default} +cmake_dependent_option(LLVM_BUILD_LLVM_DYLIB "Build libllvm dynamic library" + "${LLVM_BUILD_LLVM_DYLIB_default}" "CAN_BUILD_LLVM_DYLIB" OFF) cmake_dependent_option(LLVM_DYLIB_EXPORT_INLINES "Force inline members of classes to be DLL exported when diff --git a/llvm/docs/ReleaseNotes.md b/llvm/docs/ReleaseNotes.md index aded1bd67ed76..748883d70c084 100644 --- a/llvm/docs/ReleaseNotes.md +++ b/llvm/docs/ReleaseNotes.md @@ -77,6 +77,11 @@ Changes to LLVM infrastructure Changes to building LLVM ------------------------ +* On non-Windows platforms, LLVM now builds as a large shared library, libLLVM, + by default. To revert to the old behavior of producing and linking static + libraries, pass ``-DLLVM_LINK_LLVM_DYLIB=OFF`` to CMake when configuring your + build. + Changes to TableGen ------------------- >From 1eb025c251812e41544b9e388541ccd529adb3b0 Mon Sep 17 00:00:00 2001 From: Reid Kleckner <r...@google.com> Date: Wed, 25 Jun 2025 15:56:40 +0000 Subject: [PATCH 2/4] Remove debug prints --- llvm/CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt index a7b243e077cdd..cd2adf1cddace 100644 --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -929,10 +929,6 @@ cmake_dependent_option(LLVM_LINK_LLVM_DYLIB "Link tools against the libllvm dyna "${LLVM_LINK_LLVM_DYLIB_default}" "CAN_BUILD_LLVM_DYLIB" OFF) -message("LLVM_LINK_LLVM_DYLIB_default ${LLVM_LINK_LLVM_DYLIB_default}") -message("BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}") -message("LLVM_LINK_LLVM_DYLIB ${LLVM_LINK_LLVM_DYLIB}") - set(LLVM_BUILD_LLVM_DYLIB_default OFF) if(LLVM_LINK_LLVM_DYLIB OR LLVM_BUILD_LLVM_C_DYLIB) set(LLVM_BUILD_LLVM_DYLIB_default ON) >From 788bd487bd45925e50b45b804c765917d72c6816 Mon Sep 17 00:00:00 2001 From: Reid Kleckner <r...@google.com> Date: Thu, 26 Jun 2025 04:01:07 +0000 Subject: [PATCH 3/4] Disable linking the dylib from TestingSupport, it only uses Support --- bolt/unittests/Profile/CMakeLists.txt | 2 -- llvm/lib/Testing/Support/CMakeLists.txt | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bolt/unittests/Profile/CMakeLists.txt b/bolt/unittests/Profile/CMakeLists.txt index ce01c6c4b949e..4d468372f27fc 100644 --- a/bolt/unittests/Profile/CMakeLists.txt +++ b/bolt/unittests/Profile/CMakeLists.txt @@ -15,8 +15,6 @@ target_link_libraries(ProfileTests PRIVATE LLVMBOLTCore LLVMBOLTProfile - LLVMTargetParser - LLVMTestingSupport ) foreach (tgt ${BOLT_TARGETS_TO_BUILD}) diff --git a/llvm/lib/Testing/Support/CMakeLists.txt b/llvm/lib/Testing/Support/CMakeLists.txt index 6955271239ca6..e5f3af23a6a13 100644 --- a/llvm/lib/Testing/Support/CMakeLists.txt +++ b/llvm/lib/Testing/Support/CMakeLists.txt @@ -14,6 +14,8 @@ add_llvm_library(LLVMTestingSupport ADDITIONAL_HEADER_DIRS ${LLVM_MAIN_INCLUDE_DIR}/llvm/Testing/Support + DISABLE_LLVM_LINK_LLVM_DYLIB + LINK_COMPONENTS Support ) >From 2f1529f1bf4434e1a7f81d58947137af021085b7 Mon Sep 17 00:00:00 2001 From: Reid Kleckner <r...@google.com> Date: Thu, 26 Jun 2025 04:07:23 +0000 Subject: [PATCH 4/4] Add release notes --- clang/docs/ReleaseNotes.rst | 5 +++++ llvm/docs/ReleaseNotes.md | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index e1fe22393eebb..b4e89a2b18559 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -332,6 +332,11 @@ Non-comprehensive list of changes in this release - Clang no longer rejects reinterpret_cast conversions between indirect ARC-managed pointers and other pointer types. The prior behavior was overly strict and inconsistent with the ARC specification. +- On non-Windows platforms, Clang now builds as a large shared library, + ``libclang-cpp``, by default. To revert to the old behavior of producing and + linking static libraries, pass ``-DCLANG_LINK_CLANG_DYLIB=OFF`` to CMake when + configuring your build. The new behavior matches LLVM, which also builds as a + large shared library. New Compiler Flags ------------------ diff --git a/llvm/docs/ReleaseNotes.md b/llvm/docs/ReleaseNotes.md index d4b1e353499f5..b9d4673a93ac4 100644 --- a/llvm/docs/ReleaseNotes.md +++ b/llvm/docs/ReleaseNotes.md @@ -90,7 +90,7 @@ Changes to LLVM infrastructure Changes to building LLVM ------------------------ -* On non-Windows platforms, LLVM now builds as a large shared library, libLLVM, +* On non-Windows platforms, LLVM now builds as a large shared library, `libLLVM`, by default. To revert to the old behavior of producing and linking static libraries, pass ``-DLLVM_LINK_LLVM_DYLIB=OFF`` to CMake when configuring your build. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits