9.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.31

Note that support for multiple architectures depends on the corresponding libraries being available. GCC knows about these paths and uses the appropriate path when compiling 64-bit or 32-bit code.

On systems simultaneously supporting multiple binary target architectures such as Debian wheezy and Ubuntu 11.04, the libraries with the corresponding architecture ABI will be stored in /usr/lib/multiarch_name and /lib/multiarch_name. The multiarch architecture specifier (tuple) multiarch_name takes values such as x86_64-linux-gnu for the 64-bit PC Linux versions, and i386-linux-gnu for the 32-bit PC Linux versions. Please note that the multiarch architecture specifier is not exactly the same as the GNU triplets although they are similar.

On most system simultaneously supporting only 32-bit and 64-bit binary target architectures such as RedHat, the 64-bit versions of the libraries will often be stored in /usr/lib64 and /lib64, with the 32-bit versions in /usr/lib and /lib. Other systems, such as the IA64/Itanium, use the directories /usr/lib and /lib for 64-bit libraries.


Footnotes

(31)

The options -maix64 and -maix32 are used on AIX.