Go to the first, previous, next, last section, table of contents.

Compiler options

When you run GCC, you can use command-line options to choose machine-specific details. For information on all the GCC command-line options, see section `GNU CC Command Options' in Using GNU CC.

GCC options for architecture and code generation

-mcpu=r3000
-mcpu=cputype
Since most IDT boards are based on the MIPS R3000, the default for this particular configuration is `-mcpu=r3000'. In the general case, use this option on any MIPS platform to assume the defaults for the machine type cputype when scheduling instructions. The default cputype on other MIPS configurations is `default', which picks the longest cycle times for any of the machines, in order that the code run at reasonable rates on any MIPS CPU. Other choices for cputype are `r2000', `r3000', `r4000', and `r6000'. While picking a specific cputype will schedule things appropriately for that particular chip, the compiler will not generate any code that does not meet level 1 of the MIPS ISA (Instruction Set Architecture) unless you use the `-mips2' or `-mips3' switch.
-mgpopt
-mno-gpopt
With `-mgpopt', write all of the data declarations before the instructions in the text section. This allows the MIPS assembler to generate one word memory references instead of using two words for short global or static data items. This is on by default when you compile with optimization.
-mstats
-mno-stats
With `-mstats', for each non-inline function processed, emit one line to the standard error file to print statistics about the program (number of registers saved, stack size, etc.).
-mmemcpy
-mno-memcpy
With `-mmemcpy', make all block moves call memcpy (a C library string function) instead of possibly generating inline code.
-mlong-calls
-mno-long-calls
Do all calls with the JALR instruction, which requires loading up a function's address into a register before the call. You need this switch if you call functions outside of the current 512 megabyte segment (unless you use function pointers for the call).
-mhalf-pic
-mno-half-pic
Put pointers to extern references into the data section and load them up, rather than putting the references in the text section.
-G num
Put global and static items less than or equal to num bytes into the small data or bss sections instead of the normal data or bss section. This allows the assembler to emit one word memory reference instructions based on the global pointer (gp or $28), instead of the normal two words used. By default, num is 8. When you specify another value, gcc also passes the `-G num' switch to the assembler and linker.

GCC options for floating point

These options select software or hardware floating point.

-msoft-float
Generate output containing library calls for floating point. The `mips-idt-ecoff' configuration of `libgcc' (an auxiliary library distributed with the compiler) include a collection of subroutines to implement these library calls. In particular, this GCC configuration generates subroutine calls compatible with the US Software "GOFAST R3000" floating point library, giving you the opportunity to use either the `libgcc' implementation or the US Software version. IDT includes the GOFAST library in their IDT C 5.0 package; you can also order libraries separately from IDT as the "IDT KIT". of how to use GCC to link with the GOFAST library. To use the `libgcc' version, you need nothing special; GCC links with `libgcc' automatically after all other object files and libraries. Because the calling convention on MIPS architectures depends on whether or not hardware floating-point is installed, `-msoft-float' has one further effect: GCC looks for subroutine libraries in a subdirectory `soft-float', for any library directory in your search path. (Note: This does not apply to directories specified using the `-l' option.) With the Cygnus Developer's Kit, you can select the standard libraries as usual with `-lc' or `-lm', because the `soft-float' versions are installed in the default library search paths.
Warning: Treat `-msoft-float' as an "all or nothing" proposition. If you compile any module of a program with `-msoft-float', it's safest to compile all modules of the program that way--and it's essential to use this option when you link.
-mhard-float
Generate output containing floating point instructions, and use the corresponding MIPS calling convention. This is the default.

Floating point subroutines

Two kinds of floating point subroutines are useful with GCC:

  1. Software implementations of the basic functions (floating-point multiply, divide, add, subtract), for use when there is no hardware floating-point support. When you indicate that no hardware floating point is available (with the GCC option `-msoft-float', GCC generates calls compatible with the US Software GOFAST library. If you do not have this library, you can still use software floating point; `libgcc', the auxiliary library distributed with GCC, includes compatible--though slower--subroutines.
  2. General-purpose mathematical subroutines. The Developer's Kit from Cygnus Support includes an implementation of the standard C mathematical subroutine library. See section `Mathematical Functions' in The Cygnus C Math Library.

GCC options to avoid for IDT R3000 boards

These options are meant for other forms of the MIPS architecture:

-mabicalls
-mno-abicalls
Emit (or do not emit) the assembler directives `.abicalls', `.cpload', and `.cprestore' that some System V.4 ports use for position independent code.
-mips2
Issue instructions from level 2 of the MIPS ISA (branch likely, square root instructions).
-mmips-as
Generate code for the MIPS assembler. This is the default for many other MIPS platforms, but it requires an auxiliary program mips-tfile to encapsulate debugging information. mips-tfile is not included in your Cygnus Developer's Kit, since it is not required for the GNU assembler.
-mrnames
-mno-rnames
Generate code using the MIPS software names for the registers, instead of the hardware names (for example, a0 instead of $4). The converse `-mno-rnames' switch is the default.
Warning: The GNU assembler will not build code generated with the `-mrnames' switch.

These options are harmless--but unnecessary--on the R3000:

-mfp32
Assume that there are 32 32-bit floating point registers. This is the default.
-mgas
Generate code for the GNU assembler. This is the default when GCC is correctly configured for this platform, using the `-with-gnu-as' configuration parameter.
-mno-mips-tfile
The `-mno-mips-tfile' option prevents postprocessing the object file with the mips-tfile program, after the MIPS assembler has generated it to add debug support. The GNU assembler does not require mips-tfile in any case. mips-tfile is not included in your Cygnus Developer's Kit.
-nocpp
Tell the MIPS assembler to avoid running the C preprocessor over user assembler files (with a `.s' suffix) when assembling them. The GNU assembler never runs the C preprocessor in any case.

Avoid these options--although they appear in the configuration files, their implementation is not yet complete.

-mfp64
-mint64
-mips3
-mlong64
-mlonglong128


Go to the first, previous, next, last section, table of contents.