8.5 Multi-architecture support
A number of platforms can execute code for more than one architecture.
For example, 64-bit platforms such as AMD64, MIPS64, Sparc64, and
PowerPC64 support the execution of both 32-bit and 64-bit code.
Similarly, ARM processors support both ARM code and a more compact code
called "Thumb". GCC can be built to support multiple architectures on
these platforms. By default, the compiler will generate 64-bit object
files, but giving the -m32
option will generate a 32-bit object
file for the corresponding architecture.(25)
Note that support for multiple architectures depends on the
corresponding libraries being available. On 64-bit platforms supporting
both 64 and 32-bit executables, the 64-bit libraries are often placed in
'lib64' directories instead of 'lib' directories, e.g. in
'/usr/lib64' and '/lib64'. The 32-bit libraries are then
found in the default 'lib' directories as on other platforms. This
allows both a 32-bit and a 64-bit library with the same name to exist on
the same system. Other systems, such as the IA64/Itanium, use the
directories '/usr/lib' and '/lib' for 64-bit libraries. GCC
knows about these paths and uses the appropriate path when compiling
64-bit or 32-bit code.