• Memory Model, Data Address Model, and Sun Studio
The next version of Sun Studio, which is now available in pre-release as Sun Studio Express , introduces a new and better way to tell the compilers to compile for 64 or 32 bit memory models.
We've introduced two new, simpler, command line options across all three compilers, cc, CC, and f95.
Use -m64 to compile a 64-bit binary, or -m32 for a 32-bit binary. You no longer need to specify a -xarch value because with this release we have separated the memory model from the instruction set in the -xarch definitions. Now -xarch only relates to the intended instruction set. Use -m to specify the memory model, 64 or 32 bit.
Also, the defaults (assumed memory model and instruction set when no -m or -xarch is specified) have changed:
On Solaris SPARC systems the default is -xarch=v9 -m32
On Solaris x86/x64 systems, the default is -xarch=sse2 -m32
On Linux x86/x64 systems, the default is -xarch=sse2 -m64
So, to compile for 64-bits on a 64-bit enabled UltraSPARC system running Solaris, just add -m64 to the command line. No -xarch is needed.
On x64 systems, it is can be helpful to also add -xmodel=medium, to specify the appropriate data address model.
We're starting to use the terminology "memory model" to describe the "64-bit vs 32-bitness" of the binary code, and "data address model" to describe the addressing ABI used by the binary. As far as I'm aware, we may be first to make this kind of differentiation.
More information can be found on the Express readme for the compilers.
Only problem is that in this Express readme we aren't yet consistent about memory model vs data address model. In order for this terminology to stick, you have to be consistent. Something to look forward to in the documentation when it's finally released.
( Mar 29 2007, 08:47:37 PM PDT )
[Sun Studio]
Permalink