News: 0001548569

  ARM Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life (Terry Pratchett, Jingo)

GCC 16 Lands Better Support For -march= Targeting On RISC-V

([GNU] 6 Hours Ago GCC -march=)


Merged on Friday for the GCC 16 compiler is better handling of the " -march= " compiler option on RISC-V systems when seeing multiple -march= hits and wanting to specify the RISC-V CPU name for targeting.

Robin Dapp of RISC-V CPU firm Ventana Micro Systems landed the improved -march= handling for the GCC compiler on the RISC-V architecture.

Robin explained in [1]the commit :

"This patch allows an -march string like

-march=sifive-p670

in order override a previous -march in a simple way.

Suppose we have a Makefile that specifies -march=rv64gc by default. A user-specified -mcpu=sifive-p670 would be after the -march in the options string and thus only set -mtune=sifive-p670 (as -mcpu does not override a previously specified -march or -mtune).

So if we wanted to override we would need to specify the full, lengthy -march=rv64gcv_... string instead of a simple -mcpu=...

Therefore this patch always first tries to interpret -march= as CPU string. If it is a supported CPU we use its march properties and let it override previously specified options. Otherwise the behavior is as before. This enables the "last-specified option wins" behavior GCC normally employs.

Note that -march does not imply -mtune like on x86 or other targets. So an -march=CPU won't override a previously specified -mtune=other-CPU."

This patch is merged to GCC Git for next year's GCC Git and will potentially be back-ported to the GCC 15 stable branch for a future point release in the coming months.



[1] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=4a182418c89666e7594bcb0e5edc5194aa147910



phoronix

Hanlon's Razor:
Never attribute to malice that which is adequately explained
by stupidity.