Contents|Index|Previous|Next

Compiler options for Hitachi SH

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 GNU CC Command Options in Using GNU CC in GNUPro Compiler Tools.

gcc options for architecture and code generation for Hitachi SH

-g
The compiler debugging option -g is essential to see interspersed high-level source statements, since without debugging information the assembler cannot tie most of the generated code to lines of the original source file.

-mshl
Generate little-endian Hitachi SH coff output.

-m1
Generate code for the Hitachi SH-1 chip. This is the default behavior for the Hitachi SH configuration.

-m2
Generate code for the Hitachi SH-2 chip.

-m3
Generate code for the Hitachi SH-3 chip.

-m3e
Generate code for the Hitachi SH-3E chip.

-mhitachi
Use Hitachi’s calling convention rather than that for gcc. The registers MACH and MACL are saved with this setting (see Calling conventions for Hitachi SH).

-mspace
Generate small code rather than fast code. By default, gcc generates fast code rather than small code.

-mb
Generate big endian code. This is the default.

-ml
Generate little endian code.

-mrelax
Do linker relaxation. For the Hitachi SH, this means the jsr instruction can be converted to the bsr instruction. -mrelax replaces the obsolete option -mbsr.

-mbigtable
Generate jump tables for switch statements using four-byte offsets rather than the standard two-byte offset. This option is necessary when the code within a switch statement is larger than 32k. If the option is needed and not supplied, the assembler will generate errors.

Floating point subroutines for Hitachi SH

Two kinds of floating point subroutines are useful with GCC.