diff --git a/README.en.md b/README.en.md index e48774d964d638199a213c97612a3b1faf9fd2b4..98cc5fc798735530224792bd6d5514492147e470 100644 --- a/README.en.md +++ b/README.en.md @@ -1,22 +1,9 @@ # llvm-bolt-15 #### Description -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 3deebf9c67b338993db1853dd9b25d66e799f935..1e836ceb9aab2e8b5e57a1f52e41c6f77d7d1bcd 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,9 @@ -# llvm-bolt-15 +# llvm-bolt #### 介绍 -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 436501d990658aab9cc8164fd266180026c59ae0..141a118f15028fd525fe8b491ff8f64e43056755 100644 --- a/llvm-bolt.spec +++ b/llvm-bolt.spec @@ -1,99 +1,154 @@ -%global debug_package %{nil} +%bcond_without sys_llvm +%bcond_with check %global maj_ver 15 %global min_ver 0 %global patch_ver 7 -%global bolt_srcdir llvm-project-%{maj_ver}.%{min_ver}.%{patch_ver}.src -%global bin_suffix -%{maj_ver} +%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 -%global pkg_bindir %{install_bindir} -%global pkg_libdir %{install_libdir} - -Name: llvm-bolt-%{maj_ver} -Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 1 +Name: %{pkg_name} +Version: %{bolt_version} +Release: 2 Summary: BOLT is a post-link optimizer developed to speed up large applications License: Apache 2.0 -URL: https://github.com/facebookincubator/BOLT -Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/%{bolt_srcdir}.tar.xz +URL: https://github.com/llvm/llvm-project/tree/main/bolt -BuildRequires: gcc gcc-c++ cmake ninja-build libstdc++-static chrpath ncurses-devel zlib-devel -Requires: glibc zlib ncurses-libs libstdc++ libgcc +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 -# BOLT only supports aarch64 and x86_64 -ExclusiveArch: aarch64 x86_64 +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 -n %{bolt_srcdir} -mkdir -p _build -cd _build -%{__cmake} -G Ninja ../llvm \ - -DCMAKE_BUILD_TYPE=Release \ - -DLLVM_ENABLE_ASSERTIONS=ON \ - -DLLVM_ENABLE_PROJECTS="clang;lld;bolt" \ - -DCMAKE_INSTALL_PREFIX=%{install_prefix} \ - -DLLVM_PARALLEL_LINK_JOBS=%{max_link_jobs} \ - -DCMAKE_SKIP_RPATH:BOOL=ON \ +%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} +%ninja_build bolt %install +%ninja_install bolt -mkdir -p %{buildroot}/%{_bindir} -mkdir -p %{buildroot}%{install_bindir} -for f in llvm-boltdiff llvm-bolt merge-fdata perf2bolt -do - install -m 0755 %{_builddir}/%{bolt_srcdir}/_build/bin/$f %{buildroot}%{install_bindir} - filename=`basename %{buildroot}%{install_bindir}/$f` - ln -s ../../%{install_bindir}/$filename %{buildroot}/%{_bindir}/$filename%{bin_suffix} -done +# 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 '{}' \; + +# +rm -f %{_builddir}/%{bolt_srcdir}/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 x86_64 -mkdir -p %{buildroot}/%{_libdir} -mkdir -p %{buildroot}%{install_libdir} -for rt in libbolt_rt_instr.a libbolt_rt_hugify.a +# Bolt makes incorrect assumptions on the location of libbolt_rt_*.a. +mkdir -p %{_builddir}/%{bolt_srcdir}/lib +for rt in libbolt_rt_instr libbolt_rt_hugify do - install %{_builddir}/%{bolt_srcdir}/_build/lib/${rt} %{buildroot}%{install_libdir} + ln -s %{buildroot}/%{install_libdir}/${rt}.a %{_builddir}/%{bolt_srcdir}/lib done %endif -%check -%if %{with check} -cd _build -%ninja_build check_bolt +%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}/lib +export DESTDIR=%{buildroot} +%ninja_build check-bolt + +# Remove files installed during the check phase. +rm -f %{buildroot}/%{_builddir}/%{bolt_srcdir}/lib/lib*.a %endif %files %license bolt/LICENSE.TXT -%exclude %{_includedir}/* -%exclude %{_datadir}/* -%exclude %{_builddir}/%{bolt_srcdir}/_build/* -%{_bindir}/llvm-boltdiff%{bin_suffix} -%{_bindir}/llvm-bolt%{bin_suffix} -%{_bindir}/merge-fdata%{bin_suffix} -%{_bindir}/perf2bolt%{bin_suffix} -%{pkg_bindir} +%{install_bindir}/llvm-bolt +%{install_bindir}/llvm-boltdiff +%{install_bindir}/merge-fdata +%{install_bindir}/perf2bolt +%{install_bindir}/llvm-bolt-heatmap + %ifarch x86_64 -%{pkg_libdir} +%{install_libdir}/libbolt_rt_hugify.a +%{install_libdir}/libbolt_rt_instr.a %endif +%exclude %{_builddir}/%{bolt_srcdir}/lib/* + +%files doc +%doc %{install_docdir} + + %changelog +* Fri May 26 2023 cf-zhao 15.0.7-2 +- Make spec file support both system-version and multi-version + * Mon Feb 20 2023 Yunfei Li - 15.0.7-1 -- Init llvm-bolt-15 repository \ No newline at end of file +- Init llvm-bolt-15 repository diff --git a/llvm-project-15.0.7.src.tar.xz.sig b/llvm-project-15.0.7.src.tar.xz.sig new file mode 100644 index 0000000000000000000000000000000000000000..1560fd7e6b48361ab574b2605aad86dc5ab14bdf Binary files /dev/null and b/llvm-project-15.0.7.src.tar.xz.sig differ