3.17.4 SPARC Options

Specify -mapp-regs to generate output using the global registers
2 through 4, which the SPARC SVR4 ABI reserves for applications. This
is the default, except on Solaris.

To be fully SVR4 ABI compliant at the cost of some performance loss,
specify -mno-app-regs. You should compile libraries and system
software with this option.

-mfpu

-mhard-float

Generate output containing floating point instructions. This is the
default.

-mno-fpu

-msoft-float

Generate output containing library calls for floating point.
Warning: the requisite libraries are not available for all SPARC
targets. Normally the facilities of the machine's usual C compiler are
used, but this cannot be done directly in cross-compilation. You must make
your own arrangements to provide suitable library functions for
cross-compilation. The embedded targets `sparc-*-aout' and
`sparclite-*-*' do provide software floating point support.

-msoft-float changes the calling convention in the output file;
therefore, it is only useful if you compile all of a program with
this option. In particular, you need to compile libgcc.a, the
library that comes with GCC, with -msoft-float in order for
this to work.

Generate output containing library calls for quad-word (long double)
floating point instructions. The functions called are those specified
in the SPARC ABI. This is the default.

As of this writing, there are no SPARC implementations that have hardware
support for the quad-word floating point instructions. They all invoke
a trap handler for one of these instructions, and then the trap handler
emulates the effect of the instruction. Because of the trap handler overhead,
this is much slower than calling the ABI library routines. Thus the
-msoft-quad-float option is the default.

-mno-flat

-mflat

With -mflat, the compiler does not generate save/restore instructions
and will use a “flat” or single register window calling convention.
This model uses %i7 as the frame pointer and is compatible with the normal
register window model. Code from either may be intermixed.
The local registers and the input registers (0–5) are still treated as
“call saved” registers and will be saved on the stack as necessary.

With -mno-flat (the default), the compiler emits save/restore
instructions (except for leaf functions) and is the normal mode of operation.

These options are deprecated and will be deleted in a future GCC release.

-mno-unaligned-doubles

-munaligned-doubles

Assume that doubles have 8 byte alignment. This is the default.

With -munaligned-doubles, GCC assumes that doubles have 8 byte
alignment only if they are contained in another type, or if they have an
absolute address. Otherwise, it assumes they have 4 byte alignment.
Specifying this option avoids some rare compatibility problems with code
generated by other compilers. It is not the default because it results
in a performance loss, especially for floating point code.

-mno-faster-structs

-mfaster-structs

With -mfaster-structs, the compiler assumes that structures
should have 8 byte alignment. This enables the use of pairs of
ldd and std instructions for copies in structure
assignment, in place of twice as many ld and st pairs.
However, the use of this changed alignment directly violates the SPARC
ABI. Thus, it's intended only for use on targets where the developer
acknowledges that their resulting code will not be directly in line with
the rules of the ABI.

-mimpure-text

-mimpure-text, used in addition to -shared, tells
the compiler to not pass -z text to the linker when linking a
shared object. Using this option, you can link position-dependent
code into a shared object.

-mimpure-text suppresses the “relocations remain against
allocatable but non-writable sections” linker error message.
However, the necessary relocations will trigger copy-on-write, and the
shared object is not actually shared across processes. Instead of
using -mimpure-text, you should compile all source code with
-fpic or -fPIC.

This option is only available on SunOS and Solaris.

-mv8

-msparclite

These two options select variations on the SPARC architecture.
These options are deprecated and will be deleted in a future GCC release.
They have been replaced with -mcpu=xxx.

-mcypress

-msupersparc

-mf930

-mf934

These four options select the processor for which the code is optimized.
These options are deprecated and will be deleted in a future GCC release.
They have been replaced with -mcpu=xxx.

By default (unless configured otherwise), GCC generates code for the V7
variant of the SPARC architecture. With -mcpu=cypress, the compiler
additionally optimizes it for the Cypress CY7C602 chip, as used in the
SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
SPARCStation 1, 2, IPX etc.

With -mcpu=v8, GCC generates code for the V8 variant of the SPARC
architecture. The only difference from V7 code is that the compiler emits
the integer multiply and integer divide instructions which exist in SPARC-V8
but not in SPARC-V7. With -mcpu=supersparc, the compiler additionally
optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
2000 series.

With -mcpu=sparclite, GCC generates code for the SPARClite variant of
the SPARC architecture. This adds the integer multiply, integer divide step
and scan (ffs) instructions which exist in SPARClite but not in SPARC-V7.
With -mcpu=f930, the compiler additionally optimizes it for the
Fujitsu MB86930 chip, which is the original SPARClite, with no FPU. With
-mcpu=f934, the compiler additionally optimizes it for the Fujitsu
MB86934 chip, which is the more recent SPARClite with FPU.

With -mcpu=sparclet, GCC generates code for the SPARClet variant of
the SPARC architecture. This adds the integer multiply, multiply/accumulate,
integer divide step and scan (ffs) instructions which exist in SPARClet
but not in SPARC-V7. With -mcpu=tsc701, the compiler additionally
optimizes it for the TEMIC SPARClet chip.

With -mcpu=v9, GCC generates code for the V9 variant of the SPARC
architecture. This adds 64-bit integer and floating-point move instructions,
3 additional floating-point condition code registers and conditional move
instructions. With -mcpu=ultrasparc, the compiler additionally
optimizes it for the Sun UltraSPARC I/II chips. With
-mcpu=ultrasparc3, the compiler additionally optimizes it for the
Sun UltraSPARC III chip.

-mtune=cpu_type

Set the instruction scheduling parameters for machine type
cpu_type, but do not set the instruction set or register set that the
option -mcpu=cpu_type would.

The same values for -mcpu=cpu_type can be used for
-mtune=cpu_type, but the only useful values are those
that select a particular cpu implementation. Those are `cypress',
`supersparc', `hypersparc', `f930', `f934',
`sparclite86x', `tsc701', `ultrasparc', and
`ultrasparc3'.

-mv8plus

-mno-v8plus

With -mv8plus, GCC generates code for the SPARC-V8+ ABI. The
difference from the V8 ABI is that the global and out registers are
considered 64-bit wide. This is enabled by default on Solaris in 32-bit
mode for all SPARC-V9 processors.

-mvis

-mno-vis

With -mvis, GCC generates code that takes advantage of the UltraSPARC
Visual Instruction Set extensions. The default is -mno-vis.

These `-m' options are supported in addition to the above
on SPARC-V9 processors in 64-bit environments:

-mlittle-endian

Generate code for a processor running in little-endian mode. It is only
available for a few configurations and most notably not on Solaris and Linux.

-m32

-m64

Generate code for a 32-bit or 64-bit environment.
The 32-bit environment sets int, long and pointer to 32 bits.
The 64-bit environment sets int to 32 bits and long and pointer
to 64 bits.

-mcmodel=medlow

Generate code for the Medium/Low code model: 64-bit addresses, programs
must be linked in the low 32 bits of memory. Programs can be statically
or dynamically linked.

-mcmodel=medmid

Generate code for the Medium/Middle code model: 64-bit addresses, programs
must be linked in the low 44 bits of memory, the text and data segments must
be less than 2GB in size and the data segment must be located within 2GB of
the text segment.

-mcmodel=medany

Generate code for the Medium/Anywhere code model: 64-bit addresses, programs
may be linked anywhere in memory, the text and data segments must be less
than 2GB in size and the data segment must be located within 2GB of the
text segment.

-mcmodel=embmedany

Generate code for the Medium/Anywhere code model for embedded systems:
64-bit addresses, the text and data segments must be less than 2GB in
size, both starting anywhere in memory (determined at link time). The
global register %g4 points to the base of the data segment. Programs
are statically linked and PIC is not supported.

-mstack-bias

-mno-stack-bias

With -mstack-bias, GCC assumes that the stack pointer, and
frame pointer if present, are offset by −2047 which must be added back
when making stack frame references. This is the default in 64-bit mode.
Otherwise, assume no such offset is present.

These switches are supported in addition to the above on Solaris:

-threads

Add support for multithreading using the Solaris threads library. This
option sets flags for both the preprocessor and linker. This option does
not affect the thread safety of object code produced by the compiler or
that of libraries supplied with it.

-pthreads

Add support for multithreading using the POSIX threads library. This
option sets flags for both the preprocessor and linker. This option does
not affect the thread safety of object code produced by the compiler or
that of libraries supplied with it.