These are the options defined for the Altera Nios II processor.
Put global and static objects less than or equal to num bytes into the small data or BSS sections instead of the normal data or BSS sections. The default value of num is 8.
Generate (do not generate) GP-relative accesses. The following option names are recognized:
Do not generate GP-relative accesses.
Generate GP-relative accesses for small data objects that are not
external, weak, or uninitialized common symbols.
Also use GP-relative addressing for objects that
have been explicitly placed in a small data section via a
As for ‘local’, but also generate GP-relative accesses for small data objects that are external, weak, or common. If you use this option, you must ensure that all parts of your program (including libraries) are compiled with the same -G setting.
Generate GP-relative accesses for all data objects in the program. If you use this option, the entire data and BSS segments of your program must fit in 64K of memory and you must use an appropriate linker script to allocate them within the addressable range of the global pointer.
Generate GP-relative addresses for function pointers as well as data pointers. If you use this option, the entire text, data, and BSS segments of your program must fit in 64K of memory and you must use an appropriate linker script to allocate them within the addressable range of the global pointer.
-mgpopt is equivalent to -mgpopt=local, and -mno-gpopt is equivalent to -mgpopt=none.
The default is -mgpopt except when -fpic or -fPIC is specified to generate position-independent code. Note that the Nios II ABI does not permit GP-relative accesses from shared libraries.
You may need to specify -mno-gpopt explicitly when building programs that include large amounts of small data, including large GOT data sections. In this case, the 16-bit offset for GP-relative addressing may not be large enough to allow access to the entire small data section.
Generate little-endian (default) or big-endian (experimental) code, respectively.
This specifies the name of the target Nios II architecture. GCC uses this name to determine what kind of instructions it can emit when generating assembly code. Permissible names are: ‘r1’, ‘r2’.
The preprocessor macro
__nios2_arch__ is available to programs,
with value 1 or 2, indicating the targeted ISA level.
Force all load and store instructions to always bypass cache by using I/O variants of the instructions. The default is not to bypass the cache.
Volatile memory access bypass the cache using the I/O variants of the load and store instructions. The default is not to bypass the cache.
Do not use table-based fast divide for small numbers. The default is to use the fast divide at -O3 and above.
Enable or disable emitting
div family of
instructions by the compiler. The default is to emit
and not emit
Enable or disable generation of Nios II R2 BMX (bit manipulation) and CDX (code density) instructions. Enabling these instructions also requires -march=r2. Since these instructions are optional extensions to the R2 architecture, the default is not to emit them.
Each -mcustom-insn=N option enables use of a custom instruction with encoding N when generating code that uses insn. For example, -mcustom-fadds=253 generates custom instruction 253 for single-precision floating-point add operations instead of the default behavior of using a library call.
The following values of insn are supported. Except as otherwise noted, floating-point operations are expected to be implemented with normal IEEE 754 semantics and correspond directly to the C operators or the equivalent GCC built-in functions (see Other Builtins).
Single-precision floating point:
Binary arithmetic operations.
Unary absolute value.
Floating-point minimum and maximum. These instructions are only generated if -ffinite-math-only is specified.
Unary square root operation.
Floating-point trigonometric and exponential functions. These instructions are only generated if -funsafe-math-optimizations is also specified.
Double-precision floating point:
Binary arithmetic operations.
Unary absolute value.
Double-precision minimum and maximum. These instructions are only generated if -ffinite-math-only is specified.
Unary square root operation.
Double-precision trigonometric and exponential functions. These instructions are only generated if -funsafe-math-optimizations is also specified.
Conversion from single precision to double precision.
Conversion from double precision to single precision.
Conversion from floating point to signed or unsigned integer types, with truncation towards zero.
Conversion from single-precision floating point to signed integer,
rounding to the nearest integer and ties away from zero.
This corresponds to the
__builtin_lroundf function when
-fno-math-errno is used.
Conversion from signed or unsigned integer types to floating-point types.
In addition, all of the following transfer instructions for internal registers X and Y must be provided to use any of the double-precision floating-point instructions. Custom instructions taking two double-precision source operands expect the first operand in the 64-bit register X. The other operand (or only operand of a unary operation) is given to the custom arithmetic instruction with the least significant half in source register src1 and the most significant half in src2. A custom instruction that returns a double-precision result returns the most significant 32 bits in the destination register and the other half in 32-bit register Y. GCC automatically generates the necessary code sequences to write register X and/or read register Y when double-precision floating-point instructions are used.
Write src1 into the least significant half of X and src2 into the most significant half of X.
Write src1 into Y.
Read the most or least (respectively) significant half of X and store it in dest.
Read the value of Y and store it into dest.
Note that you can gain more local control over generation of Nios II custom
instructions by using the
target("no-custom-insn") function attributes
(see Function Attributes)
or pragmas (see Function Specific Option Pragmas).
This option enables a predefined, named set of custom instruction encodings (see -mcustom-insn above). Currently, the following sets are defined:
-mcustom-fpu-cfg=60-1 is equivalent to:
-mcustom-fmuls=252 -mcustom-fadds=253 -mcustom-fsubs=254 -fsingle-precision-constant
-mcustom-fpu-cfg=60-2 is equivalent to:
-mcustom-fmuls=252 -mcustom-fadds=253 -mcustom-fsubs=254 -mcustom-fdivs=255 -fsingle-precision-constant
-mcustom-fpu-cfg=72-3 is equivalent to:
-mcustom-floatus=243 -mcustom-fixsi=244 -mcustom-floatis=245 -mcustom-fcmpgts=246 -mcustom-fcmples=249 -mcustom-fcmpeqs=250 -mcustom-fcmpnes=251 -mcustom-fmuls=252 -mcustom-fadds=253 -mcustom-fsubs=254 -mcustom-fdivs=255 -fsingle-precision-constant
Custom instruction assignments given by individual -mcustom-insn= options override those given by -mcustom-fpu-cfg=, regardless of the order of the options on the command line.
Note that you can gain more local control over selection of a FPU
configuration by using the
function attribute (see Function Attributes)
or pragma (see Function Specific Option Pragmas).
These additional ‘-m’ options are available for the Altera Nios II ELF (bare-metal) target:
Link with HAL BSP. This suppresses linking with the GCC-provided C runtime startup and termination code, and is typically used in conjunction with -msys-crt0= to specify the location of the alternate startup code provided by the HAL BSP.
Link with a limited version of the C library, -lsmallc, rather than Newlib.
startfile is the file name of the startfile (crt0) to use when linking. This option is only useful in conjunction with -mhal.
systemlib is the library name of the library that provides
low-level system calls required by the C library,
This option is typically used to link with a library provided by a HAL BSP.