bundle llvm7.0 (on aarch64)

Resolves: rhbz#1918080

- drop unused dwarf
- drop unused gnupg check
- the llvm bundling is mostly taken from rhel8
This commit is contained in:
Jens Petersen 2021-06-16 15:34:44 +08:00
parent 26a05fbd63
commit 440c5930cf
6 changed files with 248 additions and 27 deletions

View File

@ -0,0 +1,27 @@
From 1e0f1c5481a96d760f7840d4dde103353a0131f8 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
Date: Thu, 30 Aug 2018 11:38:51 -0700
Subject: [PATCH] CMake: Don't prefer python2.7
---
CMakeLists.txt | 4 ----
1 file changed, 4 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 31df640..2603f1c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -613,10 +613,6 @@ message(STATUS "LLVM default target triple: ${LLVM_DEFAULT_TARGET_TRIPLE}")
include(HandleLLVMOptions)
-# Verify that we can find a Python 2 interpreter. Python 3 is unsupported.
-# FIXME: We should support systems with only Python 3, but that requires work
-# on LLDB.
-set(Python_ADDITIONAL_VERSIONS 2.7)
include(FindPythonInterp)
if( NOT PYTHONINTERP_FOUND )
message(FATAL_ERROR
--
1.8.3.1

View File

@ -0,0 +1,24 @@
From e67ace2ecb42c24e124f1738dc67b22055a22500 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
Date: Thu, 13 Sep 2018 10:10:08 -0700
Subject: [PATCH] Don't set rpath when installing
---
cmake/modules/AddLLVM.cmake | 1 +
1 file changed, 1 insertion(+)
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
index ce2057f..de309b5 100644
--- a/cmake/modules/AddLLVM.cmake
+++ b/cmake/modules/AddLLVM.cmake
@@ -1621,6 +1621,7 @@ function(llvm_codesign name)
endfunction()
function(llvm_setup_rpath name)
+ return()
if(CMAKE_INSTALL_RPATH)
return()
endif()
--
1.8.3.1

View File

@ -0,0 +1,60 @@
From 2ad5ac11b17dac347d29191872b2b3d601bbcd1f Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas@devlieghere.com>
Date: Fri, 21 Sep 2018 12:03:14 +0000
Subject: [PATCH 1/2] Ensure that variant part discriminator is read by
MetadataLoader
https://reviews.llvm.org/D42082 introduced variant parts to debug info
in LLVM. Subsequent work on the Rust compiler has found a bug in that
patch; namely, there is a path in MetadataLoader that fails to restore
the discriminator.
This patch fixes the bug.
Patch by: Tom Tromey
Differential revision: https://reviews.llvm.org/D52340
llvm-svn: 342725
---
llvm/lib/Bitcode/Reader/MetadataLoader.cpp | 2 +-
llvm/test/Assembler/debug-variant-discriminator.ll | 14 ++++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
create mode 100644 llvm/test/Assembler/debug-variant-discriminator.ll
diff --git a/lib/Bitcode/Reader/MetadataLoader.cpp b/lib/Bitcode/Reader/MetadataLoader.cpp
index 011c41e2cecd..a7b542efc19e 100644
--- a/lib/Bitcode/Reader/MetadataLoader.cpp
+++ b/lib/Bitcode/Reader/MetadataLoader.cpp
@@ -1308,7 +1308,7 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
(Context, Tag, Name, File, Line, Scope, BaseType,
SizeInBits, AlignInBits, OffsetInBits, Flags,
Elements, RuntimeLang, VTableHolder, TemplateParams,
- Identifier));
+ Identifier, Discriminator));
if (!IsNotUsedInTypeRef && Identifier)
MetadataList.addTypeRef(*Identifier, *cast<DICompositeType>(CT));
diff --git a/test/Assembler/debug-variant-discriminator.ll b/test/Assembler/debug-variant-discriminator.ll
new file mode 100644
index 000000000000..5be001cad6be
--- /dev/null
+++ b/test/Assembler/debug-variant-discriminator.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
+; RUN: verify-uselistorder %s
+
+; CHECK: !named = !{!0, !1, !2}
+!named = !{!0, !1, !2}
+
+; CHECK: !0 = !DICompositeType(tag: DW_TAG_structure_type, name: "Outer", size: 64, align: 64, identifier: "Outer")
+; CHECK-NEXT: !1 = !DICompositeType(tag: DW_TAG_variant_part, scope: !0, size: 64, discriminator: !2)
+; CHECK-NEXT: !2 = !DIDerivedType(tag: DW_TAG_member, scope: !1, baseType: !3, size: 64, align: 64, flags: DIFlagArtificial)
+; CHECK-NEXT: !3 = !DIBasicType(name: "u64", size: 64, encoding: DW_ATE_unsigned)
+!0 = !DICompositeType(tag: DW_TAG_structure_type, name: "Outer", size: 64, align: 64, identifier: "Outer")
+!1 = !DICompositeType(tag: DW_TAG_variant_part, scope: !0, size: 64, discriminator: !2)
+!2 = !DIDerivedType(tag: DW_TAG_member, scope: !1, baseType: !3, size: 64, align: 64, flags: DIFlagArtificial)
+!3 = !DIBasicType(name: "u64", size: 64, encoding: DW_ATE_unsigned)
--
2.20.1

View File

@ -0,0 +1,28 @@
From 9bfebd6e47cb8513dcd7f7203f29489bdec7bfe4 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas@devlieghere.com>
Date: Fri, 21 Sep 2018 12:28:44 +0000
Subject: [PATCH 2/2] [test] Fix Assembler/debug-info.ll
Update Assembler/debug-info.ll to contain discriminator.
llvm-svn: 342727
---
llvm/test/Assembler/debug-info.ll | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/Assembler/debug-info.ll b/test/Assembler/debug-info.ll
index 5dfb8cd93435..605afc3f1587 100644
--- a/test/Assembler/debug-info.ll
+++ b/test/Assembler/debug-info.ll
@@ -83,7 +83,7 @@
; CHECK-NEXT: !32 = !DIFile(filename: "file", directory: "dir", checksumkind: CSK_MD5, checksum: "000102030405060708090a0b0c0d0e0f")
!35 = !DIFile(filename: "file", directory: "dir", checksumkind: CSK_MD5, checksum: "000102030405060708090a0b0c0d0e0f")
-; CHECK-NEXT: !33 = !DICompositeType(tag: DW_TAG_variant_part, name: "A", scope: !14, size: 64)
+; CHECK-NEXT: !33 = !DICompositeType(tag: DW_TAG_variant_part, name: "A", scope: !14, size: 64, discriminator: !34)
; CHECK-NEXT: !34 = !DIDerivedType(tag: DW_TAG_member, scope: !33, baseType: !35, size: 64, align: 64, flags: DIFlagArtificial)
; CHECK-NEXT: !35 = !DIBasicType(name: "u64", size: 64, encoding: DW_ATE_unsigned)
!36 = !DICompositeType(tag: DW_TAG_variant_part, name: "A", scope: !16, size: 64, discriminator: !37)
--
2.20.1

135
ghc.spec
View File

@ -23,12 +23,6 @@
%bcond_without perf_build
%endif
# to enable dwarf info (only on intel archs): overrides perf
# default is off: bcond_with
%ifarch x86_64 i686
%bcond_with dwarf
%endif
# locked together since disabling haddock causes no manuals built
# and disabling haddock still created index.html
# https://ghc.haskell.org/trac/ghc/ticket/15190
@ -39,6 +33,7 @@
# 8.8 needs llvm-7.0
%global llvm_major 7.0
%global llvm_version %{llvm_major}.1
%global ghc_llvm_archs armv7hl aarch64
%global ghc_unregisterized_arches s390 s390x %{mips} riscv64
@ -49,7 +44,7 @@ Version: 8.8.4
# - release can only be reset if *all* library versions get bumped simultaneously
# (sometimes after a major release)
# - minor release numbers for a branch should be incremented monotonically
Release: 110%{?dist}
Release: 111%{?dist}
Summary: Glasgow Haskell Compiler
License: BSD and HaskellReport
@ -62,6 +57,9 @@ Source2: https://downloads.haskell.org/ghc/%{ghc_release}/ghc-%{version}-src.tar
Source5: ghc-pkg.man
Source6: haddock.man
Source7: runghc.man
Source10: http://llvm.org/releases/%{llvm_version}/llvm-%{llvm_version}.src.tar.xz
# absolute haddock path (was for html/libraries -> libraries)
Patch1: ghc-gen_contents_index-haddock-path.patch
Patch2: ghc-Cabal-install-PATH-warning.patch
@ -93,6 +91,12 @@ Patch24: buildpath-abi-stability.patch
Patch26: no-missing-haddock-file-warning.patch
Patch28: x32-use-native-x86_64-insn.patch
# llvm7.0 patches + 100
Patch114: 0001-CMake-Don-t-prefer-python2.7.patch
Patch115: 0001-Don-t-set-rpath-when-installing.patch
Patch116: 0001-Ensure-that-variant-part-discriminator-is-read-by-Me.patch
Patch117: 0002-test-Fix-Assembler-debug-info.ll.patch
# fedora ghc has been bootstrapped on
# %%{ix86} x86_64 ppc ppc64 armv7hl s390 s390x ppc64le aarch64
# and retired arches: alpha sparcv9 armv5tel
@ -124,19 +128,24 @@ BuildRequires: python3
%if %{with manual}
BuildRequires: python3-sphinx
%endif
%ifarch %{ghc_llvm_archs}
BuildRequires: llvm%{llvm_major}
%endif
%if %{with dwarf}
BuildRequires: elfutils-devel
%endif
%ifarch armv7hl
# patch12
BuildRequires: autoconf, automake
%endif
%if %{without quickbuild}
#BuildRequires: gnupg2
# for building llvm
%ifarch %{ghc_llvm_archs}
BuildRequires: gcc-c++
BuildRequires: cmake
BuildRequires: ninja-build
BuildRequires: zlib-devel
BuildRequires: libedit-devel
BuildRequires: libffi-devel
BuildRequires: ncurses-devel
BuildRequires: valgrind-devel
BuildRequires: libstdc++-static
%endif
Requires: ghc-compiler = %{version}-%{release}
Requires: ghc-ghc-devel = %{version}-%{release}
Requires: ghc-devel = %{version}-%{release}
@ -184,9 +193,6 @@ Requires: ghc-base-devel%{?_isa} = %{base_ver}-%{release}
# added during f31
Obsoletes: ghc-doc-index < %{version}-%{release}
%endif
%ifarch %{ghc_llvm_archs}
Requires: llvm%{llvm_major}
%endif
%description compiler
The package contains the GHC compiler, tools and utilities.
@ -301,10 +307,18 @@ packages to be automatically installed too.
%prep
%if %{without quickbuild}
#%%{gpgverify} --keyring='%{SOURCE3}' --signature='%{SOURCE2}' --data='%{SOURCE0}'
%endif
%ifarch %{ghc_llvm_archs}
%setup -q -n %{name}-%{version} %{?with_testsuite:-b1} -a10
(
cd llvm-%{llvm_version}.src
%patch114 -p1
%patch115 -p1
%patch116 -p1
%patch117 -p1
)
%else
%setup -q -n %{name}-%{version} %{?with_testsuite:-b1}
%endif
%patch1 -p1 -b .orig
%patch3 -p1 -b .orig
@ -347,12 +361,8 @@ cat > mk/build.mk << EOF
%ifarch %{ghc_llvm_archs}
BuildFlavour = perf-llvm
%else
%if %{with dwarf}
BuildFlavour = dwarf
%else
BuildFlavour = perf
%endif
%endif
%else
%ifarch %{ghc_llvm_archs}
BuildFlavour = quick-llvm
@ -378,6 +388,52 @@ BUILD_SPHINX_PDF = NO
EOF
%build
%ifarch %{ghc_llvm_archs}
%global _vpath_builddir .
(
cd llvm-%{llvm_version}.src
mkdir -p _build
cd _build
%cmake .. -G Ninja \
-DBUILD_SHARED_LIBS:BOOL=OFF \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX=%{buildroot}%{ghclibdir}/llvm \
-DLLVM_TARGETS_TO_BUILD="X86;AArch64" \
-DLLVM_ENABLE_LIBCXX:BOOL=OFF \
-DLLVM_ENABLE_ZLIB:BOOL=ON \
-DLLVM_ENABLE_FFI:BOOL=ON \
-DLLVM_ENABLE_RTTI:BOOL=ON \
\
-DLLVM_BUILD_RUNTIME:BOOL=ON \
\
-DLLVM_INCLUDE_TOOLS:BOOL=ON \
-DLLVM_BUILD_TOOLS:BOOL=ON \
\
-DLLVM_INCLUDE_TESTS:BOOL=OFF \
-DLLVM_BUILD_TESTS:BOOL=OFF \
\
-DLLVM_INCLUDE_EXAMPLES:BOOL=OFF \
-DLLVM_BUILD_EXAMPLES:BOOL=OFF \
\
-DLLVM_INCLUDE_UTILS:BOOL=OFF \
-DLLVM_INSTALL_UTILS:BOOL=OFF \
\
-DLLVM_INCLUDE_DOCS:BOOL=OFF \
-DLLVM_BUILD_DOCS:BOOL=OFF \
-DLLVM_ENABLE_SPHINX:BOOL=OFF \
-DLLVM_ENABLE_DOXYGEN:BOOL=OFF \
-DSPHINX_OUTPUT_HTML:BOOL=OFF \
-DSPHINX_WARNINGS_AS_ERRORS:BOOL=OFF \
\
-DLLVM_BUILD_LLVM_DYLIB:BOOL=ON \
-DLLVM_LINK_LLVM_DYLIB:BOOL=ON \
-DLLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL=ON \
-DLLVM_INSTALL_TOOLCHAIN_ONLY:BOOL=OFF \
ninja -v %{?_smp_mflags}
)
%endif
# for patch12
%ifarch armv7hl
autoreconf
@ -395,10 +451,14 @@ export CC=%{_bindir}/gcc
--sharedstatedir=%{_sharedstatedir} --mandir=%{_mandir} \
--docdir=%{_docdir}/ghc \
--with-system-libffi \
%ifarch %{ghc_llvm_archs}
--with-llc=$PWD/llvm-%{llvm_version}.src/_build/bin/llc --with-opt=$PWD/llvm-%{llvm_version}.src/_build/bin/opt \
%else
--with-llc=%{_bindir}/llc-%{llvm_major} --with-opt=%{_bindir}/opt-%{llvm_major} \
%endif
%ifarch %{ghc_unregisterized_arches}
--enable-unregisterised \
%endif
%{?with_dwarf:--enable-dwarf-unwind} \
%{nil}
# avoid "ghc: hGetContents: invalid argument (invalid byte sequence)"
@ -407,11 +467,19 @@ make %{?_smp_mflags}
%install
%ifarch %{ghc_llvm_archs}
(
cd llvm-%{llvm_version}.src
cd _build
ninja -v install
)
%endif
make DESTDIR=%{buildroot} install
%if %{defined _ghcdynlibdir}
mv %{buildroot}%{ghclibdir}/*/libHS*ghc%{ghc_version}.so %{buildroot}%{_ghcdynlibdir}/
for i in $(find %{buildroot} -type f -executable -exec sh -c "file {} | grep -q 'dynamically linked'" \; -print); do
for i in $(find %{buildroot} -path %{buildroot}%{ghclibdir}/llvm -prune -o -type f -executable -exec sh -c "file {} | grep -q 'dynamically linked'" \; -print); do
chrpath -d $i
done
for i in %{buildroot}%{ghclibdir}/package.conf.d/*.conf; do
@ -481,6 +549,12 @@ install -p -m 0644 %{SOURCE5} %{buildroot}%{_mandir}/man1/ghc-pkg.1
install -p -m 0644 %{SOURCE6} %{buildroot}%{_mandir}/man1/haddock.1
install -p -m 0644 %{SOURCE7} %{buildroot}%{_mandir}/man1/runghc.1
# fix llvm paths
%ifarch %{ghc_llvm_archs}
sed -i -e "s!$PWD/llvm-%{llvm_version}.src/_build!%{ghclibdir}/llvm!" %{buildroot}%{ghclibdir}/settings
%endif
%check
export LANG=en_US.utf8
# stolen from ghc6/debian/rules:
@ -582,6 +656,10 @@ env -C %{ghc_html_libraries_dir} ./gen_contents_index
%{ghclibdir}/bin/hsc2hs
%{ghclibdir}/bin/ghc-iserv
%{ghclibdir}/bin/ghc-iserv-dyn
%ifarch %{ghc_llvm_archs}
%license llvm-%{llvm_version}.src/LICENSE.TXT
%{ghclibdir}/llvm
%endif
%if %{with ghc_prof}
%{ghclibdir}/bin/ghc-iserv-prof
%endif
@ -657,6 +735,9 @@ env -C %{ghc_html_libraries_dir} ./gen_contents_index
%changelog
* Wed Jun 16 2021 Jens Petersen <petersen@redhat.com> - 8.8.4-111
- bundle llvm7.0 on aarch64 (#1918080)
* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com> - 8.8.4-110
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937

View File

@ -1,2 +1,3 @@
SHA512 (ghc-8.8.4-src.tar.xz.sig) = 1ed2e64e8b75a147d7c66b0018119f54ac740131b6f74612aa975c9120d8f7a8a2286829cef22ef2cd16262af0604659daa41c09ef3bdec6c22b8d086fbc1166
SHA512 (ghc-8.8.4-src.tar.xz) = efd23bd819f7429486696a3a929a040471db7ea8a2d1f1d832e4cf0825b9e1e0c5e6ecad0ab8376f58b74e9c28c1d2f773bd126596d6d853c9e57d57e5ceb090
SHA512 (llvm-7.0.1.src.tar.xz) = ac43a3cb71a53deb55e3693653847cf20bf6f5d9056f224e6956c96d63bc59ebee9404f088eec9cabe65337b4607a905ef931354b373cf64e0004c6905a6b5df