Skip to content

PKGBUILD: add "clang" mode and rename _use_llvm_lto to _use_llvm#739

Open
ptr1337 wants to merge 1 commit intomasterfrom
clang-non-lto
Open

PKGBUILD: add "clang" mode and rename _use_llvm_lto to _use_llvm#739
ptr1337 wants to merge 1 commit intomasterfrom
clang-non-lto

Conversation

@ptr1337
Copy link
Member

@ptr1337 ptr1337 commented Feb 28, 2026

Add a new "clang" option to _use_llvm (formerly _use_llvm_lto) that uses Clang as the compiler with LTO disabled. This is useful for AutoFDO/Propeller profiling workflows and testing without the overhead of LTO linking.

I will run some benchmarks to test the performance between ThinLTO + Propeller and Clang + Propeller. The main benefit we would have here, is that we can enable support for Rust and preparing for the future in case more and more drivers get depending on it.

The QR_CODE Bluescreen is pretty nice and we can also implement an own site for this.
Will enhance to other PKGBUILDs when reviewed

Add a new "clang" option to _use_llvm (formerly _use_llvm_lto) that
uses Clang as the compiler with LTO disabled. This is useful for
AutoFDO/Propeller profiling workflows and testing without the overhead
of LTO linking.

Signed-off-by: Peter Jung <admin@ptr1337.dev>
return $?
}

_is_clang_build() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mainly added this for the QR Code check

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the linux-cachyos PKGBUILD to support building with Clang while keeping LTO disabled, by renaming the existing LLVM/LTO selector and expanding it with a new clang mode.

Changes:

  • Rename _use_llvm_lto to _use_llvm and broaden its accepted values to include clang.
  • Add _is_clang_build() helper and update suffix/makedepends logic to treat clang like other LLVM-based builds.
  • Update build/config/signing/header dependency logic to use the new _use_llvm variable and clang-build detection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@1Naim 1Naim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments, I think we should keep _use_llvm_lto as a compat option for something like the kernel manager.

Comment on lines +155 to +160
[[ "$_use_llvm" = "thin" || "$_use_llvm" = "full" || "$_use_llvm" = "thin-dist" ]]
return $?
}

_is_clang_build() {
_is_lto_kernel || [[ "$_use_llvm" = "clang" ]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[[ "$_use_llvm" = "thin" || "$_use_llvm" = "full" || "$_use_llvm" = "thin-dist" ]]
return $?
}
_is_clang_build() {
_is_lto_kernel || [[ "$_use_llvm" = "clang" ]]
_is_clang_build() {
[[ "$_use_llvm" != "none" ]]
}
is_lto_kernel {
is_clang_build && [[ "$_use_llvm" != "clang" ]]
}

Just a slight nitpick. Either works.

# "thin": use Clang with ThinLTO - multiple threads, faster and uses less memory, may have a lower runtime performance than Full.
# "thin-dist": use Clang with distributed ThinLTO - https://discourse.llvm.org/t/rfc-distributed-thinlto-build-for-kernel/85934
# "full": use Clang with Full LTO - 1 thread for Linking, slow and uses more memory, theoretically with the highest performance gains.
: "${_use_llvm:=thin}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to replace "none" and "clang" to "no" and "yes" respectively to match the other config options?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would require then another variable for clang = no/yes and then which kind of lto mode?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No just keep it all-in-one.

So instead of none, clang, thin, full, etc. There's no, yes, thin, full, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants