On Fri, 14 Mar 2025 at 14:05, Nuno Teixeira <edua...@freebsd.org> wrote: > > Hello Ed, > > I have a newbie question about building world/kernel with LTO. > I did not found too much info googling, but I found > https://wiki.freebsd.org/LinkTimeOptimization and it says: > > Build and link a kernel with: > > WITHOUT_CTF=yes > WITHOUT_DTRACE=yes > sys/conf/kern.mk -flto=thin (for all clang invocations) > > Is this the correct way to test LTO atm?
That page is pretty much completely out of date, unfortunately. Eventually we want to have user-facing knobs for this (for example, WITH_KERNEL_LTO in src.conf) but for experimentation you need to add -flto or -flto=thin to the compiler and linker invocations. This should be possible by setting CFLAGS and LDFLAGS on the command line or by editing kern.mk.