Update to LLVM 16.0.0 and a couple of improvements

1. Replace 0001-Changes-the-path-to-gtest.patch with the usage of
   LLVM_COMMON_CMAKE_UTILS.
2. Replace the entire cmake source code with
   0001-Flang-Fix-CMakePolicy.cmake.patch.
3. Added a patch that fixes a test for the trile ppc64le-redhat-linux.
This commit is contained in:
Tulio Magno Quites Machado Filho 2023-03-23 14:56:37 -03:00
parent 37cac20d19
commit dff62cc194
5 changed files with 71 additions and 44 deletions

View File

@ -1,25 +0,0 @@
From 5d33b53c9330c3687ac11cc749e81fc0dae4ca7f Mon Sep 17 00:00:00 2001
From: Tulio Magno Quites Machado Filho <tuliom@redhat.com>
Date: Mon, 20 Feb 2023 14:57:29 -0300
Subject: [PATCH] Changes the path to gtest
---
flang/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt
index b048ea220e20..03bbfd9b8ec0 100644
--- a/flang/CMakeLists.txt
+++ b/flang/CMakeLists.txt
@@ -171,7 +171,7 @@ if (FLANG_STANDALONE_BUILD)
#Handle unittests when out-of-tree
set(FLANG_GTEST_AVAIL 0)
if (FLANG_INCLUDE_TESTS)
- set(UNITTEST_DIR ${LLVM_THIRD_PARTY_DIR}/unittest)
+ set(UNITTEST_DIR ${LLVM_MAIN_SRC_DIR}/utils/unittest)
if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h)
if (NOT TARGET llvm_gtest)
add_subdirectory(${UNITTEST_DIR} third-party/unittest)
--
2.39.1

View File

@ -0,0 +1,30 @@
From defdc076b6030e724ac4c8b52142b97950fa1648 Mon Sep 17 00:00:00 2001
From: Tulio Magno Quites Machado Filho <tuliom@redhat.com>
Date: Thu, 23 Mar 2023 09:18:23 -0300
Subject: [PATCH] [Flang] Fix CMakePolicy.cmake
Let LLVM_COMMON_CMAKE_UTILS store the directory where cmake modules are
available and stop assuming its directory structure.
---
flang/CMakeLists.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt
index 03bbfd9b8ec0..62f69f52b2e5 100644
--- a/flang/CMakeLists.txt
+++ b/flang/CMakeLists.txt
@@ -1,9 +1,9 @@
cmake_minimum_required(VERSION 3.13.4)
if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
- set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
+ set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules)
endif()
-include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake
+include(${LLVM_COMMON_CMAKE_UTILS}/CMakePolicy.cmake
NO_POLICY_SCOPE)
set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
--
2.39.2

View File

@ -0,0 +1,26 @@
From a17ee723f05887f291937750c81ea86422f7e4fd Mon Sep 17 00:00:00 2001
From: Tulio Magno Quites Machado Filho <tuliom@redhat.com>
Date: Thu, 23 Mar 2023 08:25:14 -0300
Subject: [PATCH] [PowerPC][Flang] Fix triple
Some Linux distributions use ppc64le instead of powerpc.
---
flang/test/Driver/fast_math.f90 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/flang/test/Driver/fast_math.f90 b/flang/test/Driver/fast_math.f90
index aadd7231b52b..8a63832e2259 100644
--- a/flang/test/Driver/fast_math.f90
+++ b/flang/test/Driver/fast_math.f90
@@ -58,7 +58,7 @@
! Check that -ffast-math causes us to link to crtfastmath.o
! UNSUPPORTED: system-windows
-! UNSUPPORTED: target=powerpc{{.*}}
+! UNSUPPORTED: target={{(ppc|powerpc).*}}
! RUN: %flang -ffast-math -### %s -o %t 2>&1 \
! RUN: | FileCheck --check-prefix=CHECK-CRT %s
! CHECK-CRT: {{crtbegin.?\.o}}
--
2.39.2

View File

@ -1,7 +1,7 @@
%global maj_ver 16
%global min_ver 0
%global patch_ver 0
%global rc_ver 4
#global rc_ver 4
%global flang_version %{maj_ver}.%{min_ver}.%{patch_ver}
%global flang_srcdir flang-%{flang_version}%{?rc_ver:rc%{rc_ver}}.src
%global cmake_srcdir cmake-%{flang_version}%{?rc_ver:rc%{rc_ver}}.src
@ -24,15 +24,12 @@ Source2: release-keys.asc
# flang depends on one internal clang tablegen file for documentation generation.
Source3: https://raw.githubusercontent.com/llvm/llvm-project/llvmorg-%{flang_version}%{?rc_ver:-rc%{rc_ver}}/clang/include/clang/Driver/Options.td
Source4: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{flang_version}%{?rc_ver:-rc%{rc_ver}}/%{cmake_srcdir}.tar.xz
Source5: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{flang_version}%{?rc_ver:-rc%{rc_ver}}/%{cmake_srcdir}.tar.xz.sig
Source6: TestAliasAnalysis.h
Source4: TestAliasAnalysis.h
# Needed for documentation generation
Patch1: 0001-PATCH-flang-Disable-use-of-sphinx_markdown_tables.patch
Patch2: 0001-Changes-the-path-to-gtest.patch
Patch2: 0001-Flang-Fix-CMakePolicy.cmake.patch
# The Bye plugin is not distributed on Fedora.
Patch3: 0001-flang-Remove-the-dependency-on-Bye.patch
@ -43,6 +40,9 @@ Patch4: remove-clangBasic-dependency.diff
# Fedora uses CLANG_DEFAULT_PIE_ON_LINUX=OFF.
Patch5: 0001-Match-Fedora-s-value-for-CLANG_DEFAULT_PIE_ON_LINUX.patch
# Fedora and RHEL use a different triple for ppc64le
Patch6: 0001-PowerPC-Flang-Fix-triple.patch
# Backports from LLVM 17:
Patch20: 0001-flang-Fixed-restrictions-checking-for-OpenACC-loop-a.patch
Patch21: 0001-flang-Fixed-uninitialized-std-unique_ptr-dereference.patch
@ -74,6 +74,7 @@ BuildRequires: ninja-build
BuildRequires: python3-lit >= 12.0.0
BuildRequires: python3-sphinx
BuildRequires: python3-recommonmark
BuildRequires: doxygen
# The new flang drive requires clang-devel
BuildRequires: clang-devel = %{version}
@ -103,19 +104,13 @@ Documentation for Flang
%prep
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE5}' --data='%{SOURCE4}'
%setup -T -q -b 4 -n %{cmake_srcdir}
# TODO: It would be more elegant to set -DLLVM_COMMON_CMAKE_UTILS=%{_builddir}/%{cmake_srcdir},
# but this is not a CACHED variable, so we can't actually set it externally :(
cd ..
mv %{cmake_srcdir} cmake
%autosetup -n %{flang_srcdir} -p2
# Copy Options.td for docs generation
mkdir -p ../clang/include/clang/Driver
cp %{SOURCE3} ../clang/include/clang/Driver
mkdir -p ../llvm-project-%{flang_version}%{?rc_ver:rc%{rc_ver}}.src/mlir/test/lib/Analysis/
cp %{SOURCE6} ../llvm-project-%{flang_version}%{?rc_ver:rc%{rc_ver}}.src/mlir/test/lib/Analysis/
cp %{SOURCE4} ../llvm-project-%{flang_version}%{?rc_ver:rc%{rc_ver}}.src/mlir/test/lib/Analysis/
%build
%cmake -GNinja \
@ -127,10 +122,10 @@ cp %{SOURCE6} ../llvm-project-%{flang_version}%{?rc_ver:rc%{rc_ver}}.src/mlir/te
-DLLVM_MAIN_SRC_DIR=%{_datadir}/llvm/src \
-DBUILD_SHARED_LIBS:BOOL=ON \
-DLLVM_LINK_LLVM_DYLIB:BOOL=ON \
-DLLVM_ENABLE_ASSERTIONS:BOOL=ON \
-DLLVM_EXTERNAL_LIT=%{_bindir}/lit \
-DLLVM_MAIN_SRC_DIR=%{_datadir}/llvm/src \
-DLLVM_THIRD_PARTY_DIR=%{_datadir}/llvm/src/utils \
-DCMAKE_PREFIX_PATH=%{_libdir}/cmake/llvm/ \
-DLLVM_COMMON_CMAKE_UTILS=%{_libdir}/cmake/llvm/ \
\
-DFLANG_INCLUDE_DOCS:BOOL=ON \
-DLLVM_ENABLE_SPHINX:BOOL=ON \
@ -246,6 +241,9 @@ export LD_LIBRARY_PATH=%{_builddir}/%{flang_srcdir}/%{_build}/lib
%doc %{_pkgdocdir}/html/
%changelog
* Tue Mar 21 2023 Tulio Magno Quites Machado Filho <tuliom@redhat.com> - 16.0.0-1
- Update to LLVM 16.0.0
* Thu Mar 16 2023 Tulio Magno Quites Machado Filho <tuliom@redhat.com> - 16.0.0~rc4-1
- Update to LLVM 16.0.0 RC4

View File

@ -1,5 +1,3 @@
SHA512 (cmake-16.0.0rc4.src.tar.xz) = 888cd3cf6a8eeca1306ab8a45fbcf0fdc91f10e34dc29a0bf7aef5b1efc9af0ab54866584857fbfb725147c8e4bc1a11e8a1b247fe439ebf93fe6a73fb004101
SHA512 (cmake-16.0.0rc4.src.tar.xz.sig) = c2e4d7b79c5d2524449b8444eb4a9e1e625c50fc27dabcdd7410f44cc5b67cdd7931a5f31bc4b7652a034687d10d551aa9d89e3c01771d1b3e42b2b3a901745f
SHA512 (flang-16.0.0rc4.src.tar.xz) = c030c113b9c0c23e4020769b91adff042503ea69f29c887709afc846979c9efdddc13f594fc45d68cf41e78fe1f614d82308fd90781059c6ea9ab9de49c7fcad
SHA512 (flang-16.0.0rc4.src.tar.xz.sig) = 0d713288c48f0014d8bd709eadd8f40c090a623643d4f4e172b95f635c0ff88a11f81517b3b64d466009f140e76ba4089bd5a57200147cb331a1b4fbbc33f68e
SHA512 (flang-16.0.0.src.tar.xz) = 3d7ebe4eb80336a28fe8d4ab5b9e006b93184f77a6865391e2d5d21e882814b789aeaca719b0c347e49c886cba0b7cee2a5d478a7325c4921c2b6aa9ee18b99d
SHA512 (flang-16.0.0.src.tar.xz.sig) = 06e677484890b668764d8824cfb235ae686fd378139741d75e5b96bcb890c887cad70bce90c6fc8ac4c4c57774c45836883a8a1833975b7d9b111b54d2d2e7d2
SHA512 (Options.td) = aac6bae599ff35c9e94f83f97f6d118ee55d385398195d59ac16b9787989015e7fe108d77153c1f410206dc060f695790dee2113e41ac353d73c4740c0ed518f