diff --git a/README.en.md b/README.en.md index 2672f23b82d0d3b314f057ef6f080dfd45de4a31..485d5a3ffa58191f8cc35faad18bbafd4e66ab0f 100644 --- a/README.en.md +++ b/README.en.md @@ -1,22 +1,9 @@ # llvm-bolt #### Description -llvm-bolt is a post-link optimizer developed to speed up large applications - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx +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. #### Contribution diff --git a/README.md b/README.md index c1a4057b4bc8c638d4c0cf08dca35568615ce43e..1e836ceb9aab2e8b5e57a1f52e41c6f77d7d1bcd 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,9 @@ # llvm-bolt #### 介绍 -llvm-bolt is a post-link optimizer developed to speed up large applications - -#### 软件架构 -软件架构说明 - - -#### 安装教程 - -1. xxxx -2. xxxx -3. xxxx - -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx +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. #### 参与贡献 diff --git a/llvm-bolt.spec b/llvm-bolt.spec index 9f1c068af202f80b66e5a22fe680ab24165b5513..1be40dc137f07cbb590ff7f3c7738f40bd559ee3 100644 --- a/llvm-bolt.spec +++ b/llvm-bolt.spec @@ -1,61 +1,156 @@ -Name: llvm-bolt -Version: 0 -Release: 2.20211016.gitb72f753 +%bcond_without sys_llvm +%bcond_with check + +%global maj_ver 17 +%global min_ver 0 +%global patch_ver 6 +%global bolt_version %{maj_ver}.%{min_ver}.%{patch_ver} +%global bolt_srcdir llvm-project-%{bolt_version}.src + +%if %{with sys_llvm} +%global pkg_name llvm-bolt +%global install_prefix %{_prefix} +%else +%global pkg_name llvm-bolt%{maj_ver} +%global install_prefix %{_libdir}/llvm%{maj_ver} +%endif + +%global install_bindir %{install_prefix}/bin +%global install_libdir %{install_prefix}/lib +%global install_docdir %{install_prefix}/share/doc +%global max_link_jobs 2 + +Name: %{pkg_name} +Version: %{bolt_version} +Release: 1 Summary: BOLT is a post-link optimizer developed to speed up large applications License: Apache 2.0 -URL: https://github.com/facebookincubator/BOLT -Source0: %{name}-%{version}.tar.xz +URL: https://github.com/llvm/llvm-project/tree/main/bolt + +Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{bolt_version}/%{bolt_srcdir}.tar.xz +Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{bolt_version}/%{bolt_srcdir}.tar.xz.sig -BuildRequires: gcc gcc-c++ cmake ninja-build libstdc++-static chrpath ncurses-devel zlib-devel -Requires: glibc zlib ncurses-libs libstdc++ libgcc +# BOLT is not respecting the component split of LLVM and requires some private +# headers in order to compile itself. Try to disable as much libraries as +# possible in order to reduce build time. +#Patch0: rm-llvm-libs.diff -Patch1: 0001-Backport-Handle-data-at-the-beginning-of-a-function.patch +BuildRequires: gcc +BuildRequires: gcc-c++ +BuildRequires: cmake +BuildRequires: ninja-build +BuildRequires: zlib-devel +BuildRequires: python3-lit +BuildRequires: python3-psutil +BuildRequires: doxygen %description 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. +%package doc +Summary: Documentation for BOLT +BuildArch: noarch +Requires: %{name} = %{version}-%{release} + +%description doc +Documentation for the BOLT optimizer + %prep -%autosetup -p1 -mkdir -p _build -cd _build -%{__cmake} -G Ninja ../llvm -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLLVM_ENABLE_ASSERTIONS=ON \ - -DLLVM_ENABLE_PROJECTS="clang;lld;bolt" -DCMAKE_INSTALL_PREFIX=%{_usr} \ - -DLLVM_PARALLEL_LINK_JOBS=1 \ +%autosetup -n %{bolt_srcdir} -p1 + +%build +%{cmake} -G Ninja -S llvm \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DCMAKE_INSTALL_PREFIX=%{install_prefix} \ + -DCMAKE_SKIP_RPATH=ON \ + -DLLVM_DIR=%{install_libdir}/cmake/llvm \ + -DLLVM_TABLEGEN_EXE=%{install_bindir}/llvm-tblgen \ + -DLLVM_BUILD_UTILS:BOOL=ON \ + -DBOLT_INCLUDE_DOCS:BOOL=ON \ + -DLLVM_INCLUDE_TESTS:BOOL=ON \ + -DBUILD_SHARED_LIBS:BOOL=OFF \ + -DLLVM_LINK_LLVM_DYLIB:BOOL=OFF \ + -DLLVM_ENABLE_ASSERTIONS=ON \ + -DBOLT_INCLUDE_TESTS:BOOL=ON \ + -DLLVM_EXTERNAL_LIT=%{_bindir}/lit \ + -DLLVM_ENABLE_PROJECTS="bolt" \ + -DLLVM_PARALLEL_LINK_JOBS=%{max_link_jobs} \ %ifarch %ix86 x86_64 - -DLLVM_TARGETS_TO_BUILD="X86" + -DLLVM_TARGETS_TO_BUILD="X86" %endif %ifarch aarch64 - -DLLVM_TARGETS_TO_BUILD="AArch64" + -DLLVM_TARGETS_TO_BUILD="AArch64" %endif -%build -cd _build -%{ninja_build} + +# Set LD_LIBRARY_PATH now because we skip rpath generation and the build uses +# some just built libraries. +export LD_LIBRARY_PATH=%{_builddir}/%{bolt_srcdir}/%{_vpath_builddir}/%{_lib} +%ninja_build bolt %install -%{ninja_install} -C _build -%global _bolt_install_dir %{_buildrootdir}/%{name}-%{version}-%{release}.%{_arch}/usr -# remove extera llvm files. -find %{_bolt_install_dir} ! -name "llvm-bolt" ! -name "merge-fdata" ! -name "perf2bolt" -type f,l -exec rm -f '{}' \; -# remove static libs. -rm -rf %{_buildrootdir}/root -# remove rpath -chrpath -d %{_bolt_install_dir}/bin/llvm-bolt -chrpath -d %{_bolt_install_dir}/bin/merge-fdata +%ninja_install bolt + +# Remove extera llvm files. +find %{buildroot}%{install_prefix} \ + ! -name "llvm-bolt" \ + ! -name "merge-fdata" \ + ! -name "perf2bolt" \ + ! -name "llvm-boltdiff" \ + ! -name "llvm-bolt-heatmap" \ + ! -name "libbolt_rt_hugify.a" \ + ! -name "libbolt_rt_instr.a" \ + -type f,l -exec rm -f '{}' \; + + +# Remove files installed during the build phase. +rm -f %{buildroot}/%{_builddir}/%{bolt_srcdir}/%{_vpath_builddir}/%{_lib}/lib*.a + +# There currently is not support upstream for building html doc from BOLT +install -d %{buildroot}%{install_docdir} +mv bolt/README.md bolt/docs/*.md %{buildroot}%{install_docdir} + +%check + +%if %{with check} +%ifarch aarch64 +# Failing test cases on aarch64 +rm bolt/test/cache+-deprecated.test bolt/test/bolt-icf.test bolt/test/R_ABS.pic.lld.cpp +%endif + +export LD_LIBRARY_PATH=%{_builddir}/%{bolt_srcdir}//%{_vpath_builddir}/%{_lib} +export DESTDIR=%{buildroot} +%ninja_build check-bolt + +# Remove files installed during the check phase. +rm -f %{buildroot}/%{_builddir}/%{bolt_srcdir}/%{_vpath_builddir}/%{_lib}/lib*.a +%endif %files %license bolt/LICENSE.TXT -%doc bolt/docs/* -%exclude %{_includedir}/* -%exclude %{_datadir}/* -%exclude %{_builddir}/%{name}-%{version}/_build/* -%attr(0755,root,root) %{_bindir}/llvm-bolt -%attr(0755,root,root) %{_bindir}/merge-fdata -%attr(-,root,root) %{_bindir}/perf2bolt +%{install_bindir}/llvm-bolt +%{install_bindir}/llvm-boltdiff +%{install_bindir}/merge-fdata +%{install_bindir}/perf2bolt +%{install_bindir}/llvm-bolt-heatmap + +%ifarch x86_64 +%{install_libdir}/libbolt_rt_hugify.a +%{install_libdir}/libbolt_rt_instr.a +%endif + +%exclude %{_builddir}/%{bolt_srcdir}/lib/* + +%files doc +%doc %{install_docdir} + %changelog +* Mon Dec 4 2023 zhoujing 17.0.6-1 +- Update to 17.0.6 + * Thu Jun 15 2023 Xiong Zhou 0-2.20211016.gitb72f753 - Type:backport - ID:NA @@ -72,4 +167,4 @@ chrpath -d %{_bolt_install_dir}/bin/merge-fdata - Type:Init - ID:NA - SUG:NA -- DESC:Init llvm-bolt repository +- DESC:Init llvm-bolt repository \ No newline at end of file diff --git a/llvm-bolt-0.tar.xz b/llvm-project-17.0.6.src.tar.xz similarity index 74% rename from llvm-bolt-0.tar.xz rename to llvm-project-17.0.6.src.tar.xz index 9936e2322e725547ff5f963ab08463160f72c3da..cdcb13184e9bf3d86998f2e0f937d3a6e15da999 100644 Binary files a/llvm-bolt-0.tar.xz and b/llvm-project-17.0.6.src.tar.xz differ diff --git a/llvm-project-17.0.6.src.tar.xz.sig b/llvm-project-17.0.6.src.tar.xz.sig new file mode 100644 index 0000000000000000000000000000000000000000..59c3713127177606f6f6d95bf61790e3d7ad15cf Binary files /dev/null and b/llvm-project-17.0.6.src.tar.xz.sig differ