gcc -dumpmachine
is almost perfect, but it doesn't respect flags that affect the target. On the other hand, clang
does:
$ gcc -dumpmachine
x86_64-unknown-linux-gnu
$ gcc -dumpmachine -m32
x86_64-unknown-linux-gnu
$ clang -dumpmachine
x86_64-unknown-linux-gnu
$ clang -dumpmachine -m32
i386-unknown-linux-gnu
-m32
doesn't change the target, just like how-march=i486
doesn't change the target toi486-unknown-linux-gnu
. – Artilleryman-m32
result honours the-march
option too, e.g. printsi686-...
if appropriate) – Powe-m32
is not "cross-compiling", it's just using a different instruction set of the same architecture, it's referred to as a multilib target. – Poweclang
would do that but it doesn't; even though-march-armv7-a
will cause its target to change fromarmv5te-...
toarm7-...
,-dumpmachine
output stays the same. Lame! – Berhley