Got something we don't? Need a correction? Send it!

GNU Compiler switches

SH-ELF-GCC

mandatory
-ml
compile for little endian target.
-m4
generate code for sh4.

recommended
-lg -lm -lc -lgcc
link against standard libraries.
-o [file]
specify name of output file.
-Wall
show all warnings. it's always a good thing to write code that compiles without all these warnings. :=P
-m4-single-only
*always* use this one instead of -m4 if you don't really need double precision floating point variables. (you most probably don't)
-O3
use highest optimization level. valid values are -O0 (none) -O3 (max).
--fast-math
use the sh4-builtin math functions.

optional
-I [path]
tell gcc about the path(s) to search for include files.
-nostartfiles
don't link standard startup files.
-nostdlib
don't link standard library.
-e [label]
define entry point (if other than main()).
-c
compile only, but don't link.
-Wl,[option],[option],...
pass one or more options to the linker (LD). Incase there are spaces seperating arguments from switches, always use commas to fill them. (eg. -Wl,-Ttext,0x8c010000)


SH-ELF-AS


mandatory
-little
generate code for little endian target.


SH-ELF-LD


mandatory
-mshlelf
generate little endian elf output.

recommended
-Tt [address]
set start of TEXT section. For Dreamcast this would usually be 0x8c010000
-lg -lm -lc -lgcc
link against standard libraries.

optional
--library-path=[path]
set path to search for libraries.
-L [path]
set path to search for linker scripts.
--script [filename]
set script file to use for linking.


note: for the ARM tools i just listed the differences to the above, all the generic (target independent) switches remain the same ofcoz.

ARM-ELF-GCC


mandatory
-mcpu=arm7

recommended
-O4

ARM-ELF-AS


mandatory
-marm7


ARM-ELF-LD


mandatory
-marmelf

recommended
-Tt [ADDR]
set start of TEXT section. For the AICA this would usually be 0x00000000

This banner below is OUR banner, the one that helps us pay bills. The one above is our host.

All names, logos, symbols, representations, and anything is copyright Sega and we aren't associated with nor are they associated with us.