From 909b415639fd2e87a7ca60880f93da9d2a1ddada Mon Sep 17 00:00:00 2001 From: Eric Naim Date: Fri, 6 Dec 2024 19:51:12 +0800 Subject: [PATCH] PKGBUILD: Make LTO a hard dependency when building with clang In hindsight, there's not much to be gained by compiling clang without LTO. Faster compile times can be achieved but the additional time it takes using LTO hardly matters on modern computers. Forcing this on also makes it simple for the build script we use because the clang-specific features aren't available on GCC (obviously). Also refactored the pkgsuffix conditions to use _is_lto_kernel instead to make it cleaner. Suggested-by: Vasiliy Stelmachenok Signed-off-by: Eric Naim --- linux-cachyos/PKGBUILD | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/linux-cachyos/PKGBUILD b/linux-cachyos/PKGBUILD index 40bacfcc..33000741 100644 --- a/linux-cachyos/PKGBUILD +++ b/linux-cachyos/PKGBUILD @@ -156,14 +156,14 @@ _autofdo_profile_name=${_autofdo_profile_name-} # ATTENTION: Do not modify after this line -_is_clang_kernel() { - [[ "$_use_llvm_lto" = "thin" || "$_use_llvm_lto" = "full" ]] || [ -n "$_use_kcfi" ] || [ -n "$_autofdo" ] +_is_lto_kernel() { + [[ "$_use_llvm_lto" = "thin" || "$_use_llvm_lto" = "full" ]] return $? } -if [[ "$_use_llvm_lto" = "thin" || "$_use_llvm_lto" = "full" ]] && [ "$_use_lto_suffix" = "y" ]; then +if _is_lto_kernel && [ "$_use_lto_suffix" = "y" ]; then _pkgsuffix=cachyos-lto -elif [ "$_use_llvm_lto" = "none" ] && [ -z "$_use_kcfi" ] && [ "$_use_gcc_suffix" = "y" ]; then +elif ! _is_lto_kernel && [ "$_use_gcc_suffix" = "y" ]; then _pkgsuffix=cachyos-gcc else _pkgsuffix=cachyos @@ -212,7 +212,7 @@ source=( "${_patchsource}/all/0001-cachyos-base-all.patch") # LLVM makedepends -if _is_clang_kernel; then +if _is_lto_kernel; then makedepends+=(clang llvm lld) source+=("${_patchsource}/misc/dkms-clang.patch") BUILD_FLAGS=(