Add riscv64 support

Signed-off-by: David Abdurachmanov <davidlt@rivosinc.com>
This commit is contained in:
David Abdurachmanov 2024-03-27 17:12:37 +02:00
parent 9ec3807f99
commit d76a0f3963
Signed by: davidlt
GPG Key ID: 7A5F42FAF91FACC3
2 changed files with 33 additions and 5 deletions

View File

@ -0,0 +1,23 @@
diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
index 4325cbb4..86ae0f21 100644
--- a/lib/Driver/ToolChains/Gnu.cpp
+++ b/lib/Driver/ToolChains/Gnu.cpp
@@ -2065,6 +2065,7 @@ static llvm::StringRef getGCCToolchainDir(const ArgList &Args,
/// triple.
static const char *ConvertToGccTriple(StringRef CandidateTriple) {
return llvm::StringSwitch<const char *>(CandidateTriple)
+ .Case("riscv64-redhat-linux-gnu", "riscv64-redhat-linux")
.Case("aarch64-redhat-linux-gnu", "aarch64-redhat-linux")
.Case("i686-redhat-linux-gnu", "i686-redhat-linux")
.Case("ppc64le-redhat-linux-gnu", "ppc64le-redhat-linux")
@@ -2426,7 +2427,9 @@ 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-gnu",
+ "riscv64-redhat-linux"};
static const char *const SPARCv8LibDirs[] = {"/lib32", "/lib"};
static const char *const SPARCv8Triples[] = {"sparc-linux-gnu",

View File

@ -67,7 +67,7 @@
Name: %pkg_name
Version: %{clang_version}%{?rc_ver:~rc%{rc_ver}}%{?llvm_snapshot_version_suffix:~%{llvm_snapshot_version_suffix}}
Release: 7%{?dist}
Release: 7.0.riscv64%{?dist}
Summary: A C language family front-end for LLVM
License: Apache-2.0 WITH LLVM-exception OR NCSA
@ -105,6 +105,8 @@ Patch7: tsa.patch
Patch8: 0001-Clang-Fix-build-with-GCC-14-on-ARM.patch
Patch9: 0001-Clang-Defer-the-instantiation-of-explicit-specifier-.patch
# RISCV (riscv64)
Patch20: clang-fedora-riscv64.patch
# RHEL specific patches
# Avoid unwanted dependency on python-recommonmark
@ -335,7 +337,7 @@ rm test/CodeGen/profile-filter.c
%build
# And disable LTO on AArch64 entirely.
%ifarch aarch64
%ifarch aarch64 riscv64
%define _lto_cflags %{nil}
%endif
@ -344,13 +346,13 @@ rm test/CodeGen/profile-filter.c
%global _lto_cflags %nil
%endif
%ifarch s390 s390x aarch64 %ix86 ppc64le
%ifarch s390 s390x aarch64 %ix86 ppc64le riscv64
# Decrease debuginfo verbosity to reduce memory consumption during final library linking
%global optflags %(echo %{optflags} | sed 's/-g /-g1 /')
%endif
# Disable dwz on aarch64, because it takes a huge amount of time to decide not to optimize things.
%ifarch aarch64
%ifarch aarch64 riscv64
%define _find_debuginfo_dwz_opts %{nil}
%endif
@ -366,7 +368,7 @@ rm test/CodeGen/profile-filter.c
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DPYTHON_EXECUTABLE=%{__python3} \
-DCMAKE_SKIP_RPATH:BOOL=ON \
%ifarch s390 s390x %ix86 ppc64le
%ifarch s390 s390x %ix86 ppc64le riscv64
-DCMAKE_C_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \
%endif
@ -692,6 +694,9 @@ LD_LIBRARY_PATH=%{buildroot}/%{install_libdir} %{__ninja} check-all -C %{__cmake
%endif
%changelog
* Wed Mar 27 2024 David Abdurachmanov <davidlt@rivosinc.com> - 17.0.6-7.0.riscv64
- Add support for riscv64
* Wed Mar 06 2024 Tom Stellard <tstellar@redhat.com> - 17.0.6-7
- Fix clang resource directory to match compiler-rt
- Fix provides for clang-resource-filesystem