Backport upstream patch to fix build with -flto.

Also disable LTO on s390x to work-around unit test failures.
This commit is contained in:
Tom Stellard 2020-08-04 13:29:13 -07:00
parent a58113d73c
commit 40207a4ea9
2 changed files with 65 additions and 1 deletions

View File

@ -0,0 +1,50 @@
From 352558e69b3691cfdc8e1adc2a1fbb737bc67cbb 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 12:16:52 +0200
Subject: [PATCH] [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.
Differential Revision: https://reviews.llvm.org/D81921
---
llvm/tools/llvm-cfi-verify/lib/CMakeLists.txt | 20 +++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/llvm/tools/llvm-cfi-verify/lib/CMakeLists.txt b/llvm/tools/llvm-cfi-verify/lib/CMakeLists.txt
index 82ca42e624a..41d55ed9321 100644
--- a/llvm/tools/llvm-cfi-verify/lib/CMakeLists.txt
+++ b/llvm/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.18.1

View File

@ -11,7 +11,7 @@
%global llvm_libdir %{_libdir}/%{name}
%global build_llvm_libdir %{buildroot}%{llvm_libdir}
#%%global rc_ver 6
%global baserelease 9
%global baserelease 10
%global llvm_srcdir llvm-%{version}%{?rc_ver:rc%{rc_ver}}.src
%global maj_ver 10
%global min_ver 0
@ -62,6 +62,7 @@ Patch0: 0001-CMake-Split-static-library-exports-into-their-own-ex.patch
Patch1: 0001-CMake-Split-test-binary-exports-into-their-own-expor.patch
%endif
Patch2: bab5908df544680ada0a3cf431f55aeccfbdb321.patch
Patch3: 0001-llvm-Avoid-linking-llvm-cfi-verify-to-duplicate-libs.patch
BuildRequires: gcc
BuildRequires: gcc-c++
@ -175,6 +176,15 @@ pathfix.py -i %{__python3} -pn \
%build
# Disable LTO on s390x, this causes some test failures:
# LLVM-Unit :: Target/AArch64/./AArch64Tests/InstSizes.Authenticated
# LLVM-Unit :: Target/AArch64/./AArch64Tests/InstSizes.PATCHPOINT
# LLVM-Unit :: Target/AArch64/./AArch64Tests/InstSizes.STACKMAP
# LLVM-Unit :: Target/AArch64/./AArch64Tests/InstSizes.TLSDESC_CALLSEQ
%ifarch s390x
%global _lto_cflags %{nil}
%endif
%ifarch s390 %{arm} %ix86
# Decrease debuginfo verbosity to reduce memory consumption during final library linking
%global optflags %(echo %{optflags} | sed 's/-g /-g1 /')
@ -517,6 +527,10 @@ fi
%endif
%changelog
* Tue Aug 04 2020 Tom Stellard <tstellar@redhat.com> - 10.0.0-10
- Backport upstream patch to fix build with -flto.
- Disable LTO on s390x to work-around unit test failures.
* Sat Aug 01 2020 sguelton@redhat.com - 10.0.0-9
- Fix update-alternative uninstall script