mirror of
https://src.fedoraproject.org/rpms/llvm.git
synced 2024-11-24 17:34:47 +00:00
Make lto handling similar to current rawhide
Have a --with lto_build option, where LTO is enabled by default for everything except i686 and riscv. Use that flag to condition whether `-DLLVM_UNITTEST_LINK_FLAGS` is passed. Additionally, make use of the new Fat LTO functionality in rawhide to use `-fno-lto` instead of `-Wl,-plugin-opt=O0` to save more time linking unit tests.
This commit is contained in:
parent
3ddc01eec2
commit
1115746e65
2 changed files with 17 additions and 0 deletions
|
@ -193,7 +193,13 @@ cd llvm
|
||||||
%ifarch x86_64
|
%ifarch x86_64
|
||||||
-DCMAKE_SHARED_LINKER_FLAGS="$LDFLAGS -Wl,-z,cet-report=error" \
|
-DCMAKE_SHARED_LINKER_FLAGS="$LDFLAGS -Wl,-z,cet-report=error" \
|
||||||
%endif
|
%endif
|
||||||
|
%if %{with lto_build}
|
||||||
|
%if 0%{?fedora} >= 41
|
||||||
|
-DLLVM_UNITTEST_LINK_FLAGS="-fno-lto"
|
||||||
|
%else
|
||||||
-DLLVM_UNITTEST_LINK_FLAGS="-Wl,-plugin-opt=O0"
|
-DLLVM_UNITTEST_LINK_FLAGS="-Wl,-plugin-opt=O0"
|
||||||
|
%endif
|
||||||
|
%endif
|
||||||
|
|
||||||
# Build libLLVM.so first. This ensures that when libLLVM.so is linking, there
|
# Build libLLVM.so first. This ensures that when libLLVM.so is linking, there
|
||||||
# are no other compile jobs running. This will help reduce OOM errors on the
|
# are no other compile jobs running. This will help reduce OOM errors on the
|
||||||
|
|
|
@ -9,6 +9,17 @@
|
||||||
%bcond_with compat_build
|
%bcond_with compat_build
|
||||||
%bcond_without check
|
%bcond_without check
|
||||||
|
|
||||||
|
# Disable LTO on x86 and riscv in order to reduce memory consumption.
|
||||||
|
%ifarch %ix86 riscv64
|
||||||
|
%bcond_with lto_build
|
||||||
|
%else
|
||||||
|
%bcond_without lto_build
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if %{without lto_build}
|
||||||
|
%global _lto_cflags %nil
|
||||||
|
%endif
|
||||||
|
|
||||||
# We are building with clang for faster/lower memory LTO builds.
|
# We are building with clang for faster/lower memory LTO builds.
|
||||||
# See https://docs.fedoraproject.org/en-US/packaging-guidelines/#_compiler_macros
|
# See https://docs.fedoraproject.org/en-US/packaging-guidelines/#_compiler_macros
|
||||||
%global toolchain clang
|
%global toolchain clang
|
||||||
|
|
Loading…
Reference in a new issue