GCC common switches

From RISC OS

(Difference between revisions)
Jump to: navigation, search
(Add introduction)
(Add template)
 
(4 intermediate revisions not shown)
Line 1: Line 1:
 +
== Switches for all languages ==
 +
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
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
Line 25: Line 27:
   passed on to the various sub-processes invoked by gcc.  In order to pass
   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.
   other options on to these processes the -W<letter> options must be used.
-
Configured with: ./configure
 
-
Thread model: posix
 
-
gcc version 3.4.6 (RISC OS GCCSDK 3.4.6 Release 3)
 
   
   
 +
== GCC compiler options ==
   --help                      Display this information
   --help                      Display this information
   --version                  This switch lacks documentation
   --version                  This switch lacks documentation
Line 49: Line 49:
   -w                          Suppress warnings
   -w                          Suppress warnings
   
   
-
The C front end recognizes the following options:
+
== C/C++ options ==
   
   
   -U<macro>                  Undefine <macro>
   -U<macro>                  Undefine <macro>
Line 99: Line 99:
                               macros
                               macros
   -v                          Enable verbose output
   -v                          Enable verbose output
-
+
 
-
The C++ front end recognizes the following options:
+
== C++ options ==  
-
+
 
-
  --output-pch=, -A, -C, -CC, -D, -H, -I, -M, -MD, -MF, -MG, -MM, -MMD, -MP, -MQ,
+
-
  -MT, -P, -U, -Wall, -Wcast-qual, -Wchar-subscripts, -Wcomment, -Wcomments,
+
-
  -Wconversion, -Wendif-labels, -Wfloat-equal, -Wformat, -Wformat-extra-args,
+
-
  -Wformat-nonliteral, -Wformat-security, -Wformat-y2k, -Wformat=, -Wimplicit,
+
-
  -Wimport, -Winit-self, -Winvalid-pch, -Wlong-long, -Wmissing-braces,
+
-
  -Wmissing-format-attribute, -Wmultichar, -Wparentheses, -Wpointer-arith,
+
-
  -Wredundant-decls, -Wreturn-type, -Wsign-compare, -Wtrigraphs, -Wundef,
+
-
  -Wunknown-pragmas, -Wunused-macros, -Wwrite-strings, -ansi, -fasm, -fbuiltin,
+
-
  -fbuiltin-, -fcond-mismatch, -fdollars-in-identifiers, -fdump-,
+
-
  -fexec-charset=, -finput-charset=, -fms-extensions, -fpch-deps, -fpreprocessed,
+
-
  -fshort-double, -fshort-enums, -fshort-wchar, -fshow-column,
+
-
  -fsigned-bitfields, -fsigned-char, -ftabstop=, -funsigned-bitfields,
+
-
  -funsigned-char, -fwide-exec-charset=, -fworking-directory, -icrossdirafter,
+
-
  -idirafter, -imacros, -include, -iprefix, -isysroot, -isystem, -iwithprefix,
+
-
  -iwithprefixbefore, -nostdinc, -remap, -traditional-cpp, -trigraphs, -undef,
+
-
  -v
+
-
+
   -fxref                      Emit cross referencing information
   -fxref                      Emit cross referencing information
   -nostdinc++                Do not search standard system include directories
   -nostdinc++                Do not search standard system include directories
Line 126: Line 109:
                               extensions
                               extensions
   
   
-
  /gccpkg:bin/arm-riscos-aof/3_4/as -t ARM6 -apcsfpv3 -apcs32 --help -o /tmp/cckCXpgh.o /tmp/ccePwa4J.s
+
== RISC OS/ARM specific options ==
-
AS AOF/ELF Assembler v1.46 (Jul 17 2007) [GCCSDK 3.4.6 (RISC OS GCCSDK 3.4.6 Release 3)]
+
  -mmodule                  Generate data references suitable for RISC OS modules
-
Usage: gccpkg:bin.arm-riscos-aof.3_4.as [option]... <asmfile>
+
  -munixlib                 Compile with the headers from UnixLib (default)
-
+
  -mlibscl                  Compile with the SharedCLibrary headers
-
Options:
+
  -mamu                    Format source dependencies for Acorn's Make Utility
-
-o objfile                 Specifies destination AOF file.
+
  -mthrowback              Send errors to a DDEUtils compatible text editor
-
-Idirectory                Search 'directory' for included assembler files.
+
  -mhard-float             Use hardware floating point instructions
-
-pedantic      -p          Display extra warnings.
+
  -msoft-float              Use library calls to perform FP operations
-
-verbose      -v          Display progress information.
+
  -mapcs-reentrant          Generate re-entrant, PIC code
-
-fussy        -f          Display conversion information.  Can be specified more than once for more conversion information.
+
  -mapcs-float              Pass FP arguments in FP registers
-
-dde                      Replace '@' in filenames with <Prefix$Dir>.
+
   -mapcs-32                Use the 32-bit version of the APCS
-
-throwback    -tb        Throwback errors to a text editor.
+
  -mpoke-function-name      Store function names in object code
-
-autocast      -ac        Enable casting from integer to float.
+
   -mapcs-frame              Generate APCS conformant stack frames
-
-target        -t          Target ARM CPU (ARM2...SA110).
+
   -mpic-register=          Specify the register to be used for PIC addressing
-
-gas                      Support some GNU GAS keywords (NOT IMPLEMENTED).
+
   -mstructure-size-boundary= Specify the minimum bit alignment of structures
-
-depend <file> -d <file>  Write 'make' source file dependency information to 'file'.
+
   -mfp=                    Specify the version of the floating point emulator
-
-noalign      -na        Don't auto-align words and halfwords.
+
   -march=                  Specify the name of the target architecture (eg armv4l)  
-
-nolocal      -nl        No builtin LOCAL support.
+
   -mcpu=                    Specify the name of the target CPU (eg arm610)
-
-objasm        -obj        More compatibility with ObjAsm.
+
 
-
-upper        -up        Mnemonics must be in upper case.
+
{{GCC and GCCSDK pages}}
-
-help          -h -H -?   Display this help.
+
-
-version      -ver        Display the version number.
+
-
-From asmfile              Source assembler file (ObjAsm compatibility).
+
-
-To objfile                Destination AOF file (ObjAsm compatibility).
+
-
-apcs26                    26-bit APCS AREAs.
+
-
-apcs32                    32-bit APCS AREAs [default].
+
-
-apcsfpv2                  Use floating point v2 AREAs.
+
-
-apcsfpv3                  Use floating point v3 AREAs (SFM, LFM) [default]
+
-
-soft-float                Mark code as using -msoft-float (avoids explicit FP instructions).  This is a GCCSDK extension to the AOF file format.
+
-
-hard-float                Mark code as using -mhard-float (uses explicit FP instructions) [default].
+
-
-module                    Set if building RISC OS RMA modules.
+
-
-elf                      Output ELF file.
+
-
+
-
+
-
  /gccpkg:bin/arm-riscos-aof/3_4/ld --help -L/gccpkg:bin/arm-riscos-aof/3_4/apcs32/abs/unixlib -L/gccpkg:bin/arm-riscos-aof/3_4 -L/gccpkg:startup /tmp/cckCXpgh.o -lgcc -lunixlib -lgcc
+
-
ld: RISC OS linker front end v2.30 (Jul 17 2007) [GCCSDK 3.4.6 (RISC OS GCCSDK 3.4.6 Release 3)]
+
-
Including C++ template repository support
+
-
+
-
LD is used by GCC to convert command line options passed to
+
-
GNU LD into something that Drlink or Link can understand.
+
-
LD also provides support for C++ template instantiation by
+
-
compiling a C++ source file several times to resolve missing
+
-
symbol references.
+
-
Syntax:
+
-
   ld -o <exec> o.<obj> [o.<obj> ...] [-L<path>] [-l<lib>]
+
-
Where:
+
-
   -L<path>    <path> is a library search path
+
-
  -l<lib>      <lib> is a library to link against
+
-
  o.<obj>      Object files
+
-
The following Drlink linker commands are recognised:
+
-
   -acornmap, -area[map] <file>, -aif, -aof, -bin, -case
+
-
   -leave[weak], -map, -m[odule], -no[unused], -output, -qui[et]
+
-
  -res[can], -symbols <file>, -throwback, -via <file>, -verbose
+
-
The following Acorn Link linker (version 4) commands are recognised:
+
-
   -aif, -aof, -bin, -map, -via <file>, -verbose
+
-
The following Acorn Link linker (version 5) commands are recognised:
+
-
   -aif, -aof, -bin, -map, -via <file>, -nounused[areas], -verbose
+
-
+
-
Text within square brackets is optional
+
-
By default, the real linker will be Drlink, and this must be placed
+
-
in a directory searched by Run$Path. To use an alternative linker
+
-
(Acorn Link, or one that isn't contained within the Run$Path),
+
-
then GCC$Linker should contain the full pathname of the linker e.g.
+
-
    *Set GCC$Linker "$.library.link"
+
-
+
-
For bug reporting instructions, please see:
+
-
<URL:http://gccsdk.riscos.info/>
+

Latest revision as of 21:54, 28 November 2007

Contents

Switches for all languages

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

C/C++ 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)
GCC and GCCSDK pages
GCC under RISC OS

GCC for RISC OS, GCC tutorial, GCC common switches, GCC for beginners, UnixLib, ELFLoader
GCCSDK and Unix porting
GCCSDK, GCCSDK Releases, GCCSDK Development, Using GCCSDK, Autobuilder Development and Packaging Cygwin setup, Accelerating autobuilder with apt-proxy, ChoX11, Developer help wanted

Personal tools