From b7206b4e50cd7461c97fb3429064e6b414110405 Mon Sep 17 00:00:00 2001 From: Eduard Abdullin Date: Wed, 14 May 2025 14:41:56 +0000 Subject: [PATCH] Use x86_64-redhat-linux as default gcc triple for x86_64_v2 Add riscv64 support --- llvm.spec | 51 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/llvm.spec b/llvm.spec index a1e8aa4..83c8c60 100644 --- a/llvm.spec +++ b/llvm.spec @@ -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} +Release: 2%{?dist}.alma.1 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} \\\ @@ -1311,7 +1316,11 @@ echo "%%clang%{maj_ver}_resource_dir %%{_prefix}/lib/clang/%{maj_ver}" >> %{buil # Install config file for clang %if %{maj_ver} >=18 +%ifarch x86_64_v2 +%global cfg_file_content --gcc-triple=x86_64-redhat-linux +%else %global cfg_file_content --gcc-triple=%{_target_cpu}-redhat-linux +%endif # We want to use DWARF-5 on all snapshot builds. %if %{without snapshot_build} && %{defined rhel} && 0%{?rhel} < 10 @@ -1369,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 @@ -1526,20 +1535,34 @@ 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 @@ -1548,7 +1571,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 @@ -1717,7 +1742,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 @@ -1749,7 +1774,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 @@ -2395,7 +2422,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 @@ -2413,7 +2440,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} @@ -2427,7 +2454,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 @@ -2514,6 +2541,10 @@ fi #region changelog %changelog +* Wed May 14 2025 Eduard Abdullin - 19.1.7-2.alma.1 +- Use x86_64-redhat-linux as default gcc triple for x86_64_v2 +- Add riscv64 support + * Fri Jan 17 2025 Nikita Popov - 19.1.7-2 - Support CET in libomp.so (RHEL-74346)