how to get -march=native's value?

L A Walsh gcc@tlinx.org
Mon Sep 27 18:14:54 GMT 2021


On 2021/09/27 10:13, Segher Boessenkool wrote:
> On Mon, Sep 27, 2021 at 02:55:28PM +0200, Vincent Lefevre wrote:
>   
>> On 2021-09-17 12:53:25 -0500, Segher Boessenkool wrote:
>>     
>>> For x86 -march=something is the same as -march=native, _if_ the compiler
>>> knows about your CPU.
>>>       
----
I have a question, as someone reading this conversation ....

If one is using cross-compilation -- as it sounded like the original
author might be doing, what could the compiler know about the target
machine?

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?

Otherwise, it would seem that -march=native would only be useful for
the (probably majority of) cases where one is compiling for their own
machine (?).






More information about the Gcc-help mailing list