Solaris 64-bit Developer's Guide

Compiler Environments

The Sun Studio C, C++, and Fortran compilation environments have been enhanced to support the creation of both 32-bit and 64-bit applications. The 10.0 release of the C compiler from Sun Studio provides 64–bit compilation support.

Native and cross-compilation modes are supported. The default compilation environment continues to produce 32-bit applications. While both modes are supported, they are still architecture-specific. It is not possible to create SPARC objects on x86 machines, nor x86 objects on SPARC machines with the Sun compilers. In the absence of a specification of the architecture or mode of compilation, the appropriate __sparcv8 or __i386 symbol is defined by default, and as part of this, _ILP32 is also defined. This maximizes interoperability with the existing applications and hardware base.

Starting with the Sun Studio 8 release, use the cc(1) -xarch=generic64 flag to enable the 64-bit compilation environment.

This generates LP64 code in ELF64 objects. ELF64 is a 64-bit object file format supporting 64-bit processors and architectures. This is in contrast to the ELF32 object files generated when compiling in the default 32-bit mode.

The -xarch=generic64 flag is used to generate 64-bit code on either 32-bit or 64-bit system. Using the 32-bit compiler you can build 64-bit objects on a 32-bit system; however, you cannot run the 64-bit objects on a 32–bit system. You need not specify the library path for the 64-bit libraries. If the -l or -L option is used to specify an additional library or library path and that path points only to 32-bit libraries, the linker detects this and fails with an error.

For a description of compiler options, see the Sun Studio 10: C User's Guide.