diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000000000000000000000000000000000..8ce7b722bf615e3b8522a39924e595d953c1fc6f --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.tar.gz filter=lfs diff=lfs merge=lfs -text diff --git a/.lfsconfig b/.lfsconfig new file mode 100644 index 0000000000000000000000000000000000000000..3ff73de9a83b3ae2b285171b30933b5128f28016 --- /dev/null +++ b/.lfsconfig @@ -0,0 +1,2 @@ +[lfs] + url = https://artlfs.openeuler.openatom.cn/src-openEuler/llvm-toolset-19 \ No newline at end of file diff --git a/0002-Add-triples-for-X86_64-AArch64-Riscv64-openEuler-gcc.patch b/0002-Add-triples-for-X86_64-AArch64-Riscv64-openEuler-gcc.patch deleted file mode 100644 index 6c20d9a1efb9ce39e2876ef6d2290e35c9a49517..0000000000000000000000000000000000000000 --- a/0002-Add-triples-for-X86_64-AArch64-Riscv64-openEuler-gcc.patch +++ /dev/null @@ -1,55 +0,0 @@ -From a833e7fa829764f8e3bf6b059c9e91080ca55253 Mon Sep 17 00:00:00 2001 -From: liyunfei -Date: Mon, 24 Jul 2023 19:16:45 +0800 -Subject: [PATCH] Add triples for X86_64/AArch64/Riscv64 openEuler gcc - ---- - clang/lib/Driver/ToolChains/Gnu.cpp | 12 ++-- - 1 file changed, 8 insertions(+), 4 deletions(-) - -diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp -index 665cdc3132fb..fc56935e7513 100644 ---- a/clang/lib/Driver/ToolChains/Gnu.cpp -+++ b/clang/lib/Driver/ToolChains/Gnu.cpp -@@ -2467,7 +2467,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( - static const char *const AArch64LibDirs[] = {"/lib64", "/lib"}; - static const char *const AArch64Triples[] = { - "aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-redhat-linux", -- "aarch64-suse-linux"}; -+ "aarch64-suse-linux", "aarch64-openEuler-linux", "aarch64-kylin-linux"}; - static const char *const AArch64beLibDirs[] = {"/lib"}; - static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu"}; - -@@ -2495,7 +2495,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( - "x86_64-pc-linux-gnu", "x86_64-redhat-linux6E", - "x86_64-redhat-linux", "x86_64-suse-linux", - "x86_64-manbo-linux-gnu", "x86_64-slackware-linux", -- "x86_64-unknown-linux", "x86_64-amazon-linux"}; -+ "x86_64-unknown-linux", "x86_64-amazon-linux", -+ "x86_64-openEuler-linux", "x86_64-kylin-linux"}; - static const char *const X32Triples[] = {"x86_64-linux-gnux32", - "x86_64-pc-linux-gnux32"}; - static const char *const X32LibDirs[] = {"/libx32", "/lib"}; -@@ -2508,7 +2508,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( - - static const char *const LoongArch64LibDirs[] = {"/lib64", "/lib"}; - static const char *const LoongArch64Triples[] = { -- "loongarch64-linux-gnu", "loongarch64-unknown-linux-gnu"}; -+ "loongarch64-linux-gnu", "loongarch64-unknown-linux-gnu", -+ "loongarch64-openEuler-linux", "loongarch64-kylin-linux"}; - - static const char *const M68kLibDirs[] = {"/lib"}; - static const char *const M68kTriples[] = {"m68k-unknown-linux-gnu", -@@ -2565,7 +2565,9 @@ - "riscv32-unknown-elf"}; - static const char *const RISCV64LibDirs[] = {"/lib64", "/lib"}; - static const char *const RISCV64Triples[] = {"riscv64-unknown-linux-gnu", -- "riscv64-unknown-elf"}; -+ "riscv64-unknown-elf", -+ "riscv64-openEuler-linux", -+ "riscv64-kylin-linux"}; - - static const char *const SPARCv8LibDirs[] = {"/lib32", "/lib"}; - static const char *const SPARCv8Triples[] = {"sparc-linux-gnu", --- -2.28.0.windows.1 diff --git a/0003-Always-build-shared-libs-for-LLD.patch b/0002-Always-build-shared-libs-for-LLD.patch similarity index 100% rename from 0003-Always-build-shared-libs-for-LLD.patch rename to 0002-Always-build-shared-libs-for-LLD.patch diff --git a/0003-PATCH-Bolt-CMake-Don-t-export-bolt-libraries-in-LLVM.patch b/0003-PATCH-Bolt-CMake-Don-t-export-bolt-libraries-in-LLVM.patch new file mode 100644 index 0000000000000000000000000000000000000000..086675c714384975420fccf4bff6feb45528c9aa --- /dev/null +++ b/0003-PATCH-Bolt-CMake-Don-t-export-bolt-libraries-in-LLVM.patch @@ -0,0 +1,186 @@ +From ee0f56cff40b324bb06e034e247ec85ae9a846bf Mon Sep 17 00:00:00 2001 +From: Nikita Popov +Date: Wed, 8 Jan 2025 08:28:18 +0100 +Subject: [PATCH] [PATCH] [Bolt][CMake] Don't export bolt libraries in + LLVMExports.cmake + +Bolt makes use of add_llvm_library and as such ends up exporting +its libraries from LLVMExports.cmake, which is not correct. + +Bolt doesn't have its own exports file, and I assume that there +is no desire to have one either -- Bolt libraries are not intended +to be consumed as a cmake module, right? + +As such, this PR adds a NO_EXPORT option to simplify exclude these +libraries from the exports file. + +--- +This patch originates from this PR: + +https://patch-diff.githubusercontent.com/raw/llvm/llvm-project/pull/121936. + +The commit was: + +https://github.com/nikic/llvm-project/commit/4333a4dd270b5c046c5469b97846e3dae58fb221.patch + +And then it was rebased onto llvmorg-19.1.6. +--- + bolt/lib/Core/CMakeLists.txt | 1 + + bolt/lib/Passes/CMakeLists.txt | 1 + + bolt/lib/Profile/CMakeLists.txt | 1 + + bolt/lib/Rewrite/CMakeLists.txt | 1 + + bolt/lib/RuntimeLibs/CMakeLists.txt | 1 + + bolt/lib/Target/AArch64/CMakeLists.txt | 1 + + bolt/lib/Target/RISCV/CMakeLists.txt | 1 + + bolt/lib/Target/X86/CMakeLists.txt | 1 + + bolt/lib/Utils/CMakeLists.txt | 1 + + llvm/cmake/modules/AddLLVM.cmake | 12 +++++++++--- + 10 files changed, 18 insertions(+), 3 deletions(-) + +diff --git a/bolt/lib/Core/CMakeLists.txt b/bolt/lib/Core/CMakeLists.txt +index bb58667066fd..8c1f5d0bb37b 100644 +--- a/bolt/lib/Core/CMakeLists.txt ++++ b/bolt/lib/Core/CMakeLists.txt +@@ -35,6 +35,7 @@ add_llvm_library(LLVMBOLTCore + ParallelUtilities.cpp + Relocation.cpp + ++ NO_EXPORT + DISABLE_LLVM_LINK_LLVM_DYLIB + LINK_LIBS + ${LLVM_PTHREAD_LIB} +diff --git a/bolt/lib/Passes/CMakeLists.txt b/bolt/lib/Passes/CMakeLists.txt +index 407d8b03f739..7367b541545d 100644 +--- a/bolt/lib/Passes/CMakeLists.txt ++++ b/bolt/lib/Passes/CMakeLists.txt +@@ -45,6 +45,7 @@ add_llvm_library(LLVMBOLTPasses + VeneerElimination.cpp + RetpolineInsertion.cpp + ++ NO_EXPORT + DISABLE_LLVM_LINK_LLVM_DYLIB + + LINK_LIBS +diff --git a/bolt/lib/Profile/CMakeLists.txt b/bolt/lib/Profile/CMakeLists.txt +index 9aa4ba0490b0..a2bb4aa074c7 100644 +--- a/bolt/lib/Profile/CMakeLists.txt ++++ b/bolt/lib/Profile/CMakeLists.txt +@@ -7,6 +7,7 @@ add_llvm_library(LLVMBOLTProfile + YAMLProfileReader.cpp + YAMLProfileWriter.cpp + ++ NO_EXPORT + DISABLE_LLVM_LINK_LLVM_DYLIB + + LINK_COMPONENTS +diff --git a/bolt/lib/Rewrite/CMakeLists.txt b/bolt/lib/Rewrite/CMakeLists.txt +index 34993af2623b..6737e89b8451 100644 +--- a/bolt/lib/Rewrite/CMakeLists.txt ++++ b/bolt/lib/Rewrite/CMakeLists.txt +@@ -26,6 +26,7 @@ add_llvm_library(LLVMBOLTRewrite + RewriteInstance.cpp + SDTRewriter.cpp + ++ NO_EXPORT + DISABLE_LLVM_LINK_LLVM_DYLIB + + LINK_LIBS +diff --git a/bolt/lib/RuntimeLibs/CMakeLists.txt b/bolt/lib/RuntimeLibs/CMakeLists.txt +index d3ac71d3e797..b8db7e4a1553 100644 +--- a/bolt/lib/RuntimeLibs/CMakeLists.txt ++++ b/bolt/lib/RuntimeLibs/CMakeLists.txt +@@ -11,6 +11,7 @@ add_llvm_library(LLVMBOLTRuntimeLibs + HugifyRuntimeLibrary.cpp + InstrumentationRuntimeLibrary.cpp + ++ NO_EXPORT + DISABLE_LLVM_LINK_LLVM_DYLIB + ) + +diff --git a/bolt/lib/Target/AArch64/CMakeLists.txt b/bolt/lib/Target/AArch64/CMakeLists.txt +index be03e247aa96..526a9645cb54 100644 +--- a/bolt/lib/Target/AArch64/CMakeLists.txt ++++ b/bolt/lib/Target/AArch64/CMakeLists.txt +@@ -7,6 +7,7 @@ set(LLVM_LINK_COMPONENTS + add_llvm_library(LLVMBOLTTargetAArch64 + AArch64MCPlusBuilder.cpp + ++ NO_EXPORT + DISABLE_LLVM_LINK_LLVM_DYLIB + + DEPENDS +diff --git a/bolt/lib/Target/RISCV/CMakeLists.txt b/bolt/lib/Target/RISCV/CMakeLists.txt +index 7f9557606320..3955cfc0f089 100644 +--- a/bolt/lib/Target/RISCV/CMakeLists.txt ++++ b/bolt/lib/Target/RISCV/CMakeLists.txt +@@ -7,6 +7,7 @@ set(LLVM_LINK_COMPONENTS + add_llvm_library(LLVMBOLTTargetRISCV + RISCVMCPlusBuilder.cpp + ++ NO_EXPORT + DISABLE_LLVM_LINK_LLVM_DYLIB + + DEPENDS +diff --git a/bolt/lib/Target/X86/CMakeLists.txt b/bolt/lib/Target/X86/CMakeLists.txt +index 2b769bc7e7f5..00100e9b84c9 100644 +--- a/bolt/lib/Target/X86/CMakeLists.txt ++++ b/bolt/lib/Target/X86/CMakeLists.txt +@@ -9,6 +9,7 @@ add_llvm_library(LLVMBOLTTargetX86 + X86MCPlusBuilder.cpp + X86MCSymbolizer.cpp + ++ NO_EXPORT + DISABLE_LLVM_LINK_LLVM_DYLIB + + DEPENDS +diff --git a/bolt/lib/Utils/CMakeLists.txt b/bolt/lib/Utils/CMakeLists.txt +index d1403314274b..ceddcfc8f57a 100644 +--- a/bolt/lib/Utils/CMakeLists.txt ++++ b/bolt/lib/Utils/CMakeLists.txt +@@ -2,6 +2,7 @@ add_llvm_library(LLVMBOLTUtils + CommandLineOpts.cpp + Utils.cpp + ++ NO_EXPORT + DISABLE_LLVM_LINK_LLVM_DYLIB + + LINK_LIBS +diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake +index 03f4e1f190fd..addf083b7c71 100644 +--- a/llvm/cmake/modules/AddLLVM.cmake ++++ b/llvm/cmake/modules/AddLLVM.cmake +@@ -897,7 +897,7 @@ endfunction() + + macro(add_llvm_library name) + cmake_parse_arguments(ARG +- "SHARED;BUILDTREE_ONLY;MODULE;INSTALL_WITH_TOOLCHAIN" ++ "SHARED;BUILDTREE_ONLY;MODULE;INSTALL_WITH_TOOLCHAIN;NO_EXPORT" + "" + "" + ${ARGN}) +@@ -932,7 +932,11 @@ macro(add_llvm_library name) + set(umbrella) + endif() + +- get_target_export_arg(${name} LLVM export_to_llvmexports ${umbrella}) ++ if(ARG_NO_EXPORT) ++ set(export_to_llvmexports) ++ else() ++ get_target_export_arg(${name} LLVM export_to_llvmexports ${umbrella}) ++ endif() + install(TARGETS ${name} + ${export_to_llvmexports} + LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name} +@@ -945,7 +949,9 @@ macro(add_llvm_library name) + COMPONENT ${name}) + endif() + endif() +- set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name}) ++ if(NOT ARG_NO_EXPORT) ++ set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name}) ++ endif() + endif() + + get_subproject_title(subproject_title) +-- +2.47.1 diff --git a/0004-Offload-Add-support-for-riscv64-to-host-plugin.patch b/0004-Offload-Add-support-for-riscv64-to-host-plugin.patch deleted file mode 100644 index e008d57b932a6f08d6347931cebb2888777e1479..0000000000000000000000000000000000000000 --- a/0004-Offload-Add-support-for-riscv64-to-host-plugin.patch +++ /dev/null @@ -1,94 +0,0 @@ -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-for-oE-19.1.7-2506.0.2.tar.gz b/llvm-for-oE-19.1.7-2506.0.2.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..22e84c0806e2f8fc9691be289afe0d7609d78185 --- /dev/null +++ b/llvm-for-oE-19.1.7-2506.0.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8b52b41ade2ab4da096da2a75a2516ecdecb600fc337383c765bcffeacff59f2 +size 217538887 diff --git a/llvm-project-19.1.7.src.tar.xz b/llvm-project-19.1.7.src.tar.xz deleted file mode 100644 index bd4c99a1b3a78f671110ca7734d43fc147746dca..0000000000000000000000000000000000000000 Binary files a/llvm-project-19.1.7.src.tar.xz and /dev/null differ diff --git a/llvm-project-19.1.7.src.tar.xz.sig b/llvm-project-19.1.7.src.tar.xz.sig deleted file mode 100644 index e76e9605ced6f2f852765bc908463b142b23f70c..0000000000000000000000000000000000000000 Binary files a/llvm-project-19.1.7.src.tar.xz.sig and /dev/null differ diff --git a/llvm-toolset-19.spec b/llvm-toolset-19.spec index bee9d201c5144b5b2505f43c8da859786aeb4162..a02661e85bc41b20d54cce935ee27380773b6b7b 100644 --- a/llvm-toolset-19.spec +++ b/llvm-toolset-19.spec @@ -5,6 +5,10 @@ %global patch_ver 7 %global os_version %{lua: print(tonumber(rpm.expand("%{dist}"):match("oe(%d+)") or 9999))} +# the dist of master is ".oe1" now +%if %{os_version} == 1 +%global os_version 9999 +%endif # Build sys_llvm packages or compat packages %bcond_with sys_llvm @@ -24,13 +28,20 @@ %bcond_without lldb %bcond_without libcxx +%ifarch aarch64 x86_64 +%bcond_without bolt +%else +%bcond_with bolt +%endif + %if %{with toolchain_clang} %global toolchain clang %endif %undefine __cmake_in_source_build -%global src_tarball_dir llvm-project-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-rc%{rc_ver}}.src +%global src_tarball llvm-for-oE-19.1.7-2506.0.2 +%global src_tarball_dir llvm-project-%{src_tarball} #region LLVM globals @@ -145,18 +156,21 @@ %global pkg_name_llvm_libunwind %{?scl_prefix}llvm-libunwind #endregion libcxx globals +#region BOLT globals +%global pkg_name_bolt %{?scl_prefix}llvm-bolt +#endregion BOLT globals + #region packages #region main package Name: llvm-toolset-%{maj_ver} Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 6 +Release: 11 Summary: The Low Level Virtual Machine License: NCSA -URL: http://llvm.org +URL: https://gitee.com/openeuler/llvm-project -Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}/%{src_tarball_dir}.tar.xz -Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}/%{src_tarball_dir}.tar.xz.sig +Source0: https://gitee.com/openeuler/llvm-project/repository/archive/%{src_tarball}.tar.gz # CMakeLists for libcxx build %if %{maj_ver} == 17 @@ -164,11 +178,8 @@ Source2: CMakeLists.txt %endif 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 +Patch0002: 0002-Always-build-shared-libs-for-LLD.patch +Patch0003: 0003-PATCH-Bolt-CMake-Don-t-export-bolt-libraries-in-LLVM.patch BuildRequires: gcc BuildRequires: gcc-c++ @@ -719,6 +730,24 @@ Documentation for LLVM libunwind %endif #endregion libcxx packages +#region BOLT packages +%if %{with bolt} +%package -n %{pkg_name_bolt} +Summary: A post-link optimizer developed to speed up large applications +License: Apache-2.0 WITH LLVM-exception +URL: https://github.com/llvm/llvm-project/tree/main/bolt + +# As hinted by bolt documentation +Recommends: gperftools-devel + +%description -n %{pkg_name_bolt} + +BOLT is a post-link optimizer developed to speed up large applications. +It achieves the improvements by optimizing application's code layout based on +execution profile gathered by sampling profiler, such as Linux `perf` tool. +%endif +#endregion BOLT packages + #endregion packages #region prep @@ -762,6 +791,10 @@ Documentation for LLVM libunwind %global projects %{projects};mlir %endif +%if %{with bolt} +%global projects %{projects};bolt +%endif + %global runtimes compiler-rt;openmp %if %{maj_ver} >= 19 @@ -1451,6 +1484,11 @@ popd %endif #endregion libcxx installation +#region BOLT installation +# We don't ship libLLVMBOLT*.a +rm -f %{buildroot}%{_libdir}/libLLVMBOLT*.a +#endregion BOLT installation + %if %{without sys_llvm} # Add version suffix to binaries. Do this at the end so it includes any # additional binaries that may be been added by other steps. @@ -1863,6 +1901,51 @@ export PYTHONPATH=%{buildroot}/%{python3_sitearch} %endif #endregion Test MLIR +#region BOLT tests +%if %{with bolt} +%if %{maj_ver} < 20 +export LIT_XFAIL="$LIT_XFAIL;AArch64/build_id.c" +export LIT_XFAIL="$LIT_XFAIL;AArch64/plt-call.test" +export LIT_XFAIL="$LIT_XFAIL;X86/linux-static-keys.s" +export LIT_XFAIL="$LIT_XFAIL;X86/plt-call.test" +%endif + +# Beginning with LLVM 20 this test has the "non-root-user" requirement +# and then the test should pass. But now it is flaky, hence we can only +# filter it out. +test_list_filter_out+=("BOLT :: unreadable-profile.test") + +%ifarch aarch64 +# Failing test cases on aarch64 +# TODO(kkleine): The following used to fail on aarch64 but passed today. +#export LIT_XFAIL="$LIT_XFAIL;cache+-deprecated.test" +#export LIT_XFAIL="$LIT_XFAIL;bolt-icf.test" +#export LIT_XFAIL="$LIT_XFAIL;R_ABS.pic.lld.cpp" + +# The following tests require LSE in order to run. +# More info at: https://github.com/llvm/llvm-project/issues/86485 +if ! grep -q atomics /proc/cpuinfo; then + test_list_filter_out+=("BOLT :: runtime/AArch64/basic-instrumentation.test") + test_list_filter_out+=("BOLT :: runtime/AArch64/hook-fini.test") + test_list_filter_out+=("BOLT :: runtime/AArch64/instrumentation-ind-call.c") + test_list_filter_out+=("BOLT :: runtime/exceptions-instrumentation.test") + test_list_filter_out+=("BOLT :: runtime/instrumentation-indirect-2.c") + test_list_filter_out+=("BOLT :: runtime/pie-exceptions-split.test") +fi +%endif + +%if %{maj_ver} < 20 +%ifarch x86_64 +# BOLT-ERROR: instrumentation of static binary currently does not support profile output on binary +# finalization, so it requires -instrumentation-sleep-time=N (N>0) usage +export LIT_XFAIL="$LIT_XFAIL;X86/internal-call-instrument.s" +%endif +%endif + +%cmake_build --target check-bolt +%endif +#endregion BOLT tests + %endif #endregion check @@ -2811,9 +2894,59 @@ fi %doc %{_pkgdocdir}/html #endregion libcxx files +#region BOLT files +%if %{with bolt} +%files -n %{pkg_name_bolt} +%license bolt/LICENSE.TXT +%{install_bindir}/llvm-bolt +%if %{maj_ver} >= 20 +%{install_bindir}/llvm-bolt-binary-analysis +%endif +%{install_bindir}/llvm-boltdiff +%{install_bindir}/llvm-bolt-heatmap +%{install_bindir}/merge-fdata +%{install_bindir}/perf2bolt +%{install_bindir}/bolt-linux-instr + +%{install_libdir}/libbolt_rt_hugify.a +%{install_libdir}/libbolt_rt_instr.a +%{install_libdir}/libbolt_rt_instr_linux.a + +%if %{without sys_llvm} +%{_bindir}/llvm-bolt-%{maj_ver} +%if %{maj_ver} >= 20 +%{_bindir}/llvm-bolt-binary-analysis-%{maj_ver} +%endif +%{_bindir}/llvm-boltdiff-%{maj_ver} +%{_bindir}/llvm-bolt-heatmap-%{maj_ver} +%{_bindir}/merge-fdata-%{maj_ver} +%{_bindir}/perf2bolt-%{maj_ver} +%{_bindir}/bolt-linux-instr-%{maj_ver} +%endif + +%endif +#endregion BOLT files + #endregion files %changelog +* Mon Aug 18 2025 liyunfei - 19.1.7-11 +- apply master dist .oe0 + +* Mon Jul 14 2025 liyunfei - 19.1.7-10 +- update to llvm-for-oE-19.1.7-2506.0.2 +- release note: https://gitee.com/openeuler/llvm-project/releases/tag/llvm-for-oE-19.1.7-2506.0.2 + +* Thu Jun 12 2025 liyunfei - 19.1.7-9 +- Add compiler & openEuler oeaware schedule opt + +* Fri May 30 2025 liyunfei - 19.1.7-8 +- update to llvm-for-oE-19.1.7-2506.0.1 +- release-note https://gitee.com/openeuler/llvm-project/compare/cd708029e0b2869e80abe31ddb175f7c35361f90...0c7685b92302b234e353f64d6589a63051a29cea + +* Fri May 16 2025 liyunfei - 19.1.7-7 +- Add bolt + * Tue Mar 11 2025 jchzhou - 19.1.7-6 - Fix two minor packaging issues