It seems this is dependent on the linux distribution. I assumed gcc
uses the same march on all modern linux distributions, but that
doesn't seem to be the case.
OL 8/9/10, Gentoo, Arch seem to keep the x86-64 march even when you
specify -m32:
bash-5.2# gcc -m32 -Q --help=target | grep march
-march= x86-64
Known valid arguments for -march= option:
bash-5.2# gcc -Q --help=target | grep march
-march= x86-64-v3
Known valid arguments for -march= option:
But Ubuntu/Debian changes march to i386 when you do that:
❯ gcc -m32 -Q --help=target | grep march
-march= i686
Known valid arguments for -march= option:
❯ gcc -Q --help=target | grep march
-march= x86-64
Known valid arguments for -march= option:
Gcc version doesn't seem to change this even if I install multiple gcc
versions on the same setup.