is there any way to know whether GCC is compiling 32 or 64bit code by default?
my GCC version is 4.1.2. my os kernel version is x86_64.
thanks.
To check this, we have to type this command. gcc –v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu ........... ........... ...........
In SLES 11, the gcc and g++ compilers default to 64-bit mode compilation, while the XL C/C++ compilers defaults to 32-bit mode.
The -m32 flag tells GCC to compile in 32-bit mode.
If gcc -v shows GCC was configured with a --with-arch option (or --with-arch-32 and/or --with-arch-64 ) then that's what will be the default. Without a --with-arch option (and if there isn't a custom specs file in use) then the arch used will be the default for the target.
Type gcc -v
. Amongst other things, it will tell you the target platform. For instance, I get:
Target: x86_64-redhat-linux
As @Oli said, the configuration should tell you, but it's possible to screw with that after the fact.
For belt and braces, simply compile something, and then use file
to examine the output file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With