From 841ecbf26050fc2a3f4a301817d75b6671a2603d Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Fri, 19 Jun 2020 18:05:33 +0200 Subject: sys-devel/llvm: Patch bad dylib linking in 10.0.1* MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- ...linking-llvm-cfi-verify-to-duplicate-libs.patch | 48 ++++++++++++++++++++++ ...vm-Disable-linking-llvm-exegesis-to-dylib.patch | 29 +++++++++++++ sys-devel/llvm/llvm-10.0.1.9999.ebuild | 4 ++ sys-devel/llvm/llvm-10.0.1_rc1.ebuild | 4 ++ 4 files changed, 85 insertions(+) create mode 100644 sys-devel/llvm/files/10.0.1/0001-llvm-Avoid-linking-llvm-cfi-verify-to-duplicate-libs.patch create mode 100644 sys-devel/llvm/files/10.0.1/0002-llvm-Disable-linking-llvm-exegesis-to-dylib.patch (limited to 'sys-devel/llvm') diff --git a/sys-devel/llvm/files/10.0.1/0001-llvm-Avoid-linking-llvm-cfi-verify-to-duplicate-libs.patch b/sys-devel/llvm/files/10.0.1/0001-llvm-Avoid-linking-llvm-cfi-verify-to-duplicate-libs.patch new file mode 100644 index 000000000000..2c2222a21bcf --- /dev/null +++ b/sys-devel/llvm/files/10.0.1/0001-llvm-Avoid-linking-llvm-cfi-verify-to-duplicate-libs.patch @@ -0,0 +1,48 @@ +From bc3be897be6994da7f52ba1b5735aa81150084a4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= +Date: Tue, 16 Jun 2020 12:16:52 +0200 +Subject: [PATCH 1/4] [llvm] Avoid linking llvm-cfi-verify to duplicate libs + +Fix the CMake rules for LLVMCFIVerify library not to pull duplicate +LLVM .a libraries when linking to the dylib. This prevents problems +due to duplicate symbols and apparently fixes mingw32. + +This is an alternative approach to D44650 that just forces .a libraries +instead. However, there doesn't seem to be any reason to do that. +--- + tools/llvm-cfi-verify/lib/CMakeLists.txt | 20 +++++++++++-------- + 1 file changed, 12 insertions(+), 8 deletions(-) + +diff --git a/tools/llvm-cfi-verify/lib/CMakeLists.txt b/tools/llvm-cfi-verify/lib/CMakeLists.txt +index 82ca42e624a..41d55ed9321 100644 +--- a/tools/llvm-cfi-verify/lib/CMakeLists.txt ++++ b/tools/llvm-cfi-verify/lib/CMakeLists.txt +@@ -7,13 +7,17 @@ add_library(LLVMCFIVerify + ) + + llvm_update_compile_flags(LLVMCFIVerify) +-llvm_map_components_to_libnames(libs +- DebugInfoDWARF +- MC +- MCParser +- Object +- Support +- Symbolize +- ) ++if (LLVM_LINK_LLVM_DYLIB) ++ set(libs LLVM) ++else() ++ llvm_map_components_to_libnames(libs ++ DebugInfoDWARF ++ MC ++ MCParser ++ Object ++ Support ++ Symbolize ++ ) ++endif() + target_link_libraries(LLVMCFIVerify ${libs}) + set_target_properties(LLVMCFIVerify PROPERTIES FOLDER "Libraries") +-- +2.27.0 + diff --git a/sys-devel/llvm/files/10.0.1/0002-llvm-Disable-linking-llvm-exegesis-to-dylib.patch b/sys-devel/llvm/files/10.0.1/0002-llvm-Disable-linking-llvm-exegesis-to-dylib.patch new file mode 100644 index 000000000000..3dcfad0a5138 --- /dev/null +++ b/sys-devel/llvm/files/10.0.1/0002-llvm-Disable-linking-llvm-exegesis-to-dylib.patch @@ -0,0 +1,29 @@ +From 07b6fdcde1ed64043244965b97788a2b12af4d6d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= +Date: Tue, 16 Jun 2020 12:31:36 +0200 +Subject: [PATCH 2/4] [llvm] Disable linking llvm-exegesis to dylib + +Force linking llvm-exegesis to static LLVM libraries instead of dylib +to prevent duplicate symbols due to linking both. Ideally, we'd want +to link to the dylib only here but the target sub-libraries use hidden +symbols from LLVM target libraries and therefore linking the dylib +fails. +--- + tools/llvm-exegesis/CMakeLists.txt | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tools/llvm-exegesis/CMakeLists.txt b/tools/llvm-exegesis/CMakeLists.txt +index a59e1b74024..0575f2a06bb 100644 +--- a/tools/llvm-exegesis/CMakeLists.txt ++++ b/tools/llvm-exegesis/CMakeLists.txt +@@ -5,6 +5,7 @@ set(LLVM_LINK_COMPONENTS + ) + + add_llvm_tool(llvm-exegesis ++ DISABLE_LLVM_LINK_LLVM_DYLIB + llvm-exegesis.cpp + ) + +-- +2.27.0 + diff --git a/sys-devel/llvm/llvm-10.0.1.9999.ebuild b/sys-devel/llvm/llvm-10.0.1.9999.ebuild index f308f41ee444..ccddd737630b 100644 --- a/sys-devel/llvm/llvm-10.0.1.9999.ebuild +++ b/sys-devel/llvm/llvm-10.0.1.9999.ebuild @@ -174,6 +174,10 @@ src_prepare() { # https://bugs.gentoo.org/show_bug.cgi?id=565358 eapply "${FILESDIR}"/9999/0007-llvm-config-Clean-up-exported-values-update-for-shar.patch + # Fix linking to dylib and .a libs simultaneously + eapply "${FILESDIR}"/10.0.1/0001-llvm-Avoid-linking-llvm-cfi-verify-to-duplicate-libs.patch + eapply "${FILESDIR}"/10.0.1/0002-llvm-Disable-linking-llvm-exegesis-to-dylib.patch + # disable use of SDK on OSX, bug #568758 sed -i -e 's/xcrun/false/' utils/lit/lit/util.py || die diff --git a/sys-devel/llvm/llvm-10.0.1_rc1.ebuild b/sys-devel/llvm/llvm-10.0.1_rc1.ebuild index 59ccce098614..69e7f467ecd8 100644 --- a/sys-devel/llvm/llvm-10.0.1_rc1.ebuild +++ b/sys-devel/llvm/llvm-10.0.1_rc1.ebuild @@ -142,6 +142,10 @@ src_prepare() { # https://bugs.gentoo.org/show_bug.cgi?id=565358 eapply "${FILESDIR}"/9999/0007-llvm-config-Clean-up-exported-values-update-for-shar.patch + # Fix linking to dylib and .a libs simultaneously + eapply "${FILESDIR}"/10.0.1/0001-llvm-Avoid-linking-llvm-cfi-verify-to-duplicate-libs.patch + eapply "${FILESDIR}"/10.0.1/0002-llvm-Disable-linking-llvm-exegesis-to-dylib.patch + # disable use of SDK on OSX, bug #568758 sed -i -e 's/xcrun/false/' utils/lit/lit/util.py || die -- cgit v1.2.3-65-gdbad