Which option should be enabled in gcc to generate 16-bit or 32-bit or 64-bit object code ? Are there separate options for generating each of the above object code type ?
+1
A:
To force gcc to generate 32-bit code you would give it the -m32 flag. To force it to generate 64-bit code you would give it the -m64 flag. I don't know of any option for 16-bit.
rettops
2010-06-26 19:14:10
+4
A:
The bitness of the generated object code is determined by the target architecture selected when gcc was built. If you want to build for a different platform, you should build a cross compiler for your desired target platform.
Note, however, that GCC does not support 16-bit x86, and that if both 32-bit and 64-bit x86 compilers are installed, as an exception, you can use -m32
or -m64
to select the desired target format.
bdonlan
2010-06-26 19:14:57
Is it mandatory to have the 32-bit or 64-bit x86 compilers to be installed to get the respective 32-bit or 64-bit object code ?
S.Man
2010-06-26 19:16:38
Yes. `-m32` or `-m64` just tells GCC to invoke the appropriate cross-compiler. Most Linux distributions will have a way to install both.
bdonlan
2010-06-26 19:17:34
@bdonian you only need the x86_64 compiler to use `-m32`
Spudd86
2010-06-27 04:10:30