diff --git a/debian/patches/0004-LLD-linker-avoid-regression-on-archive-libraries-ded.patch b/debian/patches/0004-LLD-linker-avoid-regression-on-archive-libraries-ded.patch new file mode 100644 index 000000000..2d13fce80 --- /dev/null +++ b/debian/patches/0004-LLD-linker-avoid-regression-on-archive-libraries-ded.patch @@ -0,0 +1,492 @@ +From: Marc Chevrier +Date: Mon, 18 Nov 2024 16:44:21 +0100 +Subject: LLD linker: avoid regression on archive libraries deduplication + +Due to a bug on LLD linker for ELF binaries, deduplication should +occur only if CMP0156 and CMP0179 are NEW. + +Origin: upstream, https://gitlab.kitware.com/cmake/cmake/-/merge_requests/10010 +Bug: https://gitlab.kitware.com/cmake/cmake/-/issues/26447 +Bug-Debian: https://bugs.debian.org/1087983 +--- + Modules/Platform/Linker/AIX-AIX.cmake | 1 + + Modules/Platform/Linker/Apple-AppleClang.cmake | 1 + + Modules/Platform/Linker/Apple-LLD-C.cmake | 2 ++ + Modules/Platform/Linker/Apple-LLD-CXX.cmake | 2 ++ + Modules/Platform/Linker/Apple-LLD-OBJC.cmake | 2 ++ + Modules/Platform/Linker/Apple-LLD-OBJCXX.cmake | 2 ++ + Modules/Platform/Linker/Apple-MOLD-C.cmake | 2 ++ + Modules/Platform/Linker/Apple-MOLD-CXX.cmake | 2 ++ + Modules/Platform/Linker/Apple-MOLD-OBJC.cmake | 2 ++ + Modules/Platform/Linker/Apple-MOLD-OBJCXX.cmake | 2 ++ + Modules/Platform/Linker/CYGWIN-GNU.cmake | 1 + + Modules/Platform/Linker/CYGWIN-LLD.cmake | 1 + + Modules/Platform/Linker/FreeBSD-GNU.cmake | 1 + + Modules/Platform/Linker/FreeBSD-LLD.cmake | 1 + + Modules/Platform/Linker/GNU-GNU.cmake | 1 + + Modules/Platform/Linker/Linux-GNU.cmake | 1 + + Modules/Platform/Linker/Linux-GNUgold-ASM.cmake | 2 ++ + Modules/Platform/Linker/Linux-GNUgold-C.cmake | 2 ++ + Modules/Platform/Linker/Linux-GNUgold-CUDA.cmake | 2 ++ + Modules/Platform/Linker/Linux-GNUgold-CXX.cmake | 2 ++ + Modules/Platform/Linker/Linux-GNUgold-Fortran.cmake | 2 ++ + Modules/Platform/Linker/Linux-GNUgold-HIP.cmake | 2 ++ + Modules/Platform/Linker/Linux-LLD.cmake | 1 + + Modules/Platform/Linker/Linux-MOLD.cmake | 2 ++ + Modules/Platform/Linker/NetBSD-GNU.cmake | 1 + + Modules/Platform/Linker/OpenBSD-GNU.cmake | 1 + + Modules/Platform/Linker/OpenBSD-LLD.cmake | 1 + + Modules/Platform/Linker/SerenityOS-GNU.cmake | 1 + + Modules/Platform/Linker/SerenityOS-LLD.cmake | 1 + + Modules/Platform/Linker/SunOS-GNU.cmake | 1 + + Modules/Platform/Linker/SunOS-Solaris.cmake | 1 + + Modules/Platform/Linker/Windows-GNU.cmake | 1 + + Modules/Platform/Linker/Windows-LLD.cmake | 1 + + Modules/Platform/Linker/Windows-MSVC.cmake | 1 + + Source/cmComputeLinkDepends.cxx | 9 +++++++++ + Tests/RunCMake/LinkLibrariesStrategy/Inspect.cmake | 2 ++ + Tests/RunCMake/LinkLibrariesStrategy/RunCMakeTest.cmake | 11 ++++++++++- + 37 files changed, 70 insertions(+), 1 deletion(-) + +diff --git a/Modules/Platform/Linker/AIX-AIX.cmake b/Modules/Platform/Linker/AIX-AIX.cmake +index 36d7959..553168b 100644 +--- a/Modules/Platform/Linker/AIX-AIX.cmake ++++ b/Modules/Platform/Linker/AIX-AIX.cmake +@@ -6,5 +6,6 @@ + include_guard() + + macro(__aix_linker_aix lang) ++ set(CMAKE_${lang}_PLATFORM_LINKER_ID AIX) + set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE DEDUPLICATION=ALL) + endmacro() +diff --git a/Modules/Platform/Linker/Apple-AppleClang.cmake b/Modules/Platform/Linker/Apple-AppleClang.cmake +index 7582ae9..643cbbd 100644 +--- a/Modules/Platform/Linker/Apple-AppleClang.cmake ++++ b/Modules/Platform/Linker/Apple-AppleClang.cmake +@@ -6,6 +6,7 @@ + include_guard() + + macro(__apple_linker_appleclang lang) ++ set(CMAKE_${lang}_PLATFORM_LINKER_ID AppleClang) + set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE DEDUPLICATION=ALL) + + # Features for LINK_LIBRARY generator expression +diff --git a/Modules/Platform/Linker/Apple-LLD-C.cmake b/Modules/Platform/Linker/Apple-LLD-C.cmake +index e38b1b7..64d9591 100644 +--- a/Modules/Platform/Linker/Apple-LLD-C.cmake ++++ b/Modules/Platform/Linker/Apple-LLD-C.cmake +@@ -2,3 +2,5 @@ + # file Copyright.txt or https://cmake.org/licensing for details. + + include(Platform/Linker/Apple-AppleClang-C) ++ ++set(CMAKE_C_PLATFORM_LINKER_ID LLD) +diff --git a/Modules/Platform/Linker/Apple-LLD-CXX.cmake b/Modules/Platform/Linker/Apple-LLD-CXX.cmake +index 4e4a9ca..deaa558 100644 +--- a/Modules/Platform/Linker/Apple-LLD-CXX.cmake ++++ b/Modules/Platform/Linker/Apple-LLD-CXX.cmake +@@ -2,3 +2,5 @@ + # file Copyright.txt or https://cmake.org/licensing for details. + + include(Platform/Linker/Apple-AppleClang-CXX) ++ ++set(CMAKE_CXX_PLATFORM_LINKER_ID LLD) +diff --git a/Modules/Platform/Linker/Apple-LLD-OBJC.cmake b/Modules/Platform/Linker/Apple-LLD-OBJC.cmake +index ff18785..1879034 100644 +--- a/Modules/Platform/Linker/Apple-LLD-OBJC.cmake ++++ b/Modules/Platform/Linker/Apple-LLD-OBJC.cmake +@@ -2,3 +2,5 @@ + # file Copyright.txt or https://cmake.org/licensing for details. + + include(Platform/Linker/Apple-AppleClang-OBJC) ++ ++set(CMAKE_OBJC_PLATFORM_LINKER_ID LLD) +diff --git a/Modules/Platform/Linker/Apple-LLD-OBJCXX.cmake b/Modules/Platform/Linker/Apple-LLD-OBJCXX.cmake +index ba92890..71844d9 100644 +--- a/Modules/Platform/Linker/Apple-LLD-OBJCXX.cmake ++++ b/Modules/Platform/Linker/Apple-LLD-OBJCXX.cmake +@@ -2,3 +2,5 @@ + # file Copyright.txt or https://cmake.org/licensing for details. + + include(Platform/Linker/Apple-AppleClang-OBJCXX) ++ ++set(CMAKE_OBJCXX_PLATFORM_LINKER_ID LLD) +diff --git a/Modules/Platform/Linker/Apple-MOLD-C.cmake b/Modules/Platform/Linker/Apple-MOLD-C.cmake +index e38b1b7..14347bb 100644 +--- a/Modules/Platform/Linker/Apple-MOLD-C.cmake ++++ b/Modules/Platform/Linker/Apple-MOLD-C.cmake +@@ -2,3 +2,5 @@ + # file Copyright.txt or https://cmake.org/licensing for details. + + include(Platform/Linker/Apple-AppleClang-C) ++ ++set(CMAKE_C_PLATFORM_LINKER_ID MOLD) +diff --git a/Modules/Platform/Linker/Apple-MOLD-CXX.cmake b/Modules/Platform/Linker/Apple-MOLD-CXX.cmake +index 4e4a9ca..416b8b5 100644 +--- a/Modules/Platform/Linker/Apple-MOLD-CXX.cmake ++++ b/Modules/Platform/Linker/Apple-MOLD-CXX.cmake +@@ -2,3 +2,5 @@ + # file Copyright.txt or https://cmake.org/licensing for details. + + include(Platform/Linker/Apple-AppleClang-CXX) ++ ++set(CMAKE_CXX_PLATFORM_LINKER_ID MOLD) +diff --git a/Modules/Platform/Linker/Apple-MOLD-OBJC.cmake b/Modules/Platform/Linker/Apple-MOLD-OBJC.cmake +index ff18785..e18281b 100644 +--- a/Modules/Platform/Linker/Apple-MOLD-OBJC.cmake ++++ b/Modules/Platform/Linker/Apple-MOLD-OBJC.cmake +@@ -2,3 +2,5 @@ + # file Copyright.txt or https://cmake.org/licensing for details. + + include(Platform/Linker/Apple-AppleClang-OBJC) ++ ++set(CMAKE_OBJC_PLATFORM_LINKER_ID MOLD) +diff --git a/Modules/Platform/Linker/Apple-MOLD-OBJCXX.cmake b/Modules/Platform/Linker/Apple-MOLD-OBJCXX.cmake +index ba92890..3a7d48d 100644 +--- a/Modules/Platform/Linker/Apple-MOLD-OBJCXX.cmake ++++ b/Modules/Platform/Linker/Apple-MOLD-OBJCXX.cmake +@@ -2,3 +2,5 @@ + # file Copyright.txt or https://cmake.org/licensing for details. + + include(Platform/Linker/Apple-AppleClang-OBJCXX) ++ ++set(CMAKE_OBJCXX_PLATFORM_LINKER_ID MOLD) +diff --git a/Modules/Platform/Linker/CYGWIN-GNU.cmake b/Modules/Platform/Linker/CYGWIN-GNU.cmake +index 8e5b970..0ac407f 100644 +--- a/Modules/Platform/Linker/CYGWIN-GNU.cmake ++++ b/Modules/Platform/Linker/CYGWIN-GNU.cmake +@@ -8,6 +8,7 @@ include_guard() + include(Platform/Linker/GNU) + + macro(__cygwin_linker_gnu lang) ++ set(CMAKE_${lang}_PLATFORM_LINKER_ID GNU) + if(CMAKE_${lang}_COMPILER_LINKER) + __cmake_set_whole_archive_feature("${CMAKE_${lang}_COMPILER_LINKER}" "${lang}") + endif() +diff --git a/Modules/Platform/Linker/CYGWIN-LLD.cmake b/Modules/Platform/Linker/CYGWIN-LLD.cmake +index 39a3c59..1b637e2 100644 +--- a/Modules/Platform/Linker/CYGWIN-LLD.cmake ++++ b/Modules/Platform/Linker/CYGWIN-LLD.cmake +@@ -12,5 +12,6 @@ include(Platform/Linker/CYGWIN-GNU) + macro(__cygwin_linker_lld lang) + __cygwin_linker_gnu(${lang}) + ++ set(CMAKE_${lang}_PLATFORM_LINKER_ID LLD) + set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE DEDUPLICATION=ALL) + endmacro() +diff --git a/Modules/Platform/Linker/FreeBSD-GNU.cmake b/Modules/Platform/Linker/FreeBSD-GNU.cmake +index f884857..5b26c03 100644 +--- a/Modules/Platform/Linker/FreeBSD-GNU.cmake ++++ b/Modules/Platform/Linker/FreeBSD-GNU.cmake +@@ -8,6 +8,7 @@ include_guard() + include(Platform/Linker/GNU) + + macro(__freebsd_linker_gnu lang) ++ set(CMAKE_${lang}_PLATFORM_LINKER_ID GNU) + if(CMAKE_${lang}_COMPILER_LINKER) + __cmake_set_whole_archive_feature("${CMAKE_${lang}_COMPILER_LINKER}" "${lang}") + endif() +diff --git a/Modules/Platform/Linker/FreeBSD-LLD.cmake b/Modules/Platform/Linker/FreeBSD-LLD.cmake +index 133f80c..19f4df5 100644 +--- a/Modules/Platform/Linker/FreeBSD-LLD.cmake ++++ b/Modules/Platform/Linker/FreeBSD-LLD.cmake +@@ -12,5 +12,6 @@ include(Platform/Linker/FreeBSD-GNU) + macro(__freebsd_linker_lld lang) + __freebsd_linker_gnu(${lang}) + ++ set(CMAKE_${lang}_PLATFORM_LINKER_ID LLD) + set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE DEDUPLICATION=ALL) + endmacro() +diff --git a/Modules/Platform/Linker/GNU-GNU.cmake b/Modules/Platform/Linker/GNU-GNU.cmake +index a1adf14..274b876 100644 +--- a/Modules/Platform/Linker/GNU-GNU.cmake ++++ b/Modules/Platform/Linker/GNU-GNU.cmake +@@ -8,6 +8,7 @@ include_guard() + include(Platform/Linker/GNU) + + macro(__gnu_linker_gnu lang) ++ set(CMAKE_${lang}_PLATFORM_LINKER_ID GNU) + if(CMAKE_${lang}_COMPILER_LINKER) + __cmake_set_whole_archive_feature("${CMAKE_${lang}_COMPILER_LINKER}" "${lang}") + endif() +diff --git a/Modules/Platform/Linker/Linux-GNU.cmake b/Modules/Platform/Linker/Linux-GNU.cmake +index 6668141..0cffafb 100644 +--- a/Modules/Platform/Linker/Linux-GNU.cmake ++++ b/Modules/Platform/Linker/Linux-GNU.cmake +@@ -8,6 +8,7 @@ include_guard() + include(Platform/Linker/GNU) + + macro(__linux_linker_gnu lang) ++ set(CMAKE_${lang}_PLATFORM_LINKER_ID GNU) + if(CMAKE_${lang}_COMPILER_LINKER) + __cmake_set_whole_archive_feature("${CMAKE_${lang}_COMPILER_LINKER}" "${lang}") + endif() +diff --git a/Modules/Platform/Linker/Linux-GNUgold-ASM.cmake b/Modules/Platform/Linker/Linux-GNUgold-ASM.cmake +index bfef8b9..54b4554 100644 +--- a/Modules/Platform/Linker/Linux-GNUgold-ASM.cmake ++++ b/Modules/Platform/Linker/Linux-GNUgold-ASM.cmake +@@ -2,3 +2,5 @@ + # file Copyright.txt or https://cmake.org/licensing for details. + + include(Platform/Linker/Linux-GNU-ASM) ++ ++set(CMAKE_ASM_PLATFORM_LINKER_ID GNUgold) +diff --git a/Modules/Platform/Linker/Linux-GNUgold-C.cmake b/Modules/Platform/Linker/Linux-GNUgold-C.cmake +index 2d0efda..929ac88 100644 +--- a/Modules/Platform/Linker/Linux-GNUgold-C.cmake ++++ b/Modules/Platform/Linker/Linux-GNUgold-C.cmake +@@ -2,3 +2,5 @@ + # file Copyright.txt or https://cmake.org/licensing for details. + + include(Platform/Linker/Linux-GNU-C) ++ ++set(CMAKE_C_PLATFORM_LINKER_ID GNUgold) +diff --git a/Modules/Platform/Linker/Linux-GNUgold-CUDA.cmake b/Modules/Platform/Linker/Linux-GNUgold-CUDA.cmake +index d67dc94..0dc4ba2 100644 +--- a/Modules/Platform/Linker/Linux-GNUgold-CUDA.cmake ++++ b/Modules/Platform/Linker/Linux-GNUgold-CUDA.cmake +@@ -2,3 +2,5 @@ + # file Copyright.txt or https://cmake.org/licensing for details. + + include(Platform/Linker/Linux-GNU-CUDA) ++ ++set(CMAKE_CUDA_PLATFORM_LINKER_ID GNUgold) +diff --git a/Modules/Platform/Linker/Linux-GNUgold-CXX.cmake b/Modules/Platform/Linker/Linux-GNUgold-CXX.cmake +index 33c46d5..f390248 100644 +--- a/Modules/Platform/Linker/Linux-GNUgold-CXX.cmake ++++ b/Modules/Platform/Linker/Linux-GNUgold-CXX.cmake +@@ -2,3 +2,5 @@ + # file Copyright.txt or https://cmake.org/licensing for details. + + include(Platform/Linker/Linux-GNU-CXX) ++ ++set(CMAKE_CXX_PLATFORM_LINKER_ID GNUgold) +diff --git a/Modules/Platform/Linker/Linux-GNUgold-Fortran.cmake b/Modules/Platform/Linker/Linux-GNUgold-Fortran.cmake +index a01acda..531d524 100644 +--- a/Modules/Platform/Linker/Linux-GNUgold-Fortran.cmake ++++ b/Modules/Platform/Linker/Linux-GNUgold-Fortran.cmake +@@ -2,3 +2,5 @@ + # file Copyright.txt or https://cmake.org/licensing for details. + + include(Platform/Linker/Linux-GNU-Fortran) ++ ++set(CMAKE_Fortran_PLATFORM_LINKER_ID GNUgold) +diff --git a/Modules/Platform/Linker/Linux-GNUgold-HIP.cmake b/Modules/Platform/Linker/Linux-GNUgold-HIP.cmake +index 6d1e492..0b77210 100644 +--- a/Modules/Platform/Linker/Linux-GNUgold-HIP.cmake ++++ b/Modules/Platform/Linker/Linux-GNUgold-HIP.cmake +@@ -2,3 +2,5 @@ + # file Copyright.txt or https://cmake.org/licensing for details. + + include(Platform/Linker/Linux-GNU-HIP) ++ ++set(CMAKE_HIP_PLATFORM_LINKER_ID GNUgold) +diff --git a/Modules/Platform/Linker/Linux-LLD.cmake b/Modules/Platform/Linker/Linux-LLD.cmake +index afe5d1c..86eedd8 100644 +--- a/Modules/Platform/Linker/Linux-LLD.cmake ++++ b/Modules/Platform/Linker/Linux-LLD.cmake +@@ -12,5 +12,6 @@ include(Platform/Linker/Linux-GNU) + macro(__linux_linker_lld lang) + __linux_linker_gnu(${lang}) + ++ set(CMAKE_${lang}_PLATFORM_LINKER_ID LLD) + set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE DEDUPLICATION=ALL) + endmacro() +diff --git a/Modules/Platform/Linker/Linux-MOLD.cmake b/Modules/Platform/Linker/Linux-MOLD.cmake +index 672e699..2a3d9dc 100644 +--- a/Modules/Platform/Linker/Linux-MOLD.cmake ++++ b/Modules/Platform/Linker/Linux-MOLD.cmake +@@ -12,5 +12,7 @@ include(Platform/Linker/Linux-GNU) + macro(__linux_linker_mold lang) + __linux_linker_gnu(${lang}) + ++ ++ set(CMAKE_C_PLATFORM_LINKER_ID MOLD) + set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE DEDUPLICATION=ALL) + endmacro() +diff --git a/Modules/Platform/Linker/NetBSD-GNU.cmake b/Modules/Platform/Linker/NetBSD-GNU.cmake +index f06e491..226afcd 100644 +--- a/Modules/Platform/Linker/NetBSD-GNU.cmake ++++ b/Modules/Platform/Linker/NetBSD-GNU.cmake +@@ -8,6 +8,7 @@ include_guard() + include(Platform/Linker/GNU) + + macro(__netbsd_linker_gnu lang) ++ set(CMAKE_${lang}_PLATFORM_LINKER_ID GNU) + if(CMAKE_${lang}_COMPILER_LINKER) + __cmake_set_whole_archive_feature("${CMAKE_${lang}_COMPILER_LINKER}" "${lang}") + endif() +diff --git a/Modules/Platform/Linker/OpenBSD-GNU.cmake b/Modules/Platform/Linker/OpenBSD-GNU.cmake +index b30e467..c5821bb 100644 +--- a/Modules/Platform/Linker/OpenBSD-GNU.cmake ++++ b/Modules/Platform/Linker/OpenBSD-GNU.cmake +@@ -8,6 +8,7 @@ include_guard() + include(Platform/Linker/GNU) + + macro(__openbsd_linker_gnu lang) ++ set(CMAKE_${lang}_PLATFORM_LINKER_ID GNU) + if(CMAKE_${lang}_COMPILER_LINKER) + __cmake_set_whole_archive_feature("${CMAKE_${lang}_COMPILER_LINKER}" "${lang}") + endif() +diff --git a/Modules/Platform/Linker/OpenBSD-LLD.cmake b/Modules/Platform/Linker/OpenBSD-LLD.cmake +index 522a232..05a1017 100644 +--- a/Modules/Platform/Linker/OpenBSD-LLD.cmake ++++ b/Modules/Platform/Linker/OpenBSD-LLD.cmake +@@ -12,5 +12,6 @@ include(Platform/Linker/OpenBSD-GNU) + macro(__openbsd_linker_lld lang) + __openbsd_linker_gnu(${lang}) + ++ set(CMAKE_${lang}_PLATFORM_LINKER_ID LLD) + set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE DEDUPLICATION=ALL) + endmacro() +diff --git a/Modules/Platform/Linker/SerenityOS-GNU.cmake b/Modules/Platform/Linker/SerenityOS-GNU.cmake +index 9b06bfb..45f6505 100644 +--- a/Modules/Platform/Linker/SerenityOS-GNU.cmake ++++ b/Modules/Platform/Linker/SerenityOS-GNU.cmake +@@ -8,6 +8,7 @@ include_guard() + include(Platform/Linker/GNU) + + macro(__serenityos_linker_gnu lang) ++ set(CMAKE_${lang}_PLATFORM_LINKER_ID GNU) + if(CMAKE_${lang}_COMPILER_LINKER) + __cmake_set_whole_archive_feature("${CMAKE_${lang}_COMPILER_LINKER}" "${lang}") + endif() +diff --git a/Modules/Platform/Linker/SerenityOS-LLD.cmake b/Modules/Platform/Linker/SerenityOS-LLD.cmake +index 9f34e79..f3c0389 100644 +--- a/Modules/Platform/Linker/SerenityOS-LLD.cmake ++++ b/Modules/Platform/Linker/SerenityOS-LLD.cmake +@@ -12,5 +12,6 @@ include(Platform/Linker/SerenityOS-GNU) + macro(__serenityos_linker_lld lang) + __serenityos_linker_gnu(${lang}) + ++ set(CMAKE_${lang}_PLATFORM_LINKER_ID LLD) + set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=REVERSE DEDUPLICATION=ALL) + endmacro() +diff --git a/Modules/Platform/Linker/SunOS-GNU.cmake b/Modules/Platform/Linker/SunOS-GNU.cmake +index 693e31a..ae9697d 100644 +--- a/Modules/Platform/Linker/SunOS-GNU.cmake ++++ b/Modules/Platform/Linker/SunOS-GNU.cmake +@@ -8,6 +8,7 @@ include_guard() + include(Platform/Linker/GNU) + + macro(__sunos_linker_gnu lang) ++ set(CMAKE_${lang}_PLATFORM_LINKER_ID GNU) + if(CMAKE_${lang}_COMPILER_LINKER) + __cmake_set_whole_archive_feature("${CMAKE_${lang}_COMPILER_LINKER}" "${lang}") + endif() +diff --git a/Modules/Platform/Linker/SunOS-Solaris.cmake b/Modules/Platform/Linker/SunOS-Solaris.cmake +index cf82bf8..324108c 100644 +--- a/Modules/Platform/Linker/SunOS-Solaris.cmake ++++ b/Modules/Platform/Linker/SunOS-Solaris.cmake +@@ -9,6 +9,7 @@ block(SCOPE_FOR POLICIES) + cmake_policy(SET CMP0054 NEW) + + macro(__sunos_linker_solaris lang) ++ set(CMAKE_${lang}_PLATFORM_LINKER_ID Solaris) + # Features for LINK_LIBRARY generator expression + ## WHOLE_ARCHIVE: Force loading all members of an archive + if (CMAKE_SYSTEM_VERSION VERSION_GREATER "5.10") +diff --git a/Modules/Platform/Linker/Windows-GNU.cmake b/Modules/Platform/Linker/Windows-GNU.cmake +index a5c4417..144b03e 100644 +--- a/Modules/Platform/Linker/Windows-GNU.cmake ++++ b/Modules/Platform/Linker/Windows-GNU.cmake +@@ -8,6 +8,7 @@ include_guard() + include(Platform/Linker/GNU) + + macro(__windows_linker_gnu lang) ++ set(CMAKE_${lang}_PLATFORM_LINKER_ID GNU) + if(CMAKE_${lang}_COMPILER_LINKER) + __cmake_set_whole_archive_feature("${CMAKE_${lang}_COMPILER_LINKER}" "${lang}") + endif() +diff --git a/Modules/Platform/Linker/Windows-LLD.cmake b/Modules/Platform/Linker/Windows-LLD.cmake +index f2dde1a..5054745 100644 +--- a/Modules/Platform/Linker/Windows-LLD.cmake ++++ b/Modules/Platform/Linker/Windows-LLD.cmake +@@ -9,6 +9,7 @@ block(SCOPE_FOR POLICIES) + cmake_policy(SET CMP0054 NEW) + + macro(__windows_linker_lld lang) ++ set(CMAKE_${lang}_PLATFORM_LINKER_ID LLD) + # Features for LINK_LIBRARY generator expression + if(CMAKE_${lang}_COMPILER_LINKER_FRONTEND_VARIANT STREQUAL "GNU") + include(Platform/Linker/Windows-GNU) +diff --git a/Modules/Platform/Linker/Windows-MSVC.cmake b/Modules/Platform/Linker/Windows-MSVC.cmake +index 2eb5713..18c2102 100644 +--- a/Modules/Platform/Linker/Windows-MSVC.cmake ++++ b/Modules/Platform/Linker/Windows-MSVC.cmake +@@ -17,6 +17,7 @@ if(MSVC_VERSION GREATER "1900") + endif() + + macro(__windows_linker_msvc lang) ++ set(CMAKE_${lang}_PLATFORM_LINKER_ID MSVC) + set(CMAKE_${lang}_LINK_LIBRARIES_PROCESSING ORDER=FORWARD DEDUPLICATION=ALL) + + # Features for LINK_LIBRARY generator expression +diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx +index 551a45b..d445128 100644 +--- a/Source/cmComputeLinkDepends.cxx ++++ b/Source/cmComputeLinkDepends.cxx +@@ -449,6 +449,15 @@ public: + "_LINK_LIBRARIES_PROCESSING':\n", errorMessage), + target->GetBacktrace()); + } ++ // For some environments, deduplication should be activated only if ++ // both policies CMP0156 and CMP0179 are NEW ++ if (makefile->GetDefinition(cmStrCat( ++ "CMAKE_", linkLanguage, "_PLATFORM_LINKER_ID")) == "LLD"_s && ++ makefile->GetDefinition("CMAKE_EXECUTABLE_FORMAT") == "ELF"_s && ++ target->GetPolicyStatusCMP0179() != cmPolicies::NEW && ++ this->Deduplication == All) { ++ this->Deduplication = Shared; ++ } + } + } + } +diff --git a/Tests/RunCMake/LinkLibrariesStrategy/Inspect.cmake b/Tests/RunCMake/LinkLibrariesStrategy/Inspect.cmake +index fd5da91..26f6388 100644 +--- a/Tests/RunCMake/LinkLibrariesStrategy/Inspect.cmake ++++ b/Tests/RunCMake/LinkLibrariesStrategy/Inspect.cmake +@@ -3,6 +3,8 @@ enable_language(C) + set(info "") + foreach(var + CMAKE_C_LINK_LIBRARIES_PROCESSING ++ CMAKE_C_PLATFORM_LINKER_ID ++ CMAKE_EXECUTABLE_FORMAT + ) + if(DEFINED ${var}) + string(APPEND info "set(${var} \"${${var}}\")\n") +diff --git a/Tests/RunCMake/LinkLibrariesStrategy/RunCMakeTest.cmake b/Tests/RunCMake/LinkLibrariesStrategy/RunCMakeTest.cmake +index 787b636..7ae1006 100644 +--- a/Tests/RunCMake/LinkLibrariesStrategy/RunCMakeTest.cmake ++++ b/Tests/RunCMake/LinkLibrariesStrategy/RunCMakeTest.cmake +@@ -10,13 +10,15 @@ endif() + + # Detect information from the toolchain: + # - CMAKE_C_LINK_LIBRARIES_PROCESSING ++# - CMAKE_C_PLATFORM_LINKER_ID ++# - CMAKE_EXECUTABLE_FORMAT + run_cmake(Inspect) + include("${RunCMake_BINARY_DIR}/Inspect-build/info.cmake") + + run_cmake(Unknown) + + function(run_strategy case exe) +- foreach(cmp0179 OLD NEW) ++ foreach(cmp0179 ${cmp0179_states}) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-CMP0179-${cmp0179}-build) + set(RunCMake_TEST_VARIANT_DESCRIPTION "...CMP0179-${cmp0179}") + if("DEDUPLICATION=ALL" IN_LIST CMAKE_C_LINK_LIBRARIES_PROCESSING) +@@ -44,6 +46,13 @@ function(run_strategy case exe) + endforeach() + endfunction() + ++if(CMAKE_C_PLATFORM_LINKER_ID STREQUAL "LLD" AND CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF") ++ # deduplication done only if both CMP0156 and CMP0179 ARE NEW ++ set(cmp0179_states NEW) ++else() ++ set(cmp0179_states OLD NEW) ++endif() ++ + run_strategy(Basic-REORDER_MINIMALLY "main") + run_strategy(Basic-REORDER_FREELY "main") + diff --git a/debian/patches/series b/debian/patches/series index 5bfda2b8a..58a6634bb 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,4 @@ 0001-Prefer-default-Python-version.patch 0002-Fix-ImageMagick_-_ARCH_INCLUDE_DIR-detection.patch 0003-Recognize-Multi-Arch-libdir-for-musl-linux-any.patch +0004-LLD-linker-avoid-regression-on-archive-libraries-ded.patch