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.

Fixes: #26447
This commit is contained in:
Marc Chevrier
2024-11-18 16:44:21 +01:00
parent 74c1b88859
commit 0445190d2f
37 changed files with 70 additions and 1 deletions
+1
View File
@@ -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()
@@ -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
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
+1
View File
@@ -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()
+1
View File
@@ -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()
@@ -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()
@@ -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()
+1
View File
@@ -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()
+1
View File
@@ -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()
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
+1
View File
@@ -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()
+2
View File
@@ -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()
+1
View File
@@ -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()
@@ -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()
@@ -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()
@@ -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()
@@ -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()
+1
View File
@@ -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()
@@ -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")
@@ -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()
@@ -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)
@@ -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