how to get -march=native's value?

Florian Weimer fweimer@redhat.com
Mon Sep 27 18:26:09 GMT 2021


* L. A. Walsh:

> Is there some sort of "profile-this-cpu-for-pertinent-options" binary
> or compiler-option that one should(or could) run on the target
> machine in order that the correct compiler switches be set?

In recent glibc, ld.so --help (the actual paths to ld.so vary
unfortunately) prints supported glibc-hwcaps subdirectories for some
common targets.  GCC supports a matching -march= or -mcpu= option (the
latter for POWER).  This does not cover all CPU features exactly, it is
a conservative approximation.  Cryptographic features and features with
a checkered past (features which already have been disabled once in a
microcode update) are left out.

Thanks,
Florian



More information about the Gcc-help mailing list