summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2024-11-18 15:44:21 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2024-11-18 20:02:50 (GMT)
commit0445190d2f9f73d996cc0eaa030e0c7912cb9ed6 (patch)
tree7bb196cfe7458f4f65d97ef2b062682d4019f091 /Tests
parent74c1b88859c0f43bb0fa5037c810b53273fe9e90 (diff)
downloadCMake-0445190d2f9f73d996cc0eaa030e0c7912cb9ed6.zip
CMake-0445190d2f9f73d996cc0eaa030e0c7912cb9ed6.tar.gz
CMake-0445190d2f9f73d996cc0eaa030e0c7912cb9ed6.tar.bz2
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
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/LinkLibrariesStrategy/Inspect.cmake2
-rw-r--r--Tests/RunCMake/LinkLibrariesStrategy/RunCMakeTest.cmake11
2 files changed, 12 insertions, 1 deletions
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")