For example, my local GNU compiler for ARM does not support it:
$ gcc --version
gcc (Gentoo 5.3.0 p1.0, pie-0.6.5) 5.3.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ gcc -dumpmachine
armv7a-hardfloat-linux-gnueabi
$ gcc -m32
gcc: error: unrecognized command line option '-m32'
That's why I propose to use the "-dumpmachine" flag to get the target machine of the GNU compiler first. Then only use the flags if the returned string contains "86" (which matches, for example, both "x86_64" and "i586").
The following sets up either the "-m32" or "-m64" compiler flag depending on the pointer size:
Unfortunately, this appears to be x86 specific.
For example, my local GNU compiler for ARM does not support it:
That's why I propose to use the "-dumpmachine" flag to get the target machine of the GNU compiler first. Then only use the flags if the returned string contains "86" (which matches, for example, both "x86_64" and "i586").
Thanks!