GCC common switches

From RISC OS

Revision as of 21:49, 28 November 2007 by Caliston (Talk | contribs)
Jump to: navigation, search

The following is an edited list of the command line switches for RISC OS GCC 3.4.6 release 3. GCC has many options, and only those most of interest to RISC OS users are listed here. The full list may be obtained with *gcc --help -v

  --help                   Display this information
  -dumpspecs               Display all of the built in spec strings
  -dumpversion             Display the version of the compiler
  -dumpmachine             Display the compiler's target processor
  -Wa,<options>            Pass comma-separated <options> on to the assembler
  -Wp,<options>            Pass comma-separated <options> on to the preprocessor
  -Wl,<options>            Pass comma-separated <options> on to the linker
  -Xassembler <arg>        Pass <arg> on to the assembler
  -Xpreprocessor <arg>     Pass <arg> on to the preprocessor
  -Xlinker <arg>           Pass <arg> on to the linker
  -v                       Display the programs invoked by the compiler
  -###                     Like -v but options quoted and commands not executed
  -E                       Preprocess only; do not compile, assemble or link
  -S                       Compile only; do not assemble or link
  -c                       Compile and assemble, but do not link
  -o <file>                Place the output into <file>
  -x <language>            Specify the language of the following input files
                           Permissible languages include: c c++ assembler none
                           'none' means revert to the default behavior of
                           guessing the language based on the file's extension

Options starting with -g, -f, -m, -O, -W, or --param are automatically
 passed on to the various sub-processes invoked by gcc.  In order to pass
 other options on to these processes the -W<letter> options must be used.

GCC compiler options

  --help                      Display this information
  --version                   This switch lacks documentation
  -O<number>                  Set optimization level to <number>
  -Os                         Optimize for space rather than speed
  -Werror                     Treat all warnings as errors
  -Wextra                     Print extra (possibly unwanted) warnings
  -fPIC                       This switch lacks documentation
  -funroll-all-loops          Perform loop unrolling for all loops
  -funroll-loops              Perform loop unrolling when iteration count is
                              known
  -g                          Generate debug information in default format
  -o <file>                   Place output into <file>
  -p                          Enable function profiling
  -pedantic                   Issue warnings needed for strict compliance to
                              the standard
  -pedantic-errors            Like -pedantic but issue them as errors
  -quiet                      Do not display functions compiled or elapsed time
  -version                    Display the compiler's version
  -w                          Suppress warnings

The C front end recognizes the following options:

  -U<macro>                   Undefine <macro>
  -Wall                       This switch lacks documentation
  -Wdeclaration-after-statement Warn when a declaration is found after a
                              statement
  -Wdiv-by-zero               Warn about compile-time integer division by zero
  -Wformat                    Warn about printf/scanf/strftime/strfmon format
                              string anomalies
  -Wformat-extra-args         Warn if passing too many arguments to a function
                              for its format string
  -Wlong-long                 Do not warn about using "long long" when -pedantic
  -Wmissing-braces            Warn about possibly missing braces around
                              initializers
  -Wmissing-declarations      Warn about global functions without previous
                              declarations
  -Wmissing-format-attribute  Warn about functions which might be candidates
                              for format attributes
  -Wmissing-prototypes        Warn about global functions without prototypes
  -ansi                       A synonym for -std=c89 (for C) or -std=c++98 (for
                              C++).
  -icrossdirafter <dir>       Add <dir> to the end of the system include path
  -idirafter <dir>            Add <dir> to the end of the system include path
  -imacros <file>             Accept definition of macros in <file>
  -include <file>             Include the contents of <file> before other files
  -iprefix <path>             Specify <path> as a prefix for next two options
  -isysroot <dir>             Set <dir> to be the system root directory
  -isystem <dir>              Add <dir> to the start of the system include path
  -iwithprefix <dir>          Add <dir> to the end of the system include path
  -iwithprefixbefore <dir>    Add <dir> to the end of the main include path
  -nostdinc                   Do not search standard system include directories
                              (those specified with -isystem will still be used)
  -remap                      Remap file names when including files
  -std=c89                    Conform to the ISO 1990 C standard
  -std=c99                    Conform to the ISO 1999 C standard
  -std=c9x                    Deprecated in favor of -std=c99
  -std=gnu89                  Conform to the ISO 1990 C standard with GNU
                              extensions
  -std=gnu99                  Conform to the ISO 1999 C standard with GNU
                              extensions
  -std=gnu9x                  Deprecated in favor of -std=gnu99
  -std=iso9899:1990           Conform to the ISO 1990 C standard
  -std=iso9899:199409         Conform to the ISO 1990 C standard as amended in
                              1994
  -std=iso9899:1999           Conform to the ISO 1999 C standard
  -std=iso9899:199x           Deprecated in favor of -std=iso9899:1999
  -traditional-cpp            Enable traditional preprocessing
  -undef                      Do not predefine system-specific and GCC-specific
                              macros
  -v                          Enable verbose output

C++ options

  -fxref                      Emit cross referencing information
  -nostdinc++                 Do not search standard system include directories
                              for C++
  -std=c++98                  Conform to the ISO 1998 C++ standard
  -std=gnu++98                Conform to the ISO 1998 C++ standard with GNU
                              extensions

RISC OS/ARM specific options

  -mmodule                  Generate data references suitable for RISC OS modules
  -munixlib                 Compile with the headers from UnixLib (default)
  -mlibscl                  Compile with the SharedCLibrary headers
  -mamu                     Format source dependencies for Acorn's Make Utility
  -mthrowback               Send errors to a DDEUtils compatible text editor
  -mhard-float              Use hardware floating point instructions
  -msoft-float              Use library calls to perform FP operations
  -mapcs-reentrant          Generate re-entrant, PIC code
  -mapcs-float              Pass FP arguments in FP registers
  -mapcs-32                 Use the 32-bit version of the APCS
  -mpoke-function-name      Store function names in object code
  -mapcs-frame              Generate APCS conformant stack frames
  -mpic-register=           Specify the register to be used for PIC addressing
  -mstructure-size-boundary= Specify the minimum bit alignment of structures
  -mfp=                     Specify the version of the floating point emulator
  -march=                   Specify the name of the target architecture (eg armv4l) 
  -mcpu=                    Specify the name of the target CPU (eg arm610)
Personal tools