From 50161d2f3c597bb3b1e9bd95f1e4f9e8a4e3c87f Mon Sep 17 00:00:00 2001 From: David Abdurachmanov Date: Sun, 12 Aug 2018 08:28:59 +0300 Subject: [PATCH] Add support for RISC-V (riscv64) Signed-off-by: David Abdurachmanov --- llvm.spec | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/llvm.spec b/llvm.spec index 6b82eff..644f3d5 100644 --- a/llvm.spec +++ b/llvm.spec @@ -28,6 +28,9 @@ %ifarch %{arm} %global llvm_targets ARM;BPF %endif +%ifarch riscv64 +%global llvm_targets RISCV;AMDGPU;BPF +%endif %if 0%{?compat_build} %global pkg_name llvm%{maj_ver}.%{min_ver} @@ -49,7 +52,7 @@ Name: %{pkg_name} Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 0.1.rc%{rc_ver}%{?dist} +Release: 0.1.rc%{rc_ver}.0.riscv64%{?dist} Summary: The Low Level Virtual Machine License: NCSA @@ -76,7 +79,9 @@ BuildRequires: binutils-devel %endif BuildRequires: libstdc++-static # Enable extra functionality when run the LLVM JIT under valgrind. +%ifarch %{valgrind_arches} BuildRequires: valgrind-devel +%endif # LLVM's LineEditor library will use libedit if it is available. BuildRequires: libedit-devel @@ -125,20 +130,28 @@ Static libraries for the LLVM compiler infrastructure. %prep %autosetup -n llvm-%{version}%{?rc_ver:rc%{rc_ver}}.src -p1 +# Update config.guess to detect RISC-V (riscv64) +cp -f /usr/lib/rpm/redhat/config.guess ./cmake/config.guess + %build mkdir -p _build cd _build -%ifarch s390 %{arm} %ix86 +%ifarch s390 %{arm} %ix86 riscv64 # Decrease debuginfo verbosity to reduce memory consumption during final library linking %global optflags %(echo %{optflags} | sed 's/-g /-g1 /') %endif +# Workaround for GCC issue +%ifarch riscv64 +export LDFLAGS="${LDFLAGS} -latomic %{__global_ldflags}" +%endif + # force off shared libs as cmake macros turns it on. %cmake .. -G Ninja \ -DBUILD_SHARED_LIBS:BOOL=OFF \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -%ifarch s390 %{arm} %ix86 +%ifarch s390 %{arm} %ix86 riscv64 -DCMAKE_C_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \ %endif @@ -333,6 +346,9 @@ fi %endif %changelog +* Sun Aug 12 2018 David Abdurachmanov - 7.0.0-0.1.rc1.0.riscv64 +- Add support for RISC-V (riscv64) + * Fri Aug 10 2018 Tom Stellard - 7.0.0-0.1.rc1 - 7.0.0-rc1 Release - Reduce number of enabled targets on all arches.