summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2020-06-19 18:07:38 +0200
committerMichał Górny <mgorny@gentoo.org>2020-06-19 20:10:19 +0200
commit60d43626dcce4238ca0227752fd94ee9a74d8901 (patch)
treec97677cf7da49c15a8099c6189cad1a347e088f0 /sys-devel
parentsys-devel/llvm: Patch bad dylib linking in 10.0.1* (diff)
downloadgentoo-60d43626dcce4238ca0227752fd94ee9a74d8901.tar.gz
gentoo-60d43626dcce4238ca0227752fd94ee9a74d8901.tar.bz2
gentoo-60d43626dcce4238ca0227752fd94ee9a74d8901.zip
sys-devel/clang: Fix bad dylib linking in 10.0.1*
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'sys-devel')
-rw-r--r--sys-devel/clang/clang-10.0.1.9999.ebuild6
-rw-r--r--sys-devel/clang/clang-10.0.1_rc1.ebuild6
-rw-r--r--sys-devel/clang/files/10.0.1/0003-clang-tools-extra-Prevent-linking-to-duplicate-.a-li.patch788
-rw-r--r--sys-devel/clang/files/10.0.1/0004-clang-Avoid-linking-c-index-test-to-duplicate-librar.patch29
4 files changed, 829 insertions, 0 deletions
diff --git a/sys-devel/clang/clang-10.0.1.9999.ebuild b/sys-devel/clang/clang-10.0.1.9999.ebuild
index 6f913045c092..874112003a9d 100644
--- a/sys-devel/clang/clang-10.0.1.9999.ebuild
+++ b/sys-devel/clang/clang-10.0.1.9999.ebuild
@@ -71,6 +71,12 @@ CMAKE_BUILD_TYPE=RelWithDebInfo
# Therefore: use sys-devel/clang[${MULTILIB_USEDEP}] only if you need
# multilib clang* libraries (not runtime, not wrappers).
+PATCHES=(
+ # fix simultaneous linking to .a and dylib
+ "${FILESDIR}"/10.0.1/0003-clang-tools-extra-Prevent-linking-to-duplicate-.a-li.patch
+ "${FILESDIR}"/10.0.1/0004-clang-Avoid-linking-c-index-test-to-duplicate-librar.patch
+)
+
pkg_setup() {
LLVM_MAX_SLOT=${SLOT} llvm_pkg_setup
python-single-r1_pkg_setup
diff --git a/sys-devel/clang/clang-10.0.1_rc1.ebuild b/sys-devel/clang/clang-10.0.1_rc1.ebuild
index 13d42251a431..e7e3d86f94fe 100644
--- a/sys-devel/clang/clang-10.0.1_rc1.ebuild
+++ b/sys-devel/clang/clang-10.0.1_rc1.ebuild
@@ -71,6 +71,12 @@ CMAKE_BUILD_TYPE=RelWithDebInfo
# Therefore: use sys-devel/clang[${MULTILIB_USEDEP}] only if you need
# multilib clang* libraries (not runtime, not wrappers).
+PATCHES=(
+ # fix simultaneous linking to .a and dylib
+ "${FILESDIR}"/10.0.1/0003-clang-tools-extra-Prevent-linking-to-duplicate-.a-li.patch
+ "${FILESDIR}"/10.0.1/0004-clang-Avoid-linking-c-index-test-to-duplicate-librar.patch
+)
+
pkg_setup() {
LLVM_MAX_SLOT=${SLOT} llvm_pkg_setup
python-single-r1_pkg_setup
diff --git a/sys-devel/clang/files/10.0.1/0003-clang-tools-extra-Prevent-linking-to-duplicate-.a-li.patch b/sys-devel/clang/files/10.0.1/0003-clang-tools-extra-Prevent-linking-to-duplicate-.a-li.patch
new file mode 100644
index 000000000000..e2a70c6fb3b8
--- /dev/null
+++ b/sys-devel/clang/files/10.0.1/0003-clang-tools-extra-Prevent-linking-to-duplicate-.a-li.patch
@@ -0,0 +1,788 @@
+From 248d706ca72666a203a24b84406be430ccf40558 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Tue, 16 Jun 2020 20:43:55 +0200
+Subject: [PATCH 3/4] [clang-tools-extra] Prevent linking to duplicate .a libs
+ and dylib
+
+Fix various tool libraries not to link to clang's .a libraries and dylib
+simultaneously. This may cause breakage, in particular through
+duplicate command-line option declarations.
+---
+ .../clang-apply-replacements/CMakeLists.txt | 4 +++-
+ .../clang-change-namespace/CMakeLists.txt | 4 +++-
+ tools/extra/clang-doc/CMakeLists.txt | 4 +++-
+ .../clang-include-fixer/CMakeLists.txt | 6 +++++-
+ .../find-all-symbols/CMakeLists.txt | 4 +++-
+ tools/extra/clang-move/CMakeLists.txt | 4 +++-
+ tools/extra/clang-query/CMakeLists.txt | 4 +++-
+ .../clang-reorder-fields/CMakeLists.txt | 4 +++-
+ tools/extra/clang-tidy/CMakeLists.txt | 7 +++++--
+ tools/extra/clang-tidy/abseil/CMakeLists.txt | 8 ++++++--
+ .../clang-tidy/android/CMakeLists.txt | 8 ++++++--
+ tools/extra/clang-tidy/boost/CMakeLists.txt | 8 ++++++--
+ .../clang-tidy/bugprone/CMakeLists.txt | 10 +++++++---
+ tools/extra/clang-tidy/cert/CMakeLists.txt | 12 ++++++++----
+ .../clang-tidy/cppcoreguidelines/CMakeLists.txt | 14 +++++++++-----
+ tools/extra/clang-tidy/darwin/CMakeLists.txt | 8 ++++++--
+ .../clang-tidy/fuchsia/CMakeLists.txt | 10 +++++++---
+ tools/extra/clang-tidy/google/CMakeLists.txt | 10 +++++++---
+ tools/extra/clang-tidy/hicpp/CMakeLists.txt | 14 +++++++++-----
+ .../clang-tidy/linuxkernel/CMakeLists.txt | 8 ++++++--
+ tools/extra/clang-tidy/llvm/CMakeLists.txt | 10 +++++++---
+ tools/extra/clang-tidy/misc/CMakeLists.txt | 8 ++++++--
+ .../clang-tidy/modernize/CMakeLists.txt | 10 +++++++---
+ tools/extra/clang-tidy/mpi/CMakeLists.txt | 8 ++++++--
+ tools/extra/clang-tidy/objc/CMakeLists.txt | 8 ++++++--
+ tools/extra/clang-tidy/openmp/CMakeLists.txt | 8 ++++++--
+ .../clang-tidy/performance/CMakeLists.txt | 8 ++++++--
+ tools/extra/clang-tidy/plugin/CMakeLists.txt | 8 ++++++--
+ .../clang-tidy/portability/CMakeLists.txt | 8 ++++++--
+ .../clang-tidy/readability/CMakeLists.txt | 8 ++++++--
+ tools/extra/clang-tidy/utils/CMakeLists.txt | 6 +++++-
+ tools/extra/clang-tidy/zircon/CMakeLists.txt | 8 ++++++--
+ tools/extra/clangd/CMakeLists.txt | 11 +++++++----
+ tools/extra/clangd/unittests/CMakeLists.txt | 1 -
+ 34 files changed, 188 insertions(+), 73 deletions(-)
+
+diff --git a/tools/extra/clang-apply-replacements/CMakeLists.txt b/tools/extra/clang-apply-replacements/CMakeLists.txt
+index 5bfdcb487e1..27383b488e4 100644
+--- a/tools/extra/clang-apply-replacements/CMakeLists.txt
++++ b/tools/extra/clang-apply-replacements/CMakeLists.txt
+@@ -4,8 +4,10 @@ set(LLVM_LINK_COMPONENTS
+
+ add_clang_library(clangApplyReplacements
+ lib/Tooling/ApplyReplacements.cpp
++)
+
+- LINK_LIBS
++clang_target_link_libraries(clangApplyReplacements
++ PRIVATE
+ clangAST
+ clangBasic
+ clangRewrite
+diff --git a/tools/extra/clang-change-namespace/CMakeLists.txt b/tools/extra/clang-change-namespace/CMakeLists.txt
+index 178306423eb..dccfd7c0673 100644
+--- a/tools/extra/clang-change-namespace/CMakeLists.txt
++++ b/tools/extra/clang-change-namespace/CMakeLists.txt
+@@ -4,8 +4,10 @@ set(LLVM_LINK_COMPONENTS
+
+ add_clang_library(clangChangeNamespace
+ ChangeNamespace.cpp
++)
+
+- LINK_LIBS
++clang_target_link_libraries(clangChangeNamespace
++ PRIVATE
+ clangAST
+ clangASTMatchers
+ clangBasic
+diff --git a/tools/extra/clang-doc/CMakeLists.txt b/tools/extra/clang-doc/CMakeLists.txt
+index c301ad5afac..6f303a67c9a 100644
+--- a/tools/extra/clang-doc/CMakeLists.txt
++++ b/tools/extra/clang-doc/CMakeLists.txt
+@@ -14,8 +14,10 @@ add_clang_library(clangDoc
+ Representation.cpp
+ Serialize.cpp
+ YAMLGenerator.cpp
++)
+
+- LINK_LIBS
++clang_target_link_libraries(clangDoc
++ PRIVATE
+ clangAnalysis
+ clangAST
+ clangASTMatchers
+diff --git a/tools/extra/clang-include-fixer/CMakeLists.txt b/tools/extra/clang-include-fixer/CMakeLists.txt
+index f27f7403ea6..d8685cb2075 100644
+--- a/tools/extra/clang-include-fixer/CMakeLists.txt
++++ b/tools/extra/clang-include-fixer/CMakeLists.txt
+@@ -11,6 +11,11 @@ add_clang_library(clangIncludeFixer
+ YamlSymbolIndex.cpp
+
+ LINK_LIBS
++ findAllSymbols
++ )
++
++clang_target_link_libraries(clangIncludeFixer
++ PRIVATE
+ clangAST
+ clangBasic
+ clangFormat
+@@ -21,7 +26,6 @@ add_clang_library(clangIncludeFixer
+ clangSerialization
+ clangTooling
+ clangToolingCore
+- findAllSymbols
+ )
+
+ add_subdirectory(plugin)
+diff --git a/tools/extra/clang-include-fixer/find-all-symbols/CMakeLists.txt b/tools/extra/clang-include-fixer/find-all-symbols/CMakeLists.txt
+index c5fe19bfdbd..06a2324e918 100644
+--- a/tools/extra/clang-include-fixer/find-all-symbols/CMakeLists.txt
++++ b/tools/extra/clang-include-fixer/find-all-symbols/CMakeLists.txt
+@@ -11,8 +11,10 @@ add_clang_library(findAllSymbols
+ PragmaCommentHandler.cpp
+ STLPostfixHeaderMap.cpp
+ SymbolInfo.cpp
++ )
+
+- LINK_LIBS
++clang_target_link_libraries(findAllSymbols
++ PRIVATE
+ clangAST
+ clangASTMatchers
+ clangBasic
+diff --git a/tools/extra/clang-move/CMakeLists.txt b/tools/extra/clang-move/CMakeLists.txt
+index c63127ea325..9ea409932da 100644
+--- a/tools/extra/clang-move/CMakeLists.txt
++++ b/tools/extra/clang-move/CMakeLists.txt
+@@ -5,8 +5,10 @@ set(LLVM_LINK_COMPONENTS
+ add_clang_library(clangMove
+ Move.cpp
+ HelperDeclRefGraph.cpp
++ )
+
+- LINK_LIBS
++clang_target_link_libraries(clangMove
++ PRIVATE
+ clangAnalysis
+ clangAST
+ clangASTMatchers
+diff --git a/tools/extra/clang-query/CMakeLists.txt b/tools/extra/clang-query/CMakeLists.txt
+index d1d68d502e3..bc76bae9c0e 100644
+--- a/tools/extra/clang-query/CMakeLists.txt
++++ b/tools/extra/clang-query/CMakeLists.txt
+@@ -6,8 +6,10 @@ set(LLVM_LINK_COMPONENTS
+ add_clang_library(clangQuery
+ Query.cpp
+ QueryParser.cpp
++ )
+
+- LINK_LIBS
++clang_target_link_libraries(clangQuery
++ PRIVATE
+ clangAST
+ clangASTMatchers
+ clangBasic
+diff --git a/tools/extra/clang-reorder-fields/CMakeLists.txt b/tools/extra/clang-reorder-fields/CMakeLists.txt
+index 9c75d785cc9..e555fd5cdf0 100644
+--- a/tools/extra/clang-reorder-fields/CMakeLists.txt
++++ b/tools/extra/clang-reorder-fields/CMakeLists.txt
+@@ -2,8 +2,10 @@ set(LLVM_LINK_COMPONENTS support)
+
+ add_clang_library(clangReorderFields
+ ReorderFieldsAction.cpp
++)
+
+- LINK_LIBS
++clang_target_link_libraries(clangReorderFields
++ PRIVATE
+ clangAST
+ clangASTMatchers
+ clangBasic
+diff --git a/tools/extra/clang-tidy/CMakeLists.txt b/tools/extra/clang-tidy/CMakeLists.txt
+index 6dadb271771..329df19f331 100644
+--- a/tools/extra/clang-tidy/CMakeLists.txt
++++ b/tools/extra/clang-tidy/CMakeLists.txt
+@@ -14,8 +14,10 @@ add_clang_library(clangTidy
+
+ DEPENDS
+ ClangSACheckers
++ )
+
+- LINK_LIBS
++clang_target_link_libraries(clangTidy
++ PRIVATE
+ clangAnalysis
+ clangAST
+ clangASTMatchers
+@@ -31,7 +33,8 @@ add_clang_library(clangTidy
+ )
+
+ if(CLANG_ENABLE_STATIC_ANALYZER)
+- target_link_libraries(clangTidy PRIVATE
++ clang_target_link_libraries(clangTidy
++ PRIVATE
+ clangStaticAnalyzerCore
+ clangStaticAnalyzerFrontend
+ )
+diff --git a/tools/extra/clang-tidy/abseil/CMakeLists.txt b/tools/extra/clang-tidy/abseil/CMakeLists.txt
+index 3f88da6233f..0f040e56a05 100644
+--- a/tools/extra/clang-tidy/abseil/CMakeLists.txt
++++ b/tools/extra/clang-tidy/abseil/CMakeLists.txt
+@@ -22,11 +22,15 @@ add_clang_library(clangTidyAbseilModule
+ UpgradeDurationConversionsCheck.cpp
+
+ LINK_LIBS
++ clangTidy
++ clangTidyUtils
++ )
++
++clang_target_link_libraries(clangTidyAbseilModule
++ PRIVATE
+ clangAST
+ clangASTMatchers
+ clangBasic
+ clangLex
+- clangTidy
+- clangTidyUtils
+ clangTooling
+ )
+diff --git a/tools/extra/clang-tidy/android/CMakeLists.txt b/tools/extra/clang-tidy/android/CMakeLists.txt
+index 9d04003d9bb..d29adc610c8 100644
+--- a/tools/extra/clang-tidy/android/CMakeLists.txt
++++ b/tools/extra/clang-tidy/android/CMakeLists.txt
+@@ -20,10 +20,14 @@ add_clang_library(clangTidyAndroidModule
+ ComparisonInTempFailureRetryCheck.cpp
+
+ LINK_LIBS
++ clangTidy
++ clangTidyUtils
++ )
++
++clang_target_link_libraries(clangTidyAndroidModule
++ PRIVATE
+ clangAST
+ clangASTMatchers
+ clangBasic
+ clangLex
+- clangTidy
+- clangTidyUtils
+ )
+diff --git a/tools/extra/clang-tidy/boost/CMakeLists.txt b/tools/extra/clang-tidy/boost/CMakeLists.txt
+index 059f6e91eca..481a709600c 100644
+--- a/tools/extra/clang-tidy/boost/CMakeLists.txt
++++ b/tools/extra/clang-tidy/boost/CMakeLists.txt
+@@ -5,10 +5,14 @@ add_clang_library(clangTidyBoostModule
+ UseToStringCheck.cpp
+
+ LINK_LIBS
++ clangTidy
++ clangTidyUtils
++ )
++
++clang_target_link_libraries(clangTidyBoostModule
++ PRIVATE
+ clangAST
+ clangASTMatchers
+ clangBasic
+ clangLex
+- clangTidy
+- clangTidyUtils
+ )
+diff --git a/tools/extra/clang-tidy/bugprone/CMakeLists.txt b/tools/extra/clang-tidy/bugprone/CMakeLists.txt
+index 2cb28f4e8f1..d664f5eb875 100644
+--- a/tools/extra/clang-tidy/bugprone/CMakeLists.txt
++++ b/tools/extra/clang-tidy/bugprone/CMakeLists.txt
+@@ -52,13 +52,17 @@ add_clang_library(clangTidyBugproneModule
+ VirtualNearMissCheck.cpp
+
+ LINK_LIBS
++ clangTidy
++ clangTidyCppCoreGuidelinesModule
++ clangTidyUtils
++ )
++
++clang_target_link_libraries(clangTidyBugproneModule
++ PRIVATE
+ clangAnalysis
+ clangAST
+ clangASTMatchers
+ clangBasic
+ clangLex
+- clangTidy
+- clangTidyCppCoreGuidelinesModule
+- clangTidyUtils
+ clangTooling
+ )
+diff --git a/tools/extra/clang-tidy/cert/CMakeLists.txt b/tools/extra/clang-tidy/cert/CMakeLists.txt
+index 66ea2a13acd..75a13349f2f 100644
+--- a/tools/extra/clang-tidy/cert/CMakeLists.txt
++++ b/tools/extra/clang-tidy/cert/CMakeLists.txt
+@@ -17,10 +17,6 @@ add_clang_library(clangTidyCERTModule
+ VariadicFunctionDefCheck.cpp
+
+ LINK_LIBS
+- clangAST
+- clangASTMatchers
+- clangBasic
+- clangLex
+ clangTidy
+ clangTidyBugproneModule
+ clangTidyGoogleModule
+@@ -29,3 +25,11 @@ add_clang_library(clangTidyCERTModule
+ clangTidyReadabilityModule
+ clangTidyUtils
+ )
++
++clang_target_link_libraries(clangTidyCERTModule
++ PRIVATE
++ clangAST
++ clangASTMatchers
++ clangBasic
++ clangLex
++ )
+diff --git a/tools/extra/clang-tidy/cppcoreguidelines/CMakeLists.txt b/tools/extra/clang-tidy/cppcoreguidelines/CMakeLists.txt
+index 13c15bc9d22..e48bc1c8b1a 100644
+--- a/tools/extra/clang-tidy/cppcoreguidelines/CMakeLists.txt
++++ b/tools/extra/clang-tidy/cppcoreguidelines/CMakeLists.txt
+@@ -23,15 +23,19 @@ add_clang_library(clangTidyCppCoreGuidelinesModule
+ SpecialMemberFunctionsCheck.cpp
+
+ LINK_LIBS
+- clangAST
+- clangASTMatchers
+- clangBasic
+- clangLex
+- clangSerialization
+ clangTidy
+ clangTidyMiscModule
+ clangTidyModernizeModule
+ clangTidyReadabilityModule
+ clangTidyUtils
++ )
++
++clang_target_link_libraries(clangTidyCppCoreGuidelinesModule
++ PRIVATE
++ clangAST
++ clangASTMatchers
++ clangBasic
++ clangLex
++ clangSerialization
+ clangTooling
+ )
+diff --git a/tools/extra/clang-tidy/darwin/CMakeLists.txt b/tools/extra/clang-tidy/darwin/CMakeLists.txt
+index c650efb2a5f..feec79c12bf 100644
+--- a/tools/extra/clang-tidy/darwin/CMakeLists.txt
++++ b/tools/extra/clang-tidy/darwin/CMakeLists.txt
+@@ -6,11 +6,15 @@ add_clang_library(clangTidyDarwinModule
+ DispatchOnceNonstaticCheck.cpp
+
+ LINK_LIBS
++ clangTidy
++ clangTidyUtils
++ )
++
++clang_target_link_libraries(clangTidyDarwinModule
++ PRIVATE
+ clangAnalysis
+ clangAST
+ clangASTMatchers
+ clangBasic
+ clangLex
+- clangTidy
+- clangTidyUtils
+ )
+diff --git a/tools/extra/clang-tidy/fuchsia/CMakeLists.txt b/tools/extra/clang-tidy/fuchsia/CMakeLists.txt
+index 30b319e7e5a..0148b20f364 100644
+--- a/tools/extra/clang-tidy/fuchsia/CMakeLists.txt
++++ b/tools/extra/clang-tidy/fuchsia/CMakeLists.txt
+@@ -12,11 +12,15 @@ add_clang_library(clangTidyFuchsiaModule
+ VirtualInheritanceCheck.cpp
+
+ LINK_LIBS
++ clangTidy
++ clangTidyGoogleModule
++ clangTidyUtils
++ )
++
++clang_target_link_libraries(clangTidyFuchsiaModule
++ PRIVATE
+ clangAST
+ clangASTMatchers
+ clangBasic
+ clangLex
+- clangTidy
+- clangTidyGoogleModule
+- clangTidyUtils
+ )
+diff --git a/tools/extra/clang-tidy/google/CMakeLists.txt b/tools/extra/clang-tidy/google/CMakeLists.txt
+index 08368932da5..302561ba646 100644
+--- a/tools/extra/clang-tidy/google/CMakeLists.txt
++++ b/tools/extra/clang-tidy/google/CMakeLists.txt
+@@ -21,11 +21,15 @@ add_clang_library(clangTidyGoogleModule
+ UsingNamespaceDirectiveCheck.cpp
+
+ LINK_LIBS
++ clangTidy
++ clangTidyReadabilityModule
++ clangTidyUtils
++ )
++
++clang_target_link_libraries(clangTidyGoogleModule
++ PRIVATE
+ clangAST
+ clangASTMatchers
+ clangBasic
+ clangLex
+- clangTidy
+- clangTidyReadabilityModule
+- clangTidyUtils
+ )
+diff --git a/tools/extra/clang-tidy/hicpp/CMakeLists.txt b/tools/extra/clang-tidy/hicpp/CMakeLists.txt
+index 4cf26767f3d..b4c9eb7a445 100644
+--- a/tools/extra/clang-tidy/hicpp/CMakeLists.txt
++++ b/tools/extra/clang-tidy/hicpp/CMakeLists.txt
+@@ -8,11 +8,6 @@ add_clang_library(clangTidyHICPPModule
+ SignedBitwiseCheck.cpp
+
+ LINK_LIBS
+- clangAST
+- clangASTMatchers
+- clangBasic
+- clangLex
+- clangSerialization
+ clangTidy
+ clangTidyBugproneModule
+ clangTidyCppCoreGuidelinesModule
+@@ -23,3 +18,12 @@ add_clang_library(clangTidyHICPPModule
+ clangTidyReadabilityModule
+ clangTidyUtils
+ )
++
++clang_target_link_libraries(clangTidyHICPPModule
++ PRIVATE
++ clangAST
++ clangASTMatchers
++ clangBasic
++ clangLex
++ clangSerialization
++ )
+diff --git a/tools/extra/clang-tidy/linuxkernel/CMakeLists.txt b/tools/extra/clang-tidy/linuxkernel/CMakeLists.txt
+index f0e766d30e4..bfcc2ba526d 100644
+--- a/tools/extra/clang-tidy/linuxkernel/CMakeLists.txt
++++ b/tools/extra/clang-tidy/linuxkernel/CMakeLists.txt
+@@ -5,10 +5,14 @@ add_clang_library(clangTidyLinuxKernelModule
+ MustCheckErrsCheck.cpp
+
+ LINK_LIBS
++ clangTidy
++ clangTidyUtils
++ )
++
++clang_target_link_libraries(clangTidyLinuxKernelModule
++ PRIVATE
+ clangAST
+ clangASTMatchers
+ clangBasic
+ clangLex
+- clangTidy
+- clangTidyUtils
+ )
+diff --git a/tools/extra/clang-tidy/llvm/CMakeLists.txt b/tools/extra/clang-tidy/llvm/CMakeLists.txt
+index c035596b556..bff128cbba7 100644
+--- a/tools/extra/clang-tidy/llvm/CMakeLists.txt
++++ b/tools/extra/clang-tidy/llvm/CMakeLists.txt
+@@ -9,12 +9,16 @@ add_clang_library(clangTidyLLVMModule
+ TwineLocalCheck.cpp
+
+ LINK_LIBS
++ clangTidy
++ clangTidyReadabilityModule
++ clangTidyUtils
++ )
++
++clang_target_link_libraries(clangTidyLLVMModule
++ PRIVATE
+ clangAST
+ clangASTMatchers
+ clangBasic
+ clangLex
+- clangTidy
+- clangTidyReadabilityModule
+- clangTidyUtils
+ clangTooling
+ )
+diff --git a/tools/extra/clang-tidy/misc/CMakeLists.txt b/tools/extra/clang-tidy/misc/CMakeLists.txt
+index 3fc152148d6..37bc2aa5af6 100644
+--- a/tools/extra/clang-tidy/misc/CMakeLists.txt
++++ b/tools/extra/clang-tidy/misc/CMakeLists.txt
+@@ -17,13 +17,17 @@ add_clang_library(clangTidyMiscModule
+ UnusedUsingDeclsCheck.cpp
+
+ LINK_LIBS
++ clangTidy
++ clangTidyUtils
++ )
++
++clang_target_link_libraries(clangTidyMiscModule
++ PRIVATE
+ clangAnalysis
+ clangAST
+ clangASTMatchers
+ clangBasic
+ clangLex
+ clangSerialization
+- clangTidy
+- clangTidyUtils
+ clangTooling
+ )
+diff --git a/tools/extra/clang-tidy/modernize/CMakeLists.txt b/tools/extra/clang-tidy/modernize/CMakeLists.txt
+index 36193f0a6d1..162f44568c5 100644
+--- a/tools/extra/clang-tidy/modernize/CMakeLists.txt
++++ b/tools/extra/clang-tidy/modernize/CMakeLists.txt
+@@ -36,12 +36,16 @@ add_clang_library(clangTidyModernizeModule
+ UseUsingCheck.cpp
+
+ LINK_LIBS
++ clangTidy
++ clangTidyReadabilityModule
++ clangTidyUtils
++ )
++
++clang_target_link_libraries(clangTidyModernizeModule
++ PRIVATE
+ clangAST
+ clangASTMatchers
+ clangBasic
+ clangLex
+- clangTidy
+- clangTidyReadabilityModule
+- clangTidyUtils
+ clangTooling
+ )
+diff --git a/tools/extra/clang-tidy/mpi/CMakeLists.txt b/tools/extra/clang-tidy/mpi/CMakeLists.txt
+index 5be7b36550a..b36767ac7f3 100644
+--- a/tools/extra/clang-tidy/mpi/CMakeLists.txt
++++ b/tools/extra/clang-tidy/mpi/CMakeLists.txt
+@@ -6,13 +6,17 @@ add_clang_library(clangTidyMPIModule
+ TypeMismatchCheck.cpp
+
+ LINK_LIBS
++ clangTidy
++ clangTidyUtils
++ )
++
++clang_target_link_libraries(clangTidyMPIModule
++ PRIVATE
+ clangAnalysis
+ clangAST
+ clangASTMatchers
+ clangBasic
+ clangLex
+- clangTidy
+- clangTidyUtils
+ clangTooling
+ clangStaticAnalyzerCheckers
+ )
+diff --git a/tools/extra/clang-tidy/objc/CMakeLists.txt b/tools/extra/clang-tidy/objc/CMakeLists.txt
+index 68dda6530f7..3624d2f3ef0 100644
+--- a/tools/extra/clang-tidy/objc/CMakeLists.txt
++++ b/tools/extra/clang-tidy/objc/CMakeLists.txt
+@@ -9,10 +9,14 @@ add_clang_library(clangTidyObjCModule
+ SuperSelfCheck.cpp
+
+ LINK_LIBS
++ clangTidy
++ clangTidyUtils
++ )
++
++clang_target_link_libraries(clangTidyObjCModule
++ PRIVATE
+ clangAST
+ clangASTMatchers
+ clangBasic
+ clangLex
+- clangTidy
+- clangTidyUtils
+ )
+diff --git a/tools/extra/clang-tidy/openmp/CMakeLists.txt b/tools/extra/clang-tidy/openmp/CMakeLists.txt
+index af95704fd44..d182b29f366 100644
+--- a/tools/extra/clang-tidy/openmp/CMakeLists.txt
++++ b/tools/extra/clang-tidy/openmp/CMakeLists.txt
+@@ -8,9 +8,13 @@ add_clang_library(clangTidyOpenMPModule
+ UseDefaultNoneCheck.cpp
+
+ LINK_LIBS
++ clangTidy
++ clangTidyUtils
++ )
++
++clang_target_link_libraries(clangTidyOpenMPModule
++ PRIVATE
+ clangAST
+ clangASTMatchers
+ clangBasic
+- clangTidy
+- clangTidyUtils
+ )
+diff --git a/tools/extra/clang-tidy/performance/CMakeLists.txt b/tools/extra/clang-tidy/performance/CMakeLists.txt
+index d1f9897b015..c9a7e262124 100644
+--- a/tools/extra/clang-tidy/performance/CMakeLists.txt
++++ b/tools/extra/clang-tidy/performance/CMakeLists.txt
+@@ -18,11 +18,15 @@ add_clang_library(clangTidyPerformanceModule
+ UnnecessaryValueParamCheck.cpp
+
+ LINK_LIBS
++ clangTidy
++ clangTidyUtils
++ )
++
++clang_target_link_libraries(clangTidyPerformanceModule
++ PRIVATE
+ clangAST
+ clangASTMatchers
+ clangAnalysis
+ clangBasic
+ clangLex
+- clangTidy
+- clangTidyUtils
+ )
+diff --git a/tools/extra/clang-tidy/plugin/CMakeLists.txt b/tools/extra/clang-tidy/plugin/CMakeLists.txt
+index 4adc3f26977..0bfe122314e 100644
+--- a/tools/extra/clang-tidy/plugin/CMakeLists.txt
++++ b/tools/extra/clang-tidy/plugin/CMakeLists.txt
+@@ -2,12 +2,16 @@ add_clang_library(clangTidyPlugin
+ ClangTidyPlugin.cpp
+
+ LINK_LIBS
++ clangTidy
++ ${ALL_CLANG_TIDY_CHECKS}
++ )
++
++clang_target_link_libraries(clangTidyPlugin
++ PRIVATE
+ clangAST
+ clangASTMatchers
+ clangBasic
+ clangFrontend
+ clangSema
+- clangTidy
+ clangTooling
+- ${ALL_CLANG_TIDY_CHECKS}
+ )
+diff --git a/tools/extra/clang-tidy/portability/CMakeLists.txt b/tools/extra/clang-tidy/portability/CMakeLists.txt
+index 0420a18a2a6..bbe9ccbef1f 100644
+--- a/tools/extra/clang-tidy/portability/CMakeLists.txt
++++ b/tools/extra/clang-tidy/portability/CMakeLists.txt
+@@ -5,11 +5,15 @@ add_clang_library(clangTidyPortabilityModule
+ SIMDIntrinsicsCheck.cpp
+
+ LINK_LIBS
++ clangTidy
++ clangTidyUtils
++ )
++
++clang_target_link_libraries(clangTidyPortabilityModule
++ PRIVATE
+ clangAST
+ clangASTMatchers
+ clangBasic
+ clangLex
+- clangTidy
+- clangTidyUtils
+ clangTooling
+ )
+diff --git a/tools/extra/clang-tidy/readability/CMakeLists.txt b/tools/extra/clang-tidy/readability/CMakeLists.txt
+index 97144af06ca..5af900db5fd 100644
+--- a/tools/extra/clang-tidy/readability/CMakeLists.txt
++++ b/tools/extra/clang-tidy/readability/CMakeLists.txt
+@@ -41,11 +41,15 @@ add_clang_library(clangTidyReadabilityModule
+ UppercaseLiteralSuffixCheck.cpp
+
+ LINK_LIBS
++ clangTidy
++ clangTidyUtils
++ )
++
++clang_target_link_libraries(clangTidyReadabilityModule
++ PRIVATE
+ clangAST
+ clangASTMatchers
+ clangBasic
+ clangLex
+- clangTidy
+- clangTidyUtils
+ clangTooling
+ )
+diff --git a/tools/extra/clang-tidy/utils/CMakeLists.txt b/tools/extra/clang-tidy/utils/CMakeLists.txt
+index fc383a318b9..5c837ca79aa 100644
+--- a/tools/extra/clang-tidy/utils/CMakeLists.txt
++++ b/tools/extra/clang-tidy/utils/CMakeLists.txt
+@@ -18,11 +18,15 @@ add_clang_library(clangTidyUtils
+ UsingInserter.cpp
+
+ LINK_LIBS
++ clangTidy
++ )
++
++clang_target_link_libraries(clangTidyUtils
++ PRIVATE
+ clangAST
+ clangASTMatchers
+ clangBasic
+ clangLex
+ clangSema
+- clangTidy
+ clangTransformer
+ )
+diff --git a/tools/extra/clang-tidy/zircon/CMakeLists.txt b/tools/extra/clang-tidy/zircon/CMakeLists.txt
+index 7aa7cd3f669..71db5e90f25 100644
+--- a/tools/extra/clang-tidy/zircon/CMakeLists.txt
++++ b/tools/extra/clang-tidy/zircon/CMakeLists.txt
+@@ -5,10 +5,14 @@ add_clang_library(clangTidyZirconModule
+ ZirconTidyModule.cpp
+
+ LINK_LIBS
++ clangTidy
++ clangTidyUtils
++ )
++
++clang_target_link_libraries(clangTidyZirconModule
++ PRIVATE
+ clangAST
+ clangASTMatchers
+ clangBasic
+ clangLex
+- clangTidy
+- clangTidyUtils
+ )
+diff --git a/tools/extra/clangd/CMakeLists.txt b/tools/extra/clangd/CMakeLists.txt
+index e3eccb50a49..148043ee9df 100644
+--- a/tools/extra/clangd/CMakeLists.txt
++++ b/tools/extra/clangd/CMakeLists.txt
+@@ -110,6 +110,13 @@ add_clang_library(clangDaemon
+ refactor/Tweak.cpp
+
+ LINK_LIBS
++ clangTidy
++ ${LLVM_PTHREAD_LIB}
++ ${ALL_CLANG_TIDY_CHECKS}
++ )
++
++clang_target_link_libraries(clangDaemon
++ PRIVATE
+ clangAST
+ clangASTMatchers
+ clangBasic
+@@ -120,15 +127,11 @@ add_clang_library(clangDaemon
+ clangLex
+ clangSema
+ clangSerialization
+- clangTidy
+ clangTooling
+ clangToolingCore
+ clangToolingInclusions
+ clangToolingRefactoring
+ clangToolingSyntax
+- ${LLVM_PTHREAD_LIB}
+- ${CLANGD_ATOMIC_LIB}
+- ${ALL_CLANG_TIDY_CHECKS}
+ )
+
+ add_subdirectory(refactor/tweaks)
+diff --git a/tools/extra/clangd/unittests/CMakeLists.txt b/tools/extra/clangd/unittests/CMakeLists.txt
+index 62113c6e4bb..6c2b56c93d5 100644
+--- a/tools/extra/clangd/unittests/CMakeLists.txt
++++ b/tools/extra/clangd/unittests/CMakeLists.txt
+@@ -103,7 +103,6 @@ target_link_libraries(ClangdTests
+ PRIVATE
+ clangDaemon
+ clangTidy
+- LLVMSupport
+ LLVMTestingSupport
+ )
+
+--
+2.27.0
+
diff --git a/sys-devel/clang/files/10.0.1/0004-clang-Avoid-linking-c-index-test-to-duplicate-librar.patch b/sys-devel/clang/files/10.0.1/0004-clang-Avoid-linking-c-index-test-to-duplicate-librar.patch
new file mode 100644
index 000000000000..61bec21d6925
--- /dev/null
+++ b/sys-devel/clang/files/10.0.1/0004-clang-Avoid-linking-c-index-test-to-duplicate-librar.patch
@@ -0,0 +1,29 @@
+From e0df57328dd084d38ea4aac0cfb129fc320eae3f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Fri, 19 Jun 2020 17:00:12 +0200
+Subject: [PATCH 4/4] [clang] Avoid linking c-index-test to duplicate libraries
+
+Use clang_target_link_libraries() to link libraries included
+in clang-cpp.so to avoid simultaneously linking to it and to split
+static libraries. This prevents units from being included twice.
+---
+ tools/c-index-test/CMakeLists.txt | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/tools/c-index-test/CMakeLists.txt b/tools/c-index-test/CMakeLists.txt
+index ceef4b08637..d83d1091936 100644
+--- a/tools/c-index-test/CMakeLists.txt
++++ b/tools/c-index-test/CMakeLists.txt
+@@ -25,6 +25,9 @@ else()
+ target_link_libraries(c-index-test
+ PRIVATE
+ libclang
++ )
++ clang_target_link_libraries(c-index-test
++ PRIVATE
+ clangAST
+ clangBasic
+ clangCodeGen
+--
+2.27.0
+