- Add riscv64 support

This commit is contained in:
eabdullin 2025-03-04 16:36:57 +03:00
parent 26b8067a9b
commit 8504958361

View File

@ -107,7 +107,7 @@
%endif
%if 0%{?rhel}
%global targets_to_build "X86;AMDGPU;PowerPC;NVPTX;SystemZ;AArch64;ARM;Mips;BPF;WebAssembly"
%global targets_to_build "X86;AMDGPU;PowerPC;NVPTX;SystemZ;AArch64;ARM;Mips;BPF;WebAssembly;RISCV"
%global experimental_targets_to_build ""
%else
%global targets_to_build "all"
@ -182,7 +182,7 @@
#region main package
Name: %{pkg_name_llvm}
Version: %{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:~rc%{rc_ver}}%{?llvm_snapshot_version_suffix:~%{llvm_snapshot_version_suffix}}
Release: 2%{?dist}.alma.1
Release: 2%{?dist}.alma.2
Summary: The Low Level Virtual Machine
License: Apache-2.0 WITH LLVM-exception OR NCSA
@ -842,7 +842,7 @@ The package contains the LLDB Python module.
# TODO(kkleine): In clang we had this %ifarch s390 s390x aarch64 %ix86 ppc64le
# Decrease debuginfo verbosity to reduce memory consumption during final library linking.
%global reduce_debuginfo 0
%ifarch %ix86
%ifarch %ix86 riscv64
%global reduce_debuginfo 1
%endif
%if 0%{?rhel} == 8
@ -867,7 +867,7 @@ export ASMFLAGS="%{build_cflags}"
# Disable dwz on aarch64, because it takes a huge amount of time to decide not to optimize things.
# This is copied from clang.
%ifarch aarch64
%ifarch aarch64 riscv64
%define _find_debuginfo_dwz_opts %{nil}
%endif
@ -959,6 +959,11 @@ popd
%endif
#endregion lldb options
%global runtimes compiler-rt;openmp
%ifnarch riscv64
%global runtimes %{runtimes};offload
%endif
#region llvm options
%global cmake_config_args %{cmake_config_args} \\\
-DLLVM_APPEND_VC_REV:BOOL=OFF \\\
@ -974,7 +979,7 @@ popd
-DLLVM_ENABLE_LIBCXX:BOOL=OFF \\\
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON \\\
-DLLVM_ENABLE_PROJECTS="%{projects}" \\\
-DLLVM_ENABLE_RUNTIMES="compiler-rt;openmp;offload" \\\
-DLLVM_ENABLE_RUNTIMES="%{runtimes}" \\\
-DLLVM_ENABLE_ZLIB:BOOL=FORCE_ON \\\
-DLLVM_ENABLE_ZSTD:BOOL=FORCE_ON \\\
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=%{experimental_targets_to_build} \\\
@ -1373,7 +1378,7 @@ rm -rf %{buildroot}/%{install_datadir}/gdb
# chmod go+w %{buildroot}/%{_datarootdir}/gdb/python/ompd/ompdModule.so
# chmod +w %{buildroot}/%{_datarootdir}/gdb/python/ompd/ompdModule.so
%ifnarch %{ix86}
%ifnarch %{ix86} riscv64
# Remove files that we don't package, yet.
%if %{maj_ver} >= 20
rm %{buildroot}%{install_bindir}/llvm-offload-device-info
@ -1530,20 +1535,35 @@ function test_list_to_regex()
#region Test LLVM lit
# It's fine to always run this, even if we're not shipping python-lit.
reset_test_opts
%ifnarch riscv64
%cmake_build --target check-lit
%endif
#endregion Test LLVM lit
#region Test LLVM
reset_test_opts
# Xfail testing of update utility tools
export LIT_XFAIL="tools/UpdateTestChecks"
%ifnarch riscv64
%cmake_build --target check-llvm
%endif
#endregion Test LLVM
#region Test CLANG
reset_test_opts
export LIT_XFAIL="$LIT_XFAIL;clang/test/CodeGen/profile-filter.c"
%ifarch riscv64
export LIT_XFAIL="$LIT_XFAIL;clang/test/OpenMP/declare_variant_device_isa_codegen_1.c"
export LIT_XFAIL="$LIT_XFAIL;OpenMP/declare_variant_device_isa_codegen_1.c"
test_list_filter_out+=("Clang :: OpenMP/declare_variant_device_isa_codegen_1.c")
%endif
export LIT_FILTER_OUT=$(test_list_to_regex test_list_filter_out)
%ifnarch riscv64
%cmake_build --target check-clang
%endif
#endregion Test Clang
#region Test Clang Tools
@ -1552,7 +1572,9 @@ reset_test_opts
# Clang Tools :: clang-tidy/checkers/altera/struct-pack-align.cpp
export LIT_XFAIL="$LIT_XFAIL;clang-tidy/checkers/altera/struct-pack-align.cpp"
%endif
%ifnarch riscv64
%cmake_build --target check-clang-tools
%endif
#endregion Test Clang Tools
#region Test OPENMP
@ -1721,7 +1743,7 @@ export LIT_FILTER_OUT=$(test_list_to_regex test_list_filter_out)
%if 0%{?rhel}
# libomp tests are often very slow on s390x brew builders
%ifnarch s390x
%ifnarch s390x riscv64
%cmake_build --target check-openmp
%endif
%else
@ -1753,7 +1775,9 @@ export LIT_FILTER_OUT=$(test_list_to_regex test_list_filter_out)
#region Test LLD
reset_test_opts
%ifnarch riscv64
%cmake_build --target check-lld
%endif
#endregion Test LLD
%endif
@ -2399,7 +2423,7 @@ fi
%{_prefix}/lib/clang/%{maj_ver}/lib/%{compiler_rt_triple}/clang_rt.crtend.o
%endif
%ifnarch %{ix86} s390x
%ifnarch %{ix86} s390x riscv64
%{_prefix}/lib/clang/%{maj_ver}/lib/%{compiler_rt_triple}/liborc_rt.a
%endif
@ -2417,7 +2441,7 @@ fi
%{install_libdir}/libomp.so
%{install_libdir}/libompd.so
%{install_libdir}/libarcher.so
%ifnarch %{ix86}
%ifnarch %{ix86} riscv64
# libomptarget is not supported on 32-bit systems.
# s390x does not support the offloading plugins.
%{install_libdir}/libomptarget.so.%{so_suffix}
@ -2431,7 +2455,7 @@ fi
%{_prefix}/lib/clang/%{maj_ver}/include/ompt.h
%{_prefix}/lib/clang/%{maj_ver}/include/ompt-multiplex.h
%{install_libdir}/cmake/openmp/
%ifnarch %{ix86}
%ifnarch %{ix86} riscv64
# libomptarget is not supported on 32-bit systems.
# s390x does not support the offloading plugins.
%{install_libdir}/libomptarget.devicertl.a
@ -2518,6 +2542,9 @@ fi
#region changelog
%changelog
* Tue Mar 04 2025 Eduard Abdullin <eabdullin@almalinux.org> - 19.1.7-2.alma.2
- Add riscv64 support
* Fri Jan 24 2025 Eduard Abdullin <eabdullin@almalinux.org> - 19.1.7-2.alma.1
- Use x86_64-redhat-linux as default gcc triple for x86_64_v2