The X86_NATIVE_CPU Kconfig build time parameter has been merged for the Linux 6.16 merge window as an easy way to enforce the “-march=native” compiler behavior on AMD and Intel processors to optimize kernel builds for your system’s local CPU architecture/family. For those who want “-march=native” for Linux kernel builds on AMD/Intel x86_64 processors, you can easily include a new CONFIG_X86_NATIVE_CPU parameter to set this compiler behavior in local kernel builds. The CONFIG_X86_NATIVE_CPU parameter is considered when compiling the Linux x86_64 kernel with GCC or LLVM Clang when using Clang 19 or later due to a compiler bug in the Linux kernel in older compiler versions. In addition to setting the compiler parameter “-march=native” for Linux kernel C code, enabling this new Kconfig build parameter also sets “-Ctarget-cpu=native” for Rust kernel code.

  • LiveLM@lemmy.zip
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    2 days ago

    This sounds nice but compiling the kernel takes a while on my machine. Whenever I try these custom kernels/config options I end up going back to the regular out of sheer lazyness :p