Useful Compiler Options
From MorphOS Library
Grzegorz Kraszewski
GCC compiler has hundreds of options. Some of them are irrelevant for typical usage, some of them are irrelevant to PowerPC architecture. This article presents a set of common option set used when compiling MorphOS programs. For detailed descriptions of all options see GCC manual.
Contents
Compiling and linking
Options order
Warning options
These options control warnings issued by compiler on some potentially dangerous language constructs. While some programmers complain on compiler being too picky, it is recommended to turn most of these options on. It can save hours of time wasted on debugging...
−Wall
−Wextra
Linker options
−noixemul, instructs linker to use static libnix library for standard C/C++ functions and startup code. Without this parameter, shared library ixemul.library is used. Read more.
−s, instructs linker to strip debug information and symbol tables. These informations are not needed in a release executable. Stripping them lowers the executable size significantly.
Optimization options
−On, where n ranges from 0 to 3. The parameter is a global control of execution speed optimizer. Higher numbers make the optimizer more aggressive. −O2 seems to be the best for everyday use. −O3 turns on many optimizations which can significantly increase the executable size. Good programmer optimizes his algorithms in the first place, compiler optimizations can't fix design errors...
−Os, turns on executable size optimization, at a cost of execution speed. Not very useful for typical applications.