Add support for riscv64
Signed-off-by: David Abdurachmanov <davidlt@rivosinc.com>
This commit is contained in:
parent
27e55c5c00
commit
0d171bcd92
|
@ -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",
|
21
clang.spec
21
clang.spec
|
@ -4,7 +4,9 @@
|
|||
%{llvm_sb}
|
||||
%endif
|
||||
|
||||
%ifnarch riscv64
|
||||
%global toolchain clang
|
||||
%endif
|
||||
|
||||
# Opt out of https://fedoraproject.org/wiki/Changes/fno-omit-frame-pointer
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=2158587
|
||||
|
@ -55,7 +57,7 @@
|
|||
|
||||
Name: %pkg_name
|
||||
Version: %{clang_version}%{?rc_ver:~rc%{rc_ver}}%{?llvm_snapshot_version_suffix:~%{llvm_snapshot_version_suffix}}
|
||||
Release: 1%{?dist}
|
||||
Release: 1.0.riscv64%{?dist}
|
||||
Summary: A C language family front-end for LLVM
|
||||
|
||||
License: Apache-2.0 WITH LLVM-exception OR NCSA
|
||||
|
@ -93,6 +95,8 @@ Patch5: 0001-Workaround-a-bug-in-ORC-on-ppc64le.patch
|
|||
Patch6: cfg.patch
|
||||
Patch7: tsa.patch
|
||||
|
||||
# riscv64
|
||||
Patch8: clang-fedora-riscv64.patch
|
||||
|
||||
# RHEL specific patches
|
||||
# Avoid unwanted dependency on python-recommonmark
|
||||
|
@ -330,7 +334,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
|
||||
|
||||
|
@ -346,13 +350,13 @@ 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
|
||||
|
||||
# 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
|
||||
|
||||
|
@ -368,7 +372,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
|
||||
|
@ -514,9 +518,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
|
||||
|
@ -646,6 +650,9 @@ false
|
|||
%changelog
|
||||
%{?llvm_snapshot_changelog_entry}
|
||||
|
||||
* Sat Nov 04 2023 David Abdurachmanov <davidlt@rivosinc.com> - 17.0.4-1.0.riscv64
|
||||
- Add support for riscv64
|
||||
|
||||
* Wed Nov 01 2023 Tulio Magno Quites Machado Filho <tuliom@redhat.com> - 17.0.4-1
|
||||
- Update to LLVM 17.0.4
|
||||
|
||||
|
|
Loading…
Reference in New Issue