How can I set gcc compiler flags for optimizations when I compile a kernel ?
I followed succesfully the instructions on https://docs.01.org/clearlinux/latest/guides/kernel/kernel-development.html but I cannot seem to figure out how to set the flags.
I have a i9 9900kf cpu which means
-mtune= (as coffee lake does not exist separately). My
/usr/share/defaults/etc/profile both show the same situation for
CXXFLAGS, in which there is
-mtune=skylake, but when I compile the kernel it always shows
-mtune=haswell in both
In the kernel Makefile there is a:
# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments KBUILD_CPPFLAGS += $(KCPPFLAGS) KBUILD_AFLAGS += $(KAFLAGS) KBUILD_CFLAGS += $(KCFLAGS)
section, but settings
KCPPFLAGS changes nothing.
haswell gives no result in the
clearlinux/packages/linux directory, so these are not written anywhere. How does the kernel make process even decide what flags to use ?
-march used to include
-mtune but by other people’s testing this is no longer the case. So, should I use both, should I use only one. Is it better to use
-mtune=native (I gues it would choose
skylake) … I have heard that that can give a different final binary, as well even if the correct
-march are chosen right.
So, which ones are important among:
And how can I set them ?
And how about
Also, if this is the wrong section of the forum to post this in - please move it to another … I couldn’t choose between general discussion and dev, and since I am not a dev … I figured it should be here.
I am going to be running something heavy on my cpu, so I want to sqweeze it to the limit (plus I have overclocked it pretty decent) and I am also simply always interested in optimization.