Solaris SPARC to Solaris x86 Porting Guide
instantaneous. It can take several seconds to run. fpversion also reports the best -xtarget code
generation option to use for the host system.
32-bit and 64-bit Issues
Enterprise-wide business critical applications that benefit from 64-bit technology include data
warehousing, high-resolution graphics, computer-aided design, simulation and scientific data
analysis, and multimedia web servers. These applications require more precision, a very large
amount of simultaneous data processing capability, and a larger memory space than the 32-bit
equivalent can address.
A 64-bit system differs from a 32-bit system in the following ways:
• Extended precision
• Large dataset support
• Large virtual address space
The Solaris OS, SPARC Platform Edition, has support for both 32-bit and 64-bit technology, while the
x86 Platform Edition only supports the 32-bit family of x86 processors. Both Sun cc and gcc default to
32-bit mode on 64-bit machines, unless compiled with -xarch=v9 (64-bit SPARC), v9a (UltraSPARC
extensions), or v9b (UltraSPARC III extensions). You can develop and run 32-bit applications in a 64-
bit environment on the SPARC platform if you avoid using the architecture-dependent flag -xarch=v9.
You can port the same application to the x86 platform after recompiling it on x86 platform without
making any code changes.
Solution: You can generate two binaries (one 32-bit and one 64-bit) from a single source file on the
SPARC platform. The Solaris compilers have compile-time flags that can create a resulting object file
that is 32-bit or 64-bit. 64-bit specific code in the header files and source files are defined using
#ifdef as appropriate to support the single source file for both 32-bit and 64-bit operating system.
C and C++ compiler difference between SPARC vs x86 Solaris
ISVs and developers can choose between multiple compilers to use on Solaris OS, x86 Platform
Edition. If your application is developed primarily on the SPARC Platform Edition using Sun Studio
developer tools, porting to Solaris x86 is easier.
If the application has been optimized for the SPARC Platform Edition using back-end compiler flags,
some flags may be incompatible for the x86 platform. These flags must be deleted or replaced with
the flags that are valid on the x86 platform and used for optimization for the x86 platform.
Sun Studio developer tools
Sun Studio software consists of C, C++, Fortran compilers; the Performance Analyzer; and the
debugger. The complete compilation architecture consists of a compiler, an assembler, and a link
editor. The compiler is made up of a front-end component and a back-end component. The front-end
consists of syntax and semantic analyzer modules based on the source language, while the back-end
consists of code optimization and code generation modules based on the instruction set for a
particular hardware.
Sun Studio developer tools are available for the Solaris OS, SPARC and x86 Platform Editions. Since
the compilers share a common front-end, most source code is easily ported between platforms.
Applications with platform-specific definitions (for example, #ifdef __sparc), may require user
intervention before porting between platforms.
Compiler flags
Sun Studio 12 Compiler Collection consists of C, C++, and Fortran compilers. The compiler consists
of a front-end component and a back-end component. The front-end consists of syntax and semantic
analyzer modules based on the source language, while the back-end consists of code optimization
9