From 4849c51a06ae94bce443510b34e18af3717f5730 Mon Sep 17 00:00:00 2001 From: David Abdurachmanov Date: Fri, 31 Mar 2023 08:32:19 +0300 Subject: [PATCH] Add support for riscv64 Signed-off-by: David Abdurachmanov --- ...ng-back-riscv64-redhat-linux-triplet.patch | 27 +++++++++++++++++++ clang.spec | 19 ++++++++----- 2 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 0001-Bring-back-riscv64-redhat-linux-triplet.patch diff --git a/0001-Bring-back-riscv64-redhat-linux-triplet.patch b/0001-Bring-back-riscv64-redhat-linux-triplet.patch new file mode 100644 index 0000000..993f0a0 --- /dev/null +++ b/0001-Bring-back-riscv64-redhat-linux-triplet.patch @@ -0,0 +1,27 @@ +From 2dcf8703706e0a5b7b45991e5cd10dd38f1d8c4b Mon Sep 17 00:00:00 2001 +From: David Abdurachmanov +Date: Thu, 24 Nov 2022 06:26:46 +0200 +Subject: [PATCH] Bring back riscv64-redhat-linux triplet + +Signed-off-by: David Abdurachmanov +--- + clang/lib/Driver/ToolChains/Gnu.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp +index e955835b..e5c17544 100644 +--- a/clang/lib/Driver/ToolChains/Gnu.cpp ++++ b/clang/lib/Driver/ToolChains/Gnu.cpp +@@ -2302,7 +2302,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( + static const char *const RISCV64LibDirs[] = {"/lib64", "/lib"}; + static const char *const RISCV64Triples[] = {"riscv64-unknown-linux-gnu", + "riscv64-linux-gnu", +- "riscv64-unknown-elf"}; ++ "riscv64-unknown-elf", ++ "riscv64-redhat-linux"}; + + static const char *const SPARCv8LibDirs[] = {"/lib32", "/lib"}; + static const char *const SPARCv8Triples[] = {"sparc-linux-gnu", +-- +2.37.1 + diff --git a/clang.spec b/clang.spec index 3b10edf..501586b 100644 --- a/clang.spec +++ b/clang.spec @@ -41,7 +41,7 @@ Name: %pkg_name Version: %{clang_version}%{?rc_ver:~rc%{rc_ver}} -Release: 3%{?dist} +Release: 3.0.riscv64%{?dist} Summary: A C language family front-end for LLVM License: Apache-2.0 WITH LLVM-exception OR NCSA @@ -75,6 +75,8 @@ Patch8: 0001-clang-Fix-interaction-between-asm-labels-and-inline-.patch Patch9: 0001-clang-MinGW-Improve-extend-the-gcc-sysroot-detection.patch Patch10: 0002-clang-MinGW-Improve-detection-of-libstdc-headers-on-.patch +Patch20: 0001-Bring-back-riscv64-redhat-linux-triplet.patch + %if %{without compat_build} # Patches for clang-tools-extra # See https://reviews.llvm.org/D120301 @@ -297,7 +299,7 @@ rm test/CodeGen/profile-filter.c # Use ThinLTO to limit build time. %define _lto_cflags -flto=thin # And disable LTO on AArch64 entirely. -%ifarch aarch64 +%ifarch aarch64 riscv64 %define _lto_cflags %{nil} %endif @@ -307,7 +309,7 @@ sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@/64/g' test/lit.cfg.py sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@//g' test/lit.cfg.py %endif -%ifarch s390 s390x %{arm} aarch64 %ix86 ppc64le +%ifarch s390 s390x %{arm} aarch64 %ix86 ppc64le riscv64 # Decrease debuginfo verbosity to reduce memory consumption during final library linking %global optflags %(echo %{optflags} | sed 's/-g /-g1 /') %endif @@ -329,7 +331,7 @@ sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@//g' test/lit.cfg.py -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DPYTHON_EXECUTABLE=%{__python3} \ -DCMAKE_SKIP_RPATH:BOOL=ON \ -%ifarch s390 s390x %{arm} %ix86 ppc64le +%ifarch s390 s390x %{arm} %ix86 ppc64le riscv64 -DCMAKE_C_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \ %endif @@ -477,9 +479,9 @@ ln -s %{_datadir}/clang/clang-format-diff.py %{buildroot}%{_bindir}/clang-format %cmake_build --target clang-test-depends \ ExtraToolsUnitTests ClangdUnitTests ClangIncludeCleanerUnitTests ClangPseudoUnitTests # requires lit.py from LLVM utilities -# FIXME: Fix failing ARM tests +# FIXME: Fix failing ARM & RISCV64 tests LD_LIBRARY_PATH=%{buildroot}/%{_libdir} %{__ninja} check-all -C %{__cmake_builddir} || \ -%ifarch %{arm} +%ifarch %{arm} riscv64 : %else false @@ -612,6 +614,11 @@ false %endif %changelog +* Fri Mar 31 2023 David Abdurachmanov - 15.0.7-3.0.riscv64 +- Ignore test suite failures on riscv64 for now +- Prepare for riscv64 +- Add riscv64-redhat-linux triplet + * Thu Jan 19 2023 Tulio Magno Quites Machado Filho - 15.0.7-3 - Update license to SPDX identifiers. - Include the Apache license adopted in 2019.