From 16790062c8cb672069c7b6a3ce1f49a050d111db Mon Sep 17 00:00:00 2001 From: jchzhou Date: Thu, 27 Feb 2025 18:36:16 +0800 Subject: [PATCH 1/5] riscv64: backport support for offload host plugin; excluding non-supported liborc_rt.a in packaging Signed-off-by: laokz Signed-off-by: jchzhou --- ...d-support-for-riscv64-to-host-plugin.patch | 94 +++++++++++++++++++ llvm-toolset-19.spec | 16 +++- 2 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 0004-Offload-Add-support-for-riscv64-to-host-plugin.patch diff --git a/0004-Offload-Add-support-for-riscv64-to-host-plugin.patch b/0004-Offload-Add-support-for-riscv64-to-host-plugin.patch new file mode 100644 index 0000000..e008d57 --- /dev/null +++ b/0004-Offload-Add-support-for-riscv64-to-host-plugin.patch @@ -0,0 +1,94 @@ +From 8f24fd1576190808efd1f7ea639ae895207644f3 Mon Sep 17 00:00:00 2001 +From: Aurelien Jarno +Date: Mon, 11 Nov 2024 11:12:54 +0100 +Subject: [PATCH] [Offload] Add support for riscv64 to host plugin + +This adds support for the riscv64 architecture to the offload host +plugin. The check to define FFI_DEFAULT_ABI is intentionally not guarded +by __riscv_xlen as the value is the same for riscv32 and riscv64 +(support for OpenMP on riscv32 is still under review). + +Tested-by: jchzhou +--- + offload/CMakeLists.txt | 2 ++ + offload/plugins-nextgen/common/src/Utils/ELF.cpp | 2 ++ + offload/plugins-nextgen/host/CMakeLists.txt | 6 +++++- + offload/plugins-nextgen/host/dynamic_ffi/ffi.h | 3 ++- + offload/plugins-nextgen/host/src/rtl.cpp | 2 ++ + 5 files changed, 13 insertions(+), 2 deletions(-) + +diff --git a/offload/CMakeLists.txt b/offload/CMakeLists.txt +index 959d6260b..ccb61a698 100644 +--- a/offload/CMakeLists.txt ++++ b/offload/CMakeLists.txt +@@ -200,6 +200,8 @@ set (LIBOMPTARGET_ALL_TARGETS "${LIBOMPTARGET_ALL_TARGETS} nvptx64-nvidia-cuda-L + set (LIBOMPTARGET_ALL_TARGETS "${LIBOMPTARGET_ALL_TARGETS} nvptx64-nvidia-cuda-JIT-LTO") + set (LIBOMPTARGET_ALL_TARGETS "${LIBOMPTARGET_ALL_TARGETS} s390x-ibm-linux-gnu") + set (LIBOMPTARGET_ALL_TARGETS "${LIBOMPTARGET_ALL_TARGETS} s390x-ibm-linux-gnu-LTO") ++set (LIBOMPTARGET_ALL_TARGETS "${LIBOMPTARGET_ALL_TARGETS} riscv64-unknown-linux-gnu") ++set (LIBOMPTARGET_ALL_TARGETS "${LIBOMPTARGET_ALL_TARGETS} riscv64-unknown-linux-gnu-LTO") + + # Once the plugins for the different targets are validated, they will be added to + # the list of supported targets in the current system. +diff --git a/offload/plugins-nextgen/common/src/Utils/ELF.cpp b/offload/plugins-nextgen/common/src/Utils/ELF.cpp +index 90d6950b8..88642fd5b 100644 +--- a/offload/plugins-nextgen/common/src/Utils/ELF.cpp ++++ b/offload/plugins-nextgen/common/src/Utils/ELF.cpp +@@ -45,6 +45,8 @@ uint16_t utils::elf::getTargetMachine() { + return EM_AARCH64; + #elif defined(__powerpc64__) + return EM_PPC64; ++#elif defined(__riscv) ++ return EM_RISCV; + #else + #warning "Unknown ELF compilation target architecture" + return EM_NONE; +diff --git a/offload/plugins-nextgen/host/CMakeLists.txt b/offload/plugins-nextgen/host/CMakeLists.txt +index 817d128f9..286bc51cc 100644 +--- a/offload/plugins-nextgen/host/CMakeLists.txt ++++ b/offload/plugins-nextgen/host/CMakeLists.txt +@@ -1,4 +1,4 @@ +-set(supported_targets x86_64 aarch64 ppc64 ppc64le s390x) ++set(supported_targets x86_64 aarch64 ppc64 ppc64le riscv64 s390x) + if(NOT ${CMAKE_SYSTEM_PROCESSOR} IN_LIST supported_targets) + message(STATUS "Not building ${machine} NextGen offloading plugin") + return() +@@ -59,4 +59,8 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "s390x$") + list(APPEND LIBOMPTARGET_SYSTEM_TARGETS + "s390x-ibm-linux-gnu" "s390x-ibm-linux-gnu-LTO") + set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS}" PARENT_SCOPE) ++elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "riscv64$") ++ list(APPEND LIBOMPTARGET_SYSTEM_TARGETS ++ "riscv64-unknown-linux-gnu" "riscv64-unknown-linux-gnu-LTO") ++ set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS}" PARENT_SCOPE) + endif() +diff --git a/offload/plugins-nextgen/host/dynamic_ffi/ffi.h b/offload/plugins-nextgen/host/dynamic_ffi/ffi.h +index 0ae025805..8b4e0286d 100644 +--- a/offload/plugins-nextgen/host/dynamic_ffi/ffi.h ++++ b/offload/plugins-nextgen/host/dynamic_ffi/ffi.h +@@ -43,7 +43,8 @@ typedef enum { + typedef enum ffi_abi { + #if (defined(_M_X64) || defined(__x86_64__)) + FFI_DEFAULT_ABI = 2, // FFI_UNIX64. +-#elif defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64) ++#elif defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64) || \ ++ defined(__riscv) + FFI_DEFAULT_ABI = 1, // FFI_SYSV. + #elif defined(__powerpc64__) + FFI_DEFAULT_ABI = 8, // FFI_LINUX. +diff --git a/offload/plugins-nextgen/host/src/rtl.cpp b/offload/plugins-nextgen/host/src/rtl.cpp +index fe296b77c..6f2e3d860 100644 +--- a/offload/plugins-nextgen/host/src/rtl.cpp ++++ b/offload/plugins-nextgen/host/src/rtl.cpp +@@ -440,6 +440,8 @@ struct GenELF64PluginTy final : public GenericPluginTy { + #else + return llvm::Triple::ppc64; + #endif ++#elif defined(__riscv) && (__riscv_xlen == 64) ++ return llvm::Triple::riscv64; + #else + return llvm::Triple::UnknownArch; + #endif +-- +2.48.1 + diff --git a/llvm-toolset-19.spec b/llvm-toolset-19.spec index 5282e0b..e421915 100644 --- a/llvm-toolset-19.spec +++ b/llvm-toolset-19.spec @@ -149,7 +149,7 @@ #region main package Name: llvm-toolset-%{maj_ver} Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 2 +Release: 3 Summary: The Low Level Virtual Machine License: NCSA @@ -166,6 +166,9 @@ Source2: CMakeLists.txt Patch0001: 0001-PATCH-clang-Don-t-install-static-libraries.patch Patch0002: 0002-Add-triples-for-X86_64-AArch64-Riscv64-openEuler-gcc.patch Patch0003: 0003-Always-build-shared-libs-for-LLD.patch +# backport riscv64 support for offload host plugin from llvm 20.1 +# https://github.com/llvm/llvm-project/pull/115773 +Patch0004: 0004-Offload-Add-support-for-riscv64-to-host-plugin.patch BuildRequires: gcc BuildRequires: gcc-c++ @@ -2496,7 +2499,8 @@ fi %{install_libdir}/clang/%{maj_ver}/lib/%{compiler_rt_triple}/clang_rt.crtend.o %endif -%ifnarch %{ix86} s390x +%ifnarch %{ix86} s390x riscv64 +# currently unsupported on above arches %{install_libdir}/clang/%{maj_ver}/lib/%{compiler_rt_triple}/liborc_rt.a %endif @@ -2514,7 +2518,7 @@ fi %{install_libdir}/libomp.so %{install_libdir}/libompd.so %{install_libdir}/libarcher.so -%ifnarch %{ix86} %{arm} riscv64 loongarch64 +%ifnarch %{ix86} %{arm} loongarch64 # libomptarget is not supported on 32-bit systems. # s390x does not support the offloading plugins. %if %{maj_ver} >= 20 @@ -2784,8 +2788,12 @@ fi #endregion files %changelog +* Fri Feb 28 2025 jchzhou - 19.1.7-3 +- Backport riscv64 support for offload host plugin +- Exclude packaging non-supported liborc_rt.a for riscv64 + * Tue Feb 25 2025 liyunfei - 19.1.7-2 - Bugfix for package name * Mon Feb 10 2025 liyunfei - 19.1.7-1 -- Package init \ No newline at end of file +- Package init -- Gitee From ea370232fddcababae0f8ee8c3762b86b4efbdb9 Mon Sep 17 00:00:00 2001 From: liyunfei Date: Mon, 3 Mar 2025 13:54:12 +0000 Subject: [PATCH 2/5] Remove python pack without sys_llvm (cherry picked from commit d73213cb8c67b34a0722d6339175107cb8f9f8d2) --- llvm-toolset-19.spec | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/llvm-toolset-19.spec b/llvm-toolset-19.spec index e421915..d9d79d7 100644 --- a/llvm-toolset-19.spec +++ b/llvm-toolset-19.spec @@ -149,7 +149,7 @@ #region main package Name: llvm-toolset-%{maj_ver} Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 3 +Release: 4 Summary: The Low Level Virtual Machine License: NCSA @@ -567,7 +567,9 @@ License: Apache-2.0 WITH LLVM-exception OR NCSA URL: http://lldb.llvm.org/ Requires: %{pkg_name_clang}-libs%{?_isa} = %{version}-%{release} -Requires: %{?scl_prefix}python3-lldb +%if %{with sys_llvm} +Requires: python%{python3_pkgversion}-lldb +%endif %description -n %{pkg_name_lldb} LLDB is a next generation, high-performance debugger. It is built as a set @@ -582,15 +584,17 @@ Requires: %{pkg_name_lldb}%{?_isa} = %{version}-%{release} %description -n %{pkg_name_lldb}-devel The package contains header files for the LLDB debugger. -%package -n %{?scl_prefix}python3-lldb -%{?python_provide:%python_provide python3-lldb} +%if %{with sys_llvm} +%package -n python%{python3_pkgversion}-lldb +%{?python_provide:%python_provide python%{python3_pkgversion}-lldb} Summary: Python module for LLDB Requires: %{pkg_name_lldb}%{?_isa} = %{version}-%{release} -%description -n %{?scl_prefix}python3-lldb +%description -n python%{python3_pkgversion}-lldb The package contains the LLDB Python module. %endif +%endif #endregion LLDB packages #region MLIR packages @@ -622,16 +626,18 @@ Requires: %{pkg_name_mlir}-static%{?_isa} = %{version}-%{release} %description -n %{pkg_name_mlir}-devel MLIR development files. -%package -n %{?scl_prefix}python3-mlir -%{?python_provide:%python_provide python3-mlir} +%if %{with sys_llvm} +%package -n python%{python3_pkgversion}-mlir +%{?python_provide:%python_provide python%{python3_pkgversion}-mlir} Summary: MLIR python bindings Requires: python3 -Requires: python3-numpy +Requires: python%{python3_pkgversion}-numpy -%description -n %{?scl_prefix}python3-mlir +%description -n python%{python3_pkgversion}-mlir MLIR python bindings. %endif +%endif #endregion MLIR packages #region libcxx packages @@ -1396,19 +1402,24 @@ install -D -m 644 -t %{buildroot}%{_mandir}/man1/ lld/docs/ld.lld.1 # python: fix binary libraries location liblldb=$(basename $(readlink -e %{buildroot}%{install_libdir}/liblldb.so)) +%if %{with sys_llvm} mkdir -p %{buildroot}%{python3_sitearch} mv %{buildroot}%{install_prefix}/..%{python3_sitearch}/lldb %{buildroot}%{python3_sitearch}/lldb ln -vsf "../../../${liblldb}" %{buildroot}%{python3_sitearch}/lldb/_lldb.so %py_byte_compile %{__python3} %{buildroot}%{python3_sitearch}/lldb %endif +rm -rf %{buildroot}%{install_prefix}/..%{python3_sitearch}/lldb +%endif #endregion LLDB installation #region mlir installation %if %{with mlir} +%if %{with sys_llvm} mkdir -p %{buildroot}/%{python3_sitearch} mv %{buildroot}%{install_prefix}/python_packages/mlir_core/mlir %{buildroot}/%{python3_sitearch} +%endif # These directories should be empty now. -rmdir %{buildroot}%{install_prefix}/python_packages/mlir_core %{buildroot}%{install_prefix}/python_packages +rm -rf %{buildroot}%{install_prefix}/python_packages/mlir_core %{buildroot}%{install_prefix}/python_packages # Unneeded files. rm -rf %{buildroot}%{install_prefix}/src/python %endif @@ -2635,8 +2646,10 @@ fi %{install_libdir}/liblldb*.so %{install_libdir}/liblldb.so.* %{install_libdir}/liblldbIntelFeatures.so.* +%if %{os_version} > 2203 %{_mandir}/man1/lldb-server%{exec_suffix}.1.gz %{_mandir}/man1/lldb%{exec_suffix}.1.gz +%endif %if %{with bundle_compat_lib} %{_libdir}/liblldb.so.%{compat_maj_ver}* %endif @@ -2644,9 +2657,11 @@ fi %files -n %{pkg_name_lldb}-devel %{install_includedir}/lldb -%files -n %{?scl_prefix}python3-lldb +%if %{with sys_llvm} +%files -n python%{python3_pkgversion}-lldb %{python3_sitearch}/lldb %endif +%endif #endregion LLDB files #region MLIR files @@ -2716,9 +2731,11 @@ fi %{install_libdir}/libmlir_runner_utils.so %{install_libdir}/libMLIR*.so -%files -n %{?scl_prefix}python3-mlir +%if %{with sys_llvm} +%files -n python%{python3_pkgversion}-mlir %{python3_sitearch}/mlir/ %endif +%endif #endregion MLIR files #region libcxx files @@ -2788,6 +2805,9 @@ fi #endregion files %changelog +* Mon Mar 3 2025 liyunfei liyunfei33@huawei.com - 19.1.7-4 +- Remove python pack without sys_llvm + * Fri Feb 28 2025 jchzhou - 19.1.7-3 - Backport riscv64 support for offload host plugin - Exclude packaging non-supported liborc_rt.a for riscv64 -- Gitee From 1ab839f6a361b176a0e655c2c9e073981554e35b Mon Sep 17 00:00:00 2001 From: jchzhou Date: Mon, 3 Mar 2025 22:24:34 +0800 Subject: [PATCH 3/5] fix packaging issue as sys_llvm, adapt for scan-build install path changes Signed-off-by: jchzhou (cherry picked from commit 020889714b2509f6a817bf7896ec2f4ad68002a7) --- llvm-toolset-19.spec | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/llvm-toolset-19.spec b/llvm-toolset-19.spec index d9d79d7..ef8e589 100644 --- a/llvm-toolset-19.spec +++ b/llvm-toolset-19.spec @@ -149,7 +149,7 @@ #region main package Name: llvm-toolset-%{maj_ver} Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 4 +Release: 5 Summary: The Low Level Virtual Machine License: NCSA @@ -1269,7 +1269,12 @@ install -p -m644 clang/bindings/python/clang/* %{buildroot}%{python3_sitelib}/cl %py_byte_compile %{__python3} %{buildroot}%{python3_sitelib}/clang # install scanbuild-py to python sitelib. -mv %{buildroot}%{install_libdir}/{libear,libscanbuild} %{buildroot}%{python3_sitelib} +### scan-build-py installation path changed to unprefixed /usr/lib/ for llvm 20+ in [1] +### and backported to 19.x in [2] +### 1. https://github.com/llvm/llvm-project/pull/106612 +### 2. https://github.com/llvm/llvm-project/pull/106853 + +mv %{buildroot}%{install_prefix}/lib/{libear,libscanbuild} %{buildroot}%{python3_sitelib} # Cannot use {libear,libscanbuild} style expansion in py_byte_compile. %py_byte_compile %{__python3} %{buildroot}%{python3_sitelib}/libear %py_byte_compile %{__python3} %{buildroot}%{python3_sitelib}/libscanbuild @@ -2805,7 +2810,10 @@ fi #endregion files %changelog -* Mon Mar 3 2025 liyunfei liyunfei33@huawei.com - 19.1.7-4 +* Mon Mar 03 2025 jchzhou - 19.1.7-5 +- Fix packaging issues as sys_llvm, adapt for scan-build install path changes + +* Mon Mar 03 2025 liyunfei - 19.1.7-4 - Remove python pack without sys_llvm * Fri Feb 28 2025 jchzhou - 19.1.7-3 -- Gitee From bf0145ef612d3d57cba12bf0f6733201fb9b6283 Mon Sep 17 00:00:00 2001 From: jchzhou Date: Tue, 11 Mar 2025 10:11:34 +0800 Subject: [PATCH 4/5] fix two minor packaging issues Signed-off-by: jchzhou (cherry picked from commit 4cb7b8a7224309e8902c7f59f474f9aed9a464f6) --- llvm-toolset-19.spec | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/llvm-toolset-19.spec b/llvm-toolset-19.spec index ef8e589..bee9d20 100644 --- a/llvm-toolset-19.spec +++ b/llvm-toolset-19.spec @@ -149,7 +149,7 @@ #region main package Name: llvm-toolset-%{maj_ver} Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 5 +Release: 6 Summary: The Low Level Virtual Machine License: NCSA @@ -1409,12 +1409,14 @@ install -D -m 644 -t %{buildroot}%{_mandir}/man1/ lld/docs/ld.lld.1 liblldb=$(basename $(readlink -e %{buildroot}%{install_libdir}/liblldb.so)) %if %{with sys_llvm} mkdir -p %{buildroot}%{python3_sitearch} -mv %{buildroot}%{install_prefix}/..%{python3_sitearch}/lldb %{buildroot}%{python3_sitearch}/lldb +# /usr/../usr/lib64 == /usr/lib64, in which case mv (or cp -r) would complain +# mv %{buildroot}%{install_prefix}/..%{python3_sitearch}/lldb %{buildroot}%{python3_sitearch}/lldb ln -vsf "../../../${liblldb}" %{buildroot}%{python3_sitearch}/lldb/_lldb.so %py_byte_compile %{__python3} %{buildroot}%{python3_sitearch}/lldb -%endif +%else rm -rf %{buildroot}%{install_prefix}/..%{python3_sitearch}/lldb %endif +%endif #endregion LLDB installation #region mlir installation @@ -1928,8 +1930,10 @@ fi #endregion LLVM lit files #region LLVM files +%if %{without sys_llvm} %files -n llvm-toolset-%{maj_ver} %{_scl_scripts}/enable +%endif %files -n %{pkg_name_llvm} %license llvm/LICENSE.TXT @@ -2810,6 +2814,9 @@ fi #endregion files %changelog +* Tue Mar 11 2025 jchzhou - 19.1.7-6 +- Fix two minor packaging issues + * Mon Mar 03 2025 jchzhou - 19.1.7-5 - Fix packaging issues as sys_llvm, adapt for scan-build install path changes -- Gitee From b62b761410a0fcdf65d5f17ffa798b2a851951e8 Mon Sep 17 00:00:00 2001 From: liyunfei Date: Mon, 31 Mar 2025 10:02:22 +0800 Subject: [PATCH 5/5] Bugfixes for 2403 build --- llvm-toolset-19.spec | 78 ++++++++++++++++++++++++++++++++------------ 1 file changed, 57 insertions(+), 21 deletions(-) diff --git a/llvm-toolset-19.spec b/llvm-toolset-19.spec index bee9d20..036bc0c 100644 --- a/llvm-toolset-19.spec +++ b/llvm-toolset-19.spec @@ -79,7 +79,7 @@ %global llvm_triple %{_host} %global build_src_dir %{_builddir}/%{src_tarball_dir} -%if %{os_version} <= 2203 +%if %{os_version} <= 2403 %global build_dir _build %else %global build_dir llvm/%{_vpath_builddir} @@ -149,7 +149,7 @@ #region main package Name: llvm-toolset-%{maj_ver} Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 6 +Release: 7 Summary: The Low Level Virtual Machine License: NCSA @@ -159,8 +159,9 @@ Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ve Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}/%{src_tarball_dir}.tar.xz.sig # CMakeLists for libcxx build -%if %{maj_ver} == 17 -Source2: CMakeLists.txt +%if %{os_version} == 2203 +Source2: CMakeLists.txt.libcxx +Source3: CMakeLists.txt.libomp %endif Patch0001: 0001-PATCH-clang-Don-t-install-static-libraries.patch @@ -187,7 +188,7 @@ BuildRequires: python3-devel BuildRequires: python3-psutil BuildRequires: python3-sphinx BuildRequires: python3-setuptools -%if %{maj_ver} >= 18 +%if %{maj_ver} >= 18 && %{os_version} > 2203 BuildRequires: python3-myst-parser %endif %if %{with toolchain_clang} @@ -820,17 +821,23 @@ export ASMFLAGS="%{build_cflags}" # Add all *enabled* documentation targets (no doxygen but sphinx) %global cmake_config_args %{cmake_config_args} \\\ -DLLVM_ENABLE_DOXYGEN:BOOL=OFF \\\ - -DLLVM_ENABLE_SPHINX:BOOL=ON \\\ -DLLVM_BUILD_DOCS:BOOL=ON + +%if %{os_version} <= 2203 && %{maj_ver} >= 18 +%global cmake_config_args %{cmake_config_args} \\\ + -DLLVM_ENABLE_SPHINX:BOOL=OFF +%else # Configure sphinx: # Build man-pages but no HTML docs using sphinx %global cmake_config_args %{cmake_config_args} \\\ + -DLLVM_ENABLE_SPHINX:BOOL=ON \\\ -DSPHINX_EXECUTABLE=%{_bindir}/sphinx-build-3 \\\ -DSPHINX_OUTPUT_HTML:BOOL=OFF \\\ -DSPHINX_OUTPUT_MAN:BOOL=ON \\\ -DSPHINX_WARNINGS_AS_ERRORS=OFF #endregion docs options +%endif #region lldb options %if %{with lldb} @@ -894,7 +901,7 @@ export ASMFLAGS="%{build_cflags}" -DLLVM_INSTALL_TOOLCHAIN_ONLY:BOOL=OFF \\\ -DLLVM_INSTALL_UTILS:BOOL=ON \\\ -DLLVM_LINK_LLVM_DYLIB:BOOL=ON \\\ - -DLLVM_PARALLEL_LINK_JOBS=1 \\\ + -DLLVM_PARALLEL_LINK_JOBS=%{max_link_jobs} \\\ -DLLVM_TOOLS_INSTALL_DIR:PATH=bin \\\ -DLLVM_UNREACHABLE_OPTIMIZE:BOOL=OFF \\\ -DLLVM_UTILS_INSTALL_DIR:PATH=bin @@ -979,7 +986,7 @@ export ASMFLAGS="%{build_cflags}" extra_cmake_args='' #endregion cmake options -%if %{os_version} <= 2203 +%if %{os_version} <= 2403 mkdir _build cd _build %define __cmake_in_source_build 1 @@ -1012,7 +1019,7 @@ cd llvm # /usr/lib64/libomptarget-amdgpu-*.bc # /usr/lib64/libomptarget-nvptx-*.bc -%if %{maj_ver} >= 18 +%if %{os_version} > 2203 %build_tool %cmake_target_opts runtimes @@ -1020,7 +1027,7 @@ cd llvm # add fix for llvm17 runtimes build #region libcxx build -cp %{SOURCE2} %{build_src_dir} +cp %{SOURCE2} %{build_src_dir}/CMakeLists.txt mkdir %{build_src_dir}/_build_libcxx cd %{build_src_dir}/_build_libcxx @@ -1052,24 +1059,35 @@ cd %{build_src_dir}/_build_libcxx -DLIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY=ON \ -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=ON \ -DLLVM_BUILD_DOCS=ON \ +%if %{os_version} <= 2203 && %{maj_ver} >= 18 + -DLLVM_ENABLE_SPHINX=OFF \ +%else -DLLVM_ENABLE_SPHINX=ON \ + -DLIBUNWIND_INSTALL_SPHINX_HTML_DIR=%{_pkgdocdir}/html \ +%endif -DLIBUNWIND_INCLUDE_DOCS=ON \ -DLIBUNWIND_INSTALL_INCLUDE_DIR=%{install_includedir}/llvm-libunwind \ - -DLIBUNWIND_INSTALL_SPHINX_HTML_DIR=%{_pkgdocdir}/html \ + -DLIBCXXABI_USE_LLVM_UNWINDER=OFF \ -DCMAKE_SKIP_RPATH:BOOL=ON %build_tool #endregion libcxx build #region libomp build +cp %{SOURCE3} %{build_src_dir}/CMakeLists.txt mkdir %{build_src_dir}/_build_openmp cd %{build_src_dir}/_build_openmp -%cmake %{build_src_dir}/openmp -GNinja \ +%cmake %{build_src_dir} -GNinja \ -DCMAKE_INSTALL_PREFIX=%{install_prefix} \ -DLIBOMP_INSTALL_ALIASES=OFF \ -DLLVM_DIR=%{build_src_dir}/%{build_dir}/%{_lib}/cmake/llvm/ \ + -DOPENMP_LLVM_TOOLS_DIR=%{build_src_dir}/%{build_dir}/bin/ \ + -DOFFLOAD_INSTALL_LIBDIR=%{install_libdir} \ + -DLLVM_CMAKE_DIR=%{build_src_dir}/%{build_dir} \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_INSTALL_INCLUDEDIR=%{install_libdir}/clang/%{maj_ver}/include \ + -DCMAKE_MODULE_PATH=%{build_src_dir}/%{build_dir}/%{_lib}/cmake/llvm \ %if 0%{?__isa_bits} == 64 -DOPENMP_LIBDIR_SUFFIX=64 \ %else @@ -1089,6 +1107,7 @@ cd %{build_src_dir}/_build_openmp -DCMAKE_SKIP_RPATH:BOOL=ON %build_tool + #endregion libomp build #region compiler-rt build @@ -1126,7 +1145,7 @@ cd %{build_src_dir}/_build_compiler-rt -DCMAKE_SKIP_RPATH:BOOL=ON \ -DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF # could be on? -%if %{os_version} <= 2203 +%if %{os_version} <= 2403 %make_build %else %build_tool @@ -1140,7 +1159,7 @@ cd %{build_src_dir} %install #region LLVM installation -%if %{os_version} <= 2203 +%if %{os_version} <= 2403 cd %{build_src_dir}/%{build_dir} %else cd %{build_src_dir}/llvm @@ -1148,7 +1167,9 @@ cd %{build_src_dir}/llvm %install_tool -%if %{maj_ver} <= 17 +%if %{os_version} <= 2203 +cp %{build_src_dir}/%{build_dir}/include/c++/v1/libcxx.imp %{build_src_dir}/_build_libcxx/include/c++/v1/libcxx.imp + cd %{build_src_dir}/_build_libcxx %install_tool @@ -1156,17 +1177,19 @@ cd %{build_src_dir}/_build_openmp %install_tool cd %{build_src_dir}/_build_compiler-rt -%if %{os_version} > 2203 +%if %{os_version} > 2403 %install_tool %else %make_install %endif -rm %{build_install_prefix}/lib/clang/%{maj_ver}/lib/%{llvm_triple}/clang_rt.crtbegin.o -rm %{build_install_prefix}/lib/clang/%{maj_ver}/lib/%{llvm_triple}/clang_rt.crtend.o -rm %{build_install_prefix}/lib/clang/%{maj_ver}/lib/%{llvm_triple}/libclang_rt.builtins.a +install %{build_libdir}/libomptarget.so.%{so_suffix} %{buildroot}%{install_libdir} %endif +rm -Rvf %{build_install_prefix}/lib/clang/%{maj_ver}/lib/%{llvm_triple}/clang_rt.crtbegin.o +rm -Rvf %{build_install_prefix}/lib/clang/%{maj_ver}/lib/%{llvm_triple}/clang_rt.crtend.o +rm -Rvf %{build_install_prefix}/lib/clang/%{maj_ver}/lib/%{llvm_triple}/libclang_rt.builtins.a + cd %{build_src_dir} mkdir -p %{buildroot}/%{_bindir} @@ -1377,7 +1400,7 @@ rm -rf %{buildroot}/%{install_datadir}/gdb %ifnarch %{ix86} # Remove files that we don't package, yet. -%if %{os_version} > 2203 +%if %{os_version} >= 2403 %if %{maj_ver} >= 20 rm %{buildroot}%{install_bindir}/llvm-offload-device-info %else @@ -2245,7 +2268,9 @@ fi %ghost %{_bindir}/llvm-config-%{maj_ver} %{install_bindir}/llvm-config-%{maj_ver}-%{__isa_bits} +%if %{os_version} > 2203 %{_mandir}/man1/llvm-config* +%endif %{install_includedir}/llvm %{install_includedir}/llvm-c %{install_libdir}/libLLVM.so @@ -2308,12 +2333,15 @@ fi %{install_bindir}/clang++-%{maj_ver} %{install_bindir}/clang-cl %{install_bindir}/clang-cpp +%if %{os_version} > 2203 %{_mandir}/man1/clang-%{maj_ver}.1.gz %{_mandir}/man1/clang++-%{maj_ver}.1.gz %if %{with sys_llvm} %{_mandir}/man1/clang.1.gz %{_mandir}/man1/clang++.1.gz -%else +%endif +%endif +%if %{without sys_llvm} %{_bindir}/clang-%{maj_ver} %{_bindir}/clang++-%{maj_ver} %{_bindir}/clang-cl-%{maj_ver} @@ -2370,7 +2398,9 @@ fi %{install_libexecdir}/intercept-cc %{install_datadir}/scan-view/ %{install_datadir}/scan-build/ +%if %{os_version} > 2203 %{_mandir}/man1/scan-build%{exec_suffix}.1.* +%endif %if %{with sys_llvm} %{python3_sitelib}/libear %{python3_sitelib}/libscanbuild @@ -2466,8 +2496,10 @@ fi %endif %{_emacs_sitestartdir}/clang-include-fixer.el %endif +%if %{os_version} > 2203 %{_mandir}/man1/diagtool%{exec_suffix}.1.gz %{_mandir}/man1/extraclangtools%{exec_suffix}.1.gz +%endif %{install_datadir}/clang/clang-format.py* %{install_datadir}/clang/clang-format-diff.py* %{install_datadir}/clang/clang-include-fixer.py* @@ -2814,6 +2846,10 @@ fi #endregion files %changelog + +* Mon Mar 31 2025 liyunfei - 19.1.7-7 +- Bugfixes for 2403 build + * Tue Mar 11 2025 jchzhou - 19.1.7-6 - Fix two minor packaging issues -- Gitee