Does GCC support multiple target architectures?

Viewed 3289

Is it possible to compile a single gcc (frontend) binary which supports multiple target architectures, which I can select in the command-line, like this:

$ gcc --architecture=linux-i386 ...
$ gcc --architecture=freebsd-arm ...
$ gcc --architecture=darwin-amd64 ...

I know that it's possible build gcc as a cross-compiler, but is it possible to select the target architecture using a command-line flag, without writing a wrapper script which starts different gcc binaries for each architecture?

For i386 and amd64 -m32 and -m64 seem to do the trick, but how do I select ARM etc.? Please note that -march= looked useless to me, I couldn't make it change from i386 to amd64.

2 Answers
Related