Welcome to the forum!
I’m afraid you misunderstand things. --march=native
is a compile-time option, whereby gcc
will attempt to make its object code use all of the native CPU flags ─ even though gcc
does behave quite conservatively in that regard and may skip a few of those flags. In other words, these are not flags that you can switch on and off at runtime. Once the binary has been built, it has been built.
That said, Manjaro, like Arch, uses generic compile flags because it has to be able to run on all existing x86-64
processors, but there are effectively also processor-specific optimizations compiled into the kernel for the two most common x86-64
platforms, namely the ones from Intel and the ones from AMD. As the matter of fact, the kernel also has support for running paravirtualized on the Xen hypervisor.
At boot time, the kernel will autodetect what processor it’s running on ─ or whether it’s running as a Xen dom0
, or as a Xen domU
─ and will select the proper optimizations. Still, these optimizations are only a small subset of the processor-specific CPU flags. On the other hand, there are also several CPU flags that are common between Intel and AMD, and of course, the compiler will make use of those, not just for the kernel but also for userland software.
All things considered, with the processing power of today’s CPUs, optimizing all of the software in the system for the specific CPU in your system will indeed yield a performance benefit, but it won’t be a very large one anymore. And Arch-based distributions such as Manjaro already optimize things to a far greater degree than other distributions do ─ which is one of the reasons why Arch and its various derivatives always perform just a little bit better and run a little leaner in terms of memory consumption.
Thus far the explanation. But as @Yochanan said, if you really do want to have all of your software optimized for your hardware, then you’re going to have to build it all from source code on your local machine, either with a distribution such as Gentoo, Funtoo or Exherbo, or something even more esoteric like SourceMage, or by following the “Linux From Scratch” book and building everything by hand ─ some of which must be built as statically linked first and then rebuilt as dynamically linked afterwards.
And then you do have full control over the CPU flags and other compile-time optimizations. But then you won’t actually be using your computer all that much, because it’ll be too busy burning up CPU cycles for compiling. If you’ve ever built a Firefox version from the source code in the AUR, then you’ll know what I mean. And then we’re not even talking about glibc
yet.