diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2024-11-18 15:44:21 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2024-11-18 20:02:50 (GMT) |
commit | 0445190d2f9f73d996cc0eaa030e0c7912cb9ed6 (patch) | |
tree | 7bb196cfe7458f4f65d97ef2b062682d4019f091 /Source | |
parent | 74c1b88859c0f43bb0fa5037c810b53273fe9e90 (diff) | |
download | CMake-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 'Source')
-rw-r--r-- | Source/cmComputeLinkDepends.cxx | 9 |
1 files changed, 9 insertions, 0 deletions
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; + } } } } |