diff options
author | obrien <obrien@FreeBSD.org> | 1999-10-27 09:37:24 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 1999-10-27 09:37:24 +0000 |
commit | d1a4530efd3317baded0696ce5f88f5410e3b877 (patch) | |
tree | 336036dd0dc10a937c24bf64ad8c2d4c213b75ef /contrib | |
parent | 1292393efe4113ff3179db10184b2a11a76ac434 (diff) | |
download | FreeBSD-src-d1a4530efd3317baded0696ce5f88f5410e3b877.zip FreeBSD-src-d1a4530efd3317baded0696ce5f88f5410e3b877.tar.gz |
This brings rev 1.2 (reality check and document profiling extensions)
into GCC 2.95.1.
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/gcc/invoke.texi | 1507 |
1 files changed, 1011 insertions, 496 deletions
diff --git a/contrib/gcc/invoke.texi b/contrib/gcc/invoke.texi index 2e57dd8..4b1ddae 100644 --- a/contrib/gcc/invoke.texi +++ b/contrib/gcc/invoke.texi @@ -1,14 +1,16 @@ -@c Copyright (C) 1988,89,92,93,94,95,96,97,1998 Free Software Foundation, Inc. +@c Copyright (C) 1988, 89, 92-98, 1999 Free Software Foundation, Inc. @c This is part of the GCC manual. @c For copying conditions, see the file gcc.texi. +@c $FreeBSD$ + @node Invoking GCC -@chapter GNU CC Command Options -@cindex GNU CC command options +@chapter GCC Command Options +@cindex GCC command options @cindex command options -@cindex options, GNU CC command +@cindex options, GCC command -When you invoke GNU CC, it normally does preprocessing, compilation, +When you invoke GCC, it normally does preprocessing, compilation, assembly and linking. The ``overall options'' allow you to stop this process at an intermediate stage. For example, the @samp{-c} option says not to run the linker. Then the output consists of object files @@ -20,7 +22,7 @@ options control the assembler and linker; most of these are not documented here, since you rarely need to use any of them. @cindex C compilation options -Most of the command line options that you can use with GNU CC are useful +Most of the command line options that you can use with GCC are useful for C programs; when an option is only useful with another language (usually C++), the explanation says so explicitly. If the description for a particular option does not mention a source language, you can use @@ -68,12 +70,12 @@ only one of these two forms, whichever one is not the default. * Link Options:: Specifying libraries and so on. * Directory Options:: Where to find header files and libraries. Where to find the compiler executable files. -* Target Options:: Running a cross-compiler, or an old version of GNU CC. +* Target Options:: Running a cross-compiler, or an old version of GCC. * Submodel Options:: Specifying minor hardware or convention variations, such as 68010 vs 68020. * Code Gen Options:: Specifying conventions for function calls, data layout and register usage. -* Environment Variables:: Env vars that affect GNU CC. +* Environment Variables:: Env vars that affect GCC. * Running Protoize:: Automatically adding or removing function prototypes. @end menu @@ -87,13 +89,13 @@ in the following sections. @item Overall Options @xref{Overall Options,,Options Controlling the Kind of Output}. @smallexample --c -S -E -o @var{file} -pipe -v -x @var{language} +-c -S -E -o @var{file} -pipe -v --help -x @var{language} @end smallexample @item C Language Options @xref{C Dialect Options,,Options Controlling C Dialect}. @smallexample --ansi -fallow-single-precision -fcond-mismatch -fno-asm +-ansi -flang-isoc9x -fallow-single-precision -fcond-mismatch -fno-asm -fno-builtin -ffreestanding -fhosted -fsigned-bitfields -fsigned-char -funsigned-bitfields -funsigned-char -fwritable-strings -traditional -traditional-cpp -trigraphs @@ -102,13 +104,17 @@ in the following sections. @item C++ Language Options @xref{C++ Dialect Options,,Options Controlling C++ Dialect}. @smallexample --fall-virtual -fdollars-in-identifiers -felide-constructors --fenum-int-equiv -fexternal-templates -ffor-scope --fno-for-scope -fhandle-signatures -fmemoize-lookups --fname-mangling-version-@var{n} -fno-default-inline --fno-gnu-keywords -fnonnull-objects -fguiding-decls --foperator-names -fno-optional-diags -fstrict-prototype -fthis-is-variable --ftemplate-depth-@var{n} -nostdinc++ -traditional +e@var{n} +-fno-access-control -fcheck-new -fconserve-space -fdollars-in-identifiers +-fno-elide-constructors -fexternal-templates -ffor-scope +-fno-for-scope -fno-gnu-keywords -fguiding-decls -fhandle-signatures +-fhonor-std -fhuge-objects -fno-implicit-templates -finit-priority +-fno-implement-inlines -fname-mangling-version-@var{n} -fno-default-inline +-foperator-names -fno-optional-diags -fpermissive -frepo -fstrict-prototype +-fsquangle -ftemplate-depth-@var{n} -fthis-is-variable -fvtable-thunks +-nostdinc++ -Wctor-dtor-privacy -Wno-deprecated -Weffc++ +-Wno-non-template-friend +-Wnon-virtual-dtor -Wold-style-cast -Woverloaded-virtual +-Wno-pmf-conversions -Wreorder -Wsign-promo -Wsynth @end smallexample @item Warning Options @@ -116,26 +122,25 @@ in the following sections. @smallexample -fsyntax-only -pedantic -pedantic-errors -w -W -Wall -Waggregate-return -Wbad-function-cast --Wcast-align -Wcast-qual -Wchar-subscript -Wcomment +-Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment -Wconversion -Werror -Wformat -Wid-clash-@var{len} -Wimplicit -Wimplicit-int -Wimplicit-function-declaration -Wimport -Werror-implicit-function-declaration -Winline -Wlarger-than-@var{len} -Wlong-long --Wmain -Wmissing-declarations +-Wmain -Wmissing-declarations -Wmissing-noreturn -Wmissing-prototypes -Wmultichar -Wnested-externs -Wno-import --Wold-style-cast -Woverloaded-virtual -Wparentheses --Wpointer-arith -Wredundant-decls -Wreorder -Wreturn-type --Wshadow -Wsign-compare -Wstrict-prototypes -Wswitch --Wsynth -Wtemplate-debugging -Wtraditional -Wtrigraphs --Wundef -Wuninitialized -Wunused -Wwrite-strings +-Wparentheses -Wpointer-arith -Wredundant-decls +-Wreturn-type -Wshadow -Wsign-compare -Wstrict-prototypes +-Wswitch -Wtraditional +-Wtrigraphs -Wundef -Wuninitialized -Wunused -Wwrite-strings -Wunknown-pragmas @end smallexample @item Debugging Options @xref{Debugging Options,,Options for Debugging Your Program or GCC}. @smallexample --a -ax -d@var{letters} -fpretend-float +-a -ax -d@var{letters} -fdump-unnumbered -fpretend-float -fprofile-arcs -ftest-coverage -g -g@var{level} -gcoff -gdwarf -gdwarf-1 -gdwarf-1+ -gdwarf-2 -ggdb -gstabs -gstabs+ -gxcoff -gxcoff+ @@ -150,15 +155,14 @@ in the following sections. -fcaller-saves -fcse-follow-jumps -fcse-skip-blocks -fdelayed-branch -fexpensive-optimizations -ffast-math -ffloat-store -fforce-addr -fforce-mem --ffunction-sections -fgcse -finline-functions --fkeep-inline-functions -fno-default-inline --fno-defer-pop -fno-function-cse +-fdata-sections -ffunction-sections -fgcse +-finline-functions -finline-limit-@var{n} -fkeep-inline-functions +-fno-default-inline -fno-defer-pop -fno-function-cse -fno-inline -fno-peephole -fomit-frame-pointer -fregmove -frerun-cse-after-loop -frerun-loop-opt -fschedule-insns -fschedule-insns2 -fstrength-reduce -fthread-jumps -funroll-all-loops -funroll-loops -fmove-all-movables -freduce-all-givs -fstrict-aliasing --fstructure-noalias -O -O0 -O1 -O2 -O3 -Os @end smallexample @@ -170,7 +174,7 @@ in the following sections. -idirafter @var{dir} -include @var{file} -imacros @var{file} -iprefix @var{file} -iwithprefix @var{dir} --iwithprefixbefore @var{dir} -isystem @var{dir} +-iwithprefixbefore @var{dir} -isystem @var{dir} -isystem-c++ @var{dir} -M -MD -MM -MMD -MG -nostdinc -P -trigraphs -undef -U@var{macro} -Wp,@var{option} @end smallexample @@ -259,6 +263,8 @@ in the following sections. -mcpu= -march= -mfpe= -mstructure-size-boundary= -mbsd -mxopen -mno-symrename +-mabort-on-noreturn +-mno-sched-prolog @emph{Thumb Options} -mtpcs-frame -mno-tpcs-frame @@ -320,7 +326,7 @@ in the following sections. -mabicalls -mcpu=@var{cpu type} -membedded-data -membedded-pic -mfp32 -mfp64 -mgas -mgp32 -mgp64 -mgpopt -mhalf-pic -mhard-float -mint64 -mips1 --mips2 -mips3 -mips4 -mlong64 -mlong-calls -mmemcpy +-mips2 -mips3 -mips4 -mlong64 -mlong32 -mlong-calls -mmemcpy -mmips-as -mmips-tfile -mno-abicalls -mno-embedded-data -mno-embedded-pic -mno-gpopt -mno-long-calls @@ -340,9 +346,10 @@ in the following sections. -msoft-float -msvr3-shlib -mreg-alloc=@var{list} -mregparm=@var{num} -malign-jumps=@var{num} -malign-loops=@var{num} --malign-functions=@var{num} +-malign-functions=@var{num} -mpreferred-stack-boundary=@var{num} @emph{HPPA Options} +-march=@var{architecture type} -mbig-switch -mdisable-fpregs -mdisable-indexing -mfast-indirect-calls -mgas -mjump-in-delay -mlong-load-store -mno-big-switch -mno-disable-fpregs @@ -350,8 +357,8 @@ in the following sections. -mno-jump-in-delay -mno-long-load-store -mno-portable-runtime -mno-soft-float -mno-space -mno-space-regs -msoft-float -mpa-risc-1-0 --mpa-risc-1-1 -mportable-runtime --mschedule=@var{list} -mspace -mspace-regs +-mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime +-mschedule=@var{cpu type} -mspace -mspace-regs @emph{Intel 960 Options} -m@var{cpu type} -masm-compat -mclean-linkage @@ -390,11 +397,22 @@ in the following sections. -mmangle-cpu -mcpu=@var{cpu} -mtext=@var{text section} -mdata=@var{data section} -mrodata=@var{readonly data section} +@emph{TMS320C3x/C4x Options} +-mcpu=@var{cpu} -mbig -msmall -mregparm -mmemparm +-mfast-fix -mmpyi -mbk -mti -mdp-isr-reload +-mrpts=@var{count} -mrptb -mdb -mloop-unsigned +-mparallel-insns -mparallel-mpy -mpreserve-float + @emph{V850 Options} -mlong-calls -mno-long-calls -mep -mno-ep -mprolog-function -mno-prolog-function -mspace -mtda=@var{n} -msda=@var{n} -mzda=@var{n} -mv850 -mbig-switch + +@emph{NS32K Options} +-m32032 -m32332 -m32532 -m32081 -m32381 -mmult-add -mnomult-add +-msoft-float -mrtd -mnortd -mregparam -mnoregparam -msb -mnosb +-mbitfield -mnobitfield -mhimem -mnohimem @end smallexample @item Code Generation Options @@ -406,10 +424,11 @@ in the following sections. -fno-common -fno-ident -fno-gnu-linker -fpcc-struct-return -fpic -fPIC -freg-struct-return -fshared-data -fshort-enums --fshort-double -fvolatile -fvolatile-global --fverbose-asm -fpack-struct -fstack-check +e0 +e1 +-fshort-double -fvolatile -fvolatile-global -fvolatile-static +-fverbose-asm -fpack-struct -fstack-check -fargument-alias -fargument-noalias -fargument-noalias-global +-fleading-underscore @end smallexample @end table @@ -428,7 +447,7 @@ in the following sections. * Link Options:: Specifying libraries and so on. * Directory Options:: Where to find header files and libraries. Where to find the compiler executable files. -* Target Options:: Running a cross-compiler, or an old version of GNU CC. +* Target Options:: Running a cross-compiler, or an old version of GCC. @end menu @node Overall Options @@ -560,6 +579,15 @@ Use pipes rather than temporary files for communication between the various stages of compilation. This fails to work on some systems where the assembler is unable to read from a pipe; but the GNU assembler has no trouble. + +@item --help +Print (on the standard output) a description of the command line options +understood by @code{gcc}. If the @code{-v} option is also specified +then @code{--help} will also be passed on to the various processes +invoked by @code{gcc}, so that they can display the command line options +they accept. If the @code{-W} option is also specified then command +line options which have no documentation associated with them will also +be displayed. @end table @node Invoking G++ @@ -568,10 +596,11 @@ no trouble. @cindex suffixes for C++ source @cindex C++ source file suffixes C++ source files conventionally use one of the suffixes @samp{.C}, -@samp{.cc}, @samp{cpp}, or @samp{.cxx}; preprocessed C++ files use the -suffix @samp{.ii}. GNU CC recognizes files with these names and -compiles them as C++ programs even if you call the compiler the same way -as for compiling C programs (usually with the name @code{gcc}). +@samp{.cc}, @samp{.cpp}, @samp{.c++}, @samp{.cp}, or @samp{.cxx}; +preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes +files with these names and compiles them as C++ programs even if you +call the compiler the same way as for compiling C programs (usually with +the name @code{gcc}). @findex g++ @findex c++ @@ -579,19 +608,9 @@ However, C++ programs often require class libraries as well as a compiler that understands the C++ language---and under some circumstances, you might want to compile programs from standard input, or otherwise without a suffix that flags them as C++ programs. -@code{g++} is a program that calls GNU CC with the default language +@code{g++} is a program that calls GCC with the default language set to C++, and automatically specifies linking against the C++ -library. -@cindex @code{g++ 1.@var{xx}} -@cindex @code{g++}, separate compiler -@cindex @code{g++} older version -@footnote{Prior to release 2 of the compiler, -there was a separate @code{g++} compiler. That version was based on GNU -CC, but not integrated with it. Versions of @code{g++} with a -@samp{1.@var{xx}} version number---for example, @code{g++} version 1.37 -or 1.42---are much less reliable than the versions integrated with GCC -2. Moreover, combining G++ @samp{1.@var{xx}} with a version 2 GCC will -simply not work.} On many systems, the script @code{g++} is also +library. On many systems, the script @code{g++} is also installed with the name @code{c++}. @cindex invoking @code{g++} @@ -616,14 +635,20 @@ from C, such as C++ and Objective C) that the compiler accepts: @table @code @cindex ANSI support @item -ansi -Support all ANSI standard C programs. +In C mode, support all ANSI standard C programs. In C++ mode, +remove GNU extensions that conflict with ANSI C++. +@c shouldn't we be saying "ISO"? -This turns off certain features of GNU C that are incompatible with ANSI -C, such as the @code{asm}, @code{inline} and @code{typeof} keywords, and +This turns off certain features of GCC that are incompatible with ANSI +C (when compiling C code), or of ANSI standard C++ (when compiling C++ code), +such as the @code{asm} and @code{typeof} keywords, and predefined macros such as @code{unix} and @code{vax} that identify the type of system you are using. It also enables the undesirable and -rarely used ANSI trigraph feature, and it disables recognition of C++ -style @samp{//} comments. +rarely used ANSI trigraph feature. For the C compiler, +it disables recognition of C++ style @samp{//} comments as well as +the @code{inline} keyword. For the C++ compiler, +@samp{-foperator-names} is enabled as well. + The alternate keywords @code{__asm__}, @code{__extension__}, @code{__inline__} and @code{__typeof__} continue to work despite @@ -646,6 +671,15 @@ programs that might use these names for other things. The functions @code{alloca}, @code{abort}, @code{exit}, and @code{_exit} are not builtin functions when @samp{-ansi} is used. +@item -flang-isoc9x +Enable support for features found in the C9X standard. In particular, +enable support for the C9X @code{restrict} keyword. + +Even when this option is not specified, you can still use some C9X +features in so far as they do not conflict with previous C standards. +For example, you may use @code{__restrict__} even when -flang-isoc9x +is not specified. + @item -fno-asm Do not recognize @code{asm}, @code{inline} or @code{typeof} as a keyword, so that code can use these words as identifiers. You can use @@ -674,7 +708,7 @@ other, C++-specific, extension keywords such as @code{headof}. @findex strcmp @findex strcpy @findex strlen -Don't recognize builtin functions that do not begin with `__builtin_' +Don't recognize builtin functions that do not begin with @samp{__builtin_} as prefix. Currently, the functions affected include @code{abort}, @code{abs}, @code{alloca}, @code{cos}, @code{exit}, @code{fabs}, @code{ffs}, @code{labs}, @code{memcmp}, @code{memcpy}, @code{sin}, @@ -766,11 +800,6 @@ The character escape sequences @samp{\x} and @samp{\a} evaluate as the literal characters @samp{x} and @samp{a} respectively. Without @w{@samp{-traditional}}, @samp{\x} is a prefix for the hexadecimal representation of a character, and @samp{\a} produces a bell. - -@item -In C++ programs, assignment to @code{this} is permitted with -@samp{-traditional}. (The option @samp{-fthis-is-variable} also has -this effect.) @end itemize You may wish to use @samp{-fno-builtin} as well as @samp{-traditional} @@ -911,13 +940,13 @@ regardless of what language your program is in. For example, you might compile a file @code{firstClass.C} like this: @example -g++ -g -felide-constructors -O -c firstClass.C +g++ -g -frepo -O -c firstClass.C @end example @noindent -In this example, only @samp{-felide-constructors} is an option meant +In this example, only @samp{-frepo} is an option meant only for C++ programs; you can use the other options with any -language supported by GNU CC. +language supported by GCC. Here is a list of options that are @emph{only} for compiling C++ programs: @@ -926,24 +955,17 @@ Here is a list of options that are @emph{only} for compiling C++ programs: Turn off all access checking. This switch is mainly useful for working around bugs in the access control code. -@item -fall-virtual -Treat all possible member functions as virtual, implicitly. -All member functions (except for constructor functions and @code{new} or -@code{delete} member operators) are treated as virtual functions of the -class where they appear. - -This does not mean that all calls to these member functions will be made -through the internal table of virtual functions. Under some -circumstances, the compiler can determine that a call to a given virtual -function can be made directly; in these cases the calls are direct in -any case. - @item -fcheck-new Check that the pointer returned by @code{operator new} is non-null before attempting to modify the storage allocated. The current Working Paper requires that @code{operator new} never return a null pointer, so this check is normally unnecessary. +An alternative to using this option is to specify that your +@code{operator new} does not throw any exceptions; if you declare it +@samp{throw()}, g++ will check the return value. See also @samp{new +(nothrow)}. + @item -fconserve-space Put uninitialized or runtime-initialized global variables into the common segment, as C does. This saves space in the executable at the @@ -952,6 +974,9 @@ flag and your program mysteriously crashes after @code{main()} has completed, you may have an object that is being destroyed twice because two definitions were merged. +This option is no longer useful on most targets, now that support has +been added for putting variables into BSS without making them common. + @item -fdollars-in-identifiers Accept @samp{$} in identifiers. You can also explicitly prohibit use of @samp{$} with the option @samp{-fno-dollars-in-identifiers}. (GNU C allows @@ -959,10 +984,11 @@ Accept @samp{$} in identifiers. You can also explicitly prohibit use of Traditional C allowed the character @samp{$} to form part of identifiers. However, ANSI C and C++ forbid @samp{$} in identifiers. -@item -fenum-int-equiv -Anachronistically permit implicit conversion of @code{int} to -enumeration types. Current C++ allows conversion of @code{enum} to -@code{int}, but not the other way around. +@item -fno-elide-constructors +The C++ standard allows an implementation to omit creating a temporary +which is only used to initialize another object of the same type. +Specifying this option disables that optimization, and forces g++ to +call the copy constructor in all cases. @item -fexternal-templates Cause template instantiations to obey @samp{#pragma interface} and @@ -1011,12 +1037,9 @@ be instantiated. This behavior reflects the C++ language prior to September 1996, when guiding declarations were removed. This option implies @samp{-fname-mangling-version-0}, and will not work -with other name mangling versions. - -@item -fno-implicit-templates -Never emit code for templates which are instantiated implicitly (i.e. by -use); only emit code for explicit instantiations. @xref{Template -Instantiation}, for more information. +with other name mangling versions. Like all options that change the +ABI, all C++ code, @emph{including libgcc.a} must be built with the same +setting of this option. @item -fhandle-signatures Recognize the @code{signature} and @code{sigof} keywords for specifying @@ -1024,71 +1047,42 @@ abstract types. The default (@samp{-fno-handle-signatures}) is not to recognize them. @xref{C++ Signatures, Type Abstraction using Signatures}. +@item -fhonor-std +Treat the @code{namespace std} as a namespace, instead of ignoring +it. For compatibility with earlier versions of g++, the compiler will, +by default, ignore @code{namespace-declarations}, +@code{using-declarations}, @code{using-directives}, and +@code{namespace-names}, if they involve @code{std}. + @item -fhuge-objects Support virtual function calls for objects that exceed the size representable by a @samp{short int}. Users should not use this flag by -default; if you need to use it, the compiler will tell you so. If you -compile any of your code with this flag, you must compile @emph{all} of -your code with this flag (including the C++ library, if you use it). +default; if you need to use it, the compiler will tell you so. This flag is not useful when compiling with -fvtable-thunks. -@item -fno-implement-inlines -To save space, do not emit out-of-line copies of inline functions -controlled by @samp{#pragma implementation}. This will cause linker -errors if these functions are not inlined everywhere they are called. +Like all options that change the ABI, all C++ code, @emph{including +libgcc} must be built with the same setting of this option. -@item -fmemoize-lookups -@itemx -fsave-memoized -Use heuristics to compile faster. These heuristics are not enabled by -default, since they are only effective for certain input files. Other -input files compile more slowly. - -The first time the compiler must build a call to a member function (or -reference to a data member), it must (1) determine whether the class -implements member functions of that name; (2) resolve which member -function to call (which involves figuring out what sorts of type -conversions need to be made); and (3) check the visibility of the member -function to the caller. All of this adds up to slower compilation. -Normally, the second time a call is made to that member function (or -reference to that data member), it must go through the same lengthy -process again. This means that code like this: - -@smallexample -cout << "This " << p << " has " << n << " legs.\n"; -@end smallexample +@item -fno-implicit-templates +Never emit code for non-inline templates which are instantiated +implicitly (i.e. by use); only emit code for explicit instantiations. +@xref{Template Instantiation}, for more information. -@noindent -makes six passes through all three steps. By using a software cache, a -``hit'' significantly reduces this cost. Unfortunately, using the cache -introduces another layer of mechanisms which must be implemented, and so -incurs its own overhead. @samp{-fmemoize-lookups} enables the software -cache. - -Because access privileges (visibility) to members and member functions -may differ from one function context to the next, G++ may need to flush -the cache. With the @samp{-fmemoize-lookups} flag, the cache is flushed -after every function that is compiled. The @samp{-fsave-memoized} flag -enables the same software cache, but when the compiler determines that -the context of the last function compiled would yield the same access -privileges of the next function to compile, it preserves the cache. -This is most helpful when defining many member functions for the same -class: with the exception of member functions which are friends of other -classes, each member function has exactly the same access privileges as -every other, and the cache need not be flushed. - -The code that implements these flags has rotted; you should probably -avoid using them. +@item -fno-implicit-inline-templates +Don't emit code for implicit instantiations of inline templates, either. +The default is to handle inlines differently so that compiles with and +without optimization will need the same set of explicit instantiations. -@item -fstrict-prototype -Within an @samp{extern "C"} linkage specification, treat a function -declaration with no arguments, such as @samp{int foo ();}, as declaring -the function to take no arguments. Normally, such a declaration means -that the function @code{foo} can take any combination of arguments, as -in C. @samp{-pedantic} implies @samp{-fstrict-prototype} unless -overridden with @samp{-fno-strict-prototype}. +@item -finit-priority +Support @samp{__attribute__ ((init_priority (n)))} for controlling the +order of initialization of file-scope objects. On ELF targets, this +requires GNU ld 2.10 or later. -This flag no longer affects declarations with C++ linkage. +@item -fno-implement-inlines +To save space, do not emit out-of-line copies of inline functions +controlled by @samp{#pragma implementation}. This will cause linker +errors if these functions are not inlined everywhere they are called. @item -fname-mangling-version-@var{n} Control the way in which names are mangled. Version 0 is compatible @@ -1101,14 +1095,8 @@ given this declaration: template <class T, class U> void foo(T t); @end example -@item -fno-nonnull-objects -Don't assume that a reference is initialized to refer to a valid object. -Although the current C++ Working Paper prohibits null references, some -old code may rely on them, and you can use @samp{-fno-nonnull-objects} -to turn on checking. - -At the moment, the compiler only does this checking for conversions to -virtual base classes. +Like all options that change the ABI, all C++ code, @emph{including +libgcc} must be built with the same setting of this option. @item -foperator-names Recognize the operator name keywords @code{and}, @code{bitand}, @@ -1118,14 +1106,40 @@ synonyms for the symbols they refer to. @samp{-ansi} implies @item -fno-optional-diags Disable diagnostics that the standard says a compiler does not need to -issue. Currently, this means the diagnostic for a name having multiple -meanings within a class. +issue. Currently, the only such diagnostic issued by g++ is the one for +a name having multiple meanings within a class. + +@item -fpermissive +Downgrade messages about nonconformant code from errors to warnings. By +default, g++ effectively sets @samp{-pedantic-errors} without +@samp{-pedantic}; this option reverses that. This behavior and this +option are superceded by @samp{-pedantic}, which works as it does for GNU C. @item -frepo Enable automatic template instantiation. This option also implies @samp{-fno-implicit-templates}. @xref{Template Instantiation}, for more information. +@item -fno-rtti +Disable generation of the information used by C++ runtime type +identification features (@samp{dynamic_cast} and @samp{typeid}). If you +don't use those parts of the language (or exception handling, which uses +@samp{dynamic_cast} internally), you can save some space by using this +flag. + +@item -fstrict-prototype +Within an @samp{extern "C"} linkage specification, treat a function +declaration with no arguments, such as @samp{int foo ();}, as declaring +the function to take no arguments. Normally, such a declaration means +that the function @code{foo} can take any combination of arguments, as +in C. @samp{-pedantic} implies @samp{-fstrict-prototype} unless +overridden with @samp{-fno-strict-prototype}. + +Specifying this option will also suppress implicit declarations of +functions. + +This flag no longer affects declarations with C++ linkage. + @item -fsquangle @itemx -fno-squangle @samp{-fsquangle} will enable a compressed form of name mangling for @@ -1135,6 +1149,15 @@ short ID codes. This option also requires any C++ libraries being used to be compiled with this option as well. The compiler has this disabled (the equivalent of @samp{-fno-squangle}) by default. +Like all options that change the ABI, all C++ code, @emph{including +libgcc.a} must be built with the same setting of this option. + +@item -ftemplate-depth-@var{n} +Set the maximum instantiation depth for template classes to @var{n}. +A limit on the template instantiation depth is needed to detect +endless recursions during template class instantiation. ANSI/ISO C++ +conforming programs must not rely on a maximum depth greater than 17. + @item -fthis-is-variable Permit assignment to @code{this}. The incorporation of user-defined free store management into C++ has made assignment to @samp{this} an @@ -1157,21 +1180,13 @@ vtables; if a class has any non-inline virtual functions, the vtable will be emitted in the translation unit containing the first one of those. -@item -ftemplate-depth-@var{n} -Set the maximum instantiation depth for template classes to @var{n}. -A limit on the template instantiation depth is needed to detect -endless recursions during template class instantiation. ANSI/ISO C++ -conforming programs must not rely on a maximum depth greater than 17. +Like all options that change the ABI, all C++ code, @emph{including +libgcc.a} must be built with the same setting of this option. @item -nostdinc++ Do not search for header files in the standard directories specific to C++, but do still search the other standard directories. (This option is used when building the C++ library.) - -@item -traditional -For C++ programs (in addition to the effects that apply to both C and -C++), this has the same effect as @samp{-fthis-is-variable}. -@xref{C Dialect Options,, Options Controlling C Dialect}. @end table In addition, these optimization, warning, and code generation options @@ -1180,21 +1195,113 @@ have meanings only for C++ programs: @table @code @item -fno-default-inline Do not assume @samp{inline} for functions defined inside a class scope. -@xref{Optimize Options,,Options That Control Optimization}. +@xref{Optimize Options,,Options That Control Optimization}. Note that these +functions will have linkage like inline functions; they just won't be +inlined by default. + +@item -Wctor-dtor-privacy (C++ only) +Warn when a class seems unusable, because all the constructors or +destructors in a class are private and the class has no friends or +public static member functions. + +@item -Wnon-virtual-dtor (C++ only) +Warn when a class declares a non-virtual destructor that should probably +be virtual, because it looks like the class will be used polymorphically. + +@item -Wreorder (C++ only) +@cindex reordering, warning +@cindex warning for reordering of member initializers +Warn when the order of member initializers given in the code does not +match the order in which they must be executed. For instance: -@item -Wold-style-cast -@itemx -Woverloaded-virtual -@itemx -Wtemplate-debugging -Warnings that apply only to C++ programs. @xref{Warning -Options,,Options to Request or Suppress Warnings}. +@smallexample +struct A @{ + int i; + int j; + A(): j (0), i (1) @{ @} +@}; +@end smallexample + +Here the compiler will warn that the member initializers for @samp{i} +and @samp{j} will be rearranged to match the declaration order of the +members. +@end table + +The following @samp{-W@dots{}} options are not affected by @samp{-Wall}. + +@table @code +@item -Weffc++ (C++ only) +Warn about violations of various style guidelines from Scott Meyers' +@cite{Effective C++} books. If you use this option, you should be aware +that the standard library headers do not obey all of these guidelines; +you can use @samp{grep -v} to filter out those warnings. + +@item -Wno-deprecated (C++ only) +Do not warn about usage of deprecated features. @xref{Deprecated Features}. + +@item -Wno-non-template-friend (C++ only) +Disable warnings when non-templatized friend functions are declared +within a template. With the advent of explicit template specification +support in g++, if the name of the friend is an unqualified-id (ie, +@samp{friend foo(int)}), the C++ language specification demands that the +friend declare or define an ordinary, nontemplate function. (Section +14.5.3). Before g++ implemented explicit specification, unqualified-ids +could be interpreted as a particular specialization of a templatized +function. Because this non-conforming behavior is no longer the default +behavior for g++, @samp{-Wnon-template-friend} allows the compiler to +check existing code for potential trouble spots, and is on by default. +This new compiler behavior can also be turned off with the flag +@samp{-fguiding-decls}, which activates the older, non-specification +compiler code, or with @samp{-Wno-non-template-friend} which keeps the +conformant compiler code but disables the helpful warning. + +@item -Wold-style-cast (C++ only) +Warn if an old-style (C-style) cast is used within a C++ program. The +new-style casts (@samp{static_cast}, @samp{reinterpret_cast}, and +@samp{const_cast}) are less vulnerable to unintended effects. + +@item -Woverloaded-virtual (C++ only) +@cindex overloaded virtual fn, warning +@cindex warning for overloaded virtual fn +Warn when a derived class function declaration may be an error in +defining a virtual function. In a derived class, the +definitions of virtual functions must match the type signature of a +virtual function declared in the base class. With this option, the +compiler warns when you define a function with the same name as a +virtual function, but with a type signature that does not match any +declarations from the base class. + +@item -Wno-pmf-conversions (C++ only) +Disable the diagnostic for converting a bound pointer to member function +to a plain pointer. + +@item -Wsign-promo (C++ only) +Warn when overload resolution chooses a promotion from unsigned or +enumeral type to a signed type over a conversion to an unsigned type of +the same size. Previous versions of g++ would try to preserve +unsignedness, but the standard mandates the current behavior. + +@item -Wsynth (C++ only) +@cindex warning for synthesized methods +@cindex synthesized methods, warning +Warn when g++'s synthesis behavior does not match that of cfront. For +instance: + +@smallexample +struct A @{ + operator int (); + A& operator = (int); +@}; -@item -Weffc++ -Warn about violation of some style rules from Effective C++ by Scott Myers. +main () +@{ + A a,b; + a = b; +@} +@end smallexample -@item +e@var{n} -Control how virtual function definitions are used, in a fashion -compatible with @code{cfront} 1.x. @xref{Code Gen Options,,Options for -Code Generation Conventions}. +In this example, g++ will synthesize a default @samp{A& operator = +(const A&);}, while cfront will use the user-defined @samp{operator =}. @end table @node Warning Options @@ -1215,8 +1322,7 @@ negative form beginning @samp{-Wno-} to turn off warnings; for example, @samp{-Wno-implicit}. This manual lists only one of the two forms, whichever is not the default. -These options control the amount and kinds of warnings produced by GNU -CC: +These options control the amount and kinds of warnings produced by GCC: @table @code @cindex syntax checking @@ -1240,7 +1346,7 @@ these escape routes; application programs should avoid them. @xref{Alternate Keywords}. This option is not intended to be @i{useful}; it exists only to satisfy -pedants who would otherwise claim that GNU CC fails to support the ANSI +pedants who would otherwise claim that GCC fails to support the ANSI standard. Some users try to use @samp{-pedantic} to check programs for strict ANSI @@ -1250,11 +1356,8 @@ ANSI C @emph{requires} a diagnostic. A feature to report any failure to conform to ANSI C might be useful in some instances, but would require considerable additional work and would -be quite different from @samp{-pedantic}. We recommend, rather, that -users take advantage of the extensions of GNU C and disregard the -limitations of other compilers. Aside from certain supercomputers and -obsolete small machines, there is less and less reason ever to use any -other C compiler other than for bootstrapping GNU CC. +be quite different from @samp{-pedantic}. We don't have plans to +support such a feature in the near future. @item -pedantic-errors Like @samp{-pedantic}, except that errors are produced rather than @@ -1368,7 +1471,7 @@ In order to get a warning about an unused function parameter, you must specify both @samp{-W} and @samp{-Wunused}. To suppress this warning for an expression, simply cast it to void. For -unused variables and parameters, use the @samp{unused} attribute +unused variables, parameters and labels, use the @samp{unused} attribute (@pxref{Variable Attributes}). @item -Wuninitialized @@ -1390,7 +1493,7 @@ to compute a value that itself is never used, because such computations may be deleted by data flow analysis before the warnings are printed. -These warnings are made optional because GNU CC is not smart +These warnings are made optional because GCC is not smart enough to see all the reasons why the code might be correct despite appearing to have an error. Here is one example of how this can happen: @@ -1412,7 +1515,7 @@ this can happen: @noindent If the value of @code{y} is always 1, 2 or 3, then @code{x} is -always initialized, but GNU CC doesn't know this. Here is +always initialized, but GCC doesn't know this. Here is another common case: @smallexample @@ -1431,29 +1534,6 @@ Some spurious warnings can be avoided if you declare all the functions you use that never return as @code{noreturn}. @xref{Function Attributes}. -@item -Wreorder (C++ only) -@cindex reordering, warning -@cindex warning for reordering of member initializers -Warn when the order of member initializers given in the code does not -match the order in which they must be executed. For instance: - -@smallexample -struct A @{ - int i; - int j; - A(): j (0), i (1) @{ @} -@}; -@end smallexample - -Here the compiler will warn that the member initializers for @samp{i} -and @samp{j} will be rearranged to match the declaration order of the -members. - -@item -Wtemplate-debugging -@cindex template debugging -When using templates in a C++ program, warn if debugging is not yet -fully available (C++ only). - @item -Wunknown-pragmas @cindex warning for unknown pragmas @cindex unknown pragmas, warning @@ -1576,6 +1656,10 @@ the block. @item A @code{switch} statement has an operand of type @code{long}. + +@item +A non-@code{static} function declaration follows a @code{static} one. +This construct is not accepted by some traditional C compilers. @end itemize @item -Wundef @@ -1666,6 +1750,13 @@ Do so even if the definition itself provides a prototype. Use this option to detect global functions that are not declared in header files. +@item -Wmissing-noreturn +Warn about functions which might be candidates for attribute @code{noreturn}. +Note these are only possible candidates, not absolute ones. Care should +be taken to manually verify functions actually do not ever return before +adding the @code{noreturn} attribute, otherwise subtle code generation +bugs could be introduced. + @item -Wredundant-decls Warn if anything is declared more than once in the same scope, even in cases where multiple declaration is valid and changes nothing. @@ -1677,42 +1768,6 @@ Warn if an @code{extern} declaration is encountered within an function. Warn if a function can not be inlined, and either it was declared as inline, or else the @samp{-finline-functions} option was given. -@item -Wold-style-cast -Warn if an old-style (C-style) cast is used within a program. - -@item -Woverloaded-virtual -@cindex overloaded virtual fn, warning -@cindex warning for overloaded virtual fn -Warn when a derived class function declaration may be an error in -defining a virtual function (C++ only). In a derived class, the -definitions of virtual functions must match the type signature of a -virtual function declared in the base class. With this option, the -compiler warns when you define a function with the same name as a -virtual function, but with a type signature that does not match any -declarations from the base class. - -@item -Wsynth (C++ only) -@cindex warning for synthesized methods -@cindex synthesized methods, warning -Warn when g++'s synthesis behavior does not match that of cfront. For -instance: - -@smallexample -struct A @{ - operator int (); - A& operator = (int); -@}; - -main () -@{ - A a,b; - a = b; -@} -@end smallexample - -In this example, g++ will synthesize a default @samp{A& operator = -(const A&);}, while cfront will use the user-defined @samp{operator =}. - @item -Wlong-long Warn if @samp{long long} type is used. This is default. To inhibit the warning messages, use @samp{-Wno-long-long}. Flags @@ -1724,11 +1779,11 @@ Make all warnings into errors. @end table @node Debugging Options -@section Options for Debugging Your Program or GNU CC +@section Options for Debugging Your Program or GCC @cindex options, debugging @cindex debugging information options -GNU CC has various special options that are used for debugging +GCC has various special options that are used for debugging either your program or GCC: @table @code @@ -1746,7 +1801,7 @@ to generate the extra information, use @samp{-gstabs+}, @samp{-gstabs}, @samp{-gxcoff+}, @samp{-gxcoff}, @samp{-gdwarf-1+}, or @samp{-gdwarf-1} (see below). -Unlike most other C compilers, GNU CC allows you to use @samp{-g} with +Unlike most other C compilers, GCC allows you to use @samp{-g} with @samp{-O}. The shortcuts taken by optimized code may occasionally produce surprising results: some variables you declared may not exist at all; flow of control may briefly move where you did not expect it; @@ -1757,7 +1812,7 @@ execute in different places because they were moved out of loops. Nevertheless it proves possible to debug optimized output. This makes it reasonable to use the optimizer for programs that might have bugs. -The following options are useful when GNU CC is generated with the +The following options are useful when GCC is generated with the capability for more than one debugging format. @item -ggdb @@ -1935,7 +1990,7 @@ frequencies. @item -fprofile-arcs Instrument @dfn{arcs} during compilation. For each function of your -program, GNU CC creates a program flow graph, then finds a spanning tree +program, GCC creates a program flow graph, then finds a spanning tree for the graph. Only arcs that are not on the spanning tree have to be instrumented: the compiler adds code to count the number of times that these arcs are executed. When an arc is the only exit or only entrance to a @@ -1965,7 +2020,7 @@ branch probabilities. @need 2000 @item -ftest-coverage Create data files for the @code{gcov} code-coverage utility -(@pxref{Gcov,, @code{gcov}: a GNU CC Test Coverage Program}). +(@pxref{Gcov,, @code{gcov}: a GCC Test Coverage Program}). The data file names begin with the name of your source file: @table @code @@ -2002,18 +2057,10 @@ Dump after delayed branch scheduling, to @file{@var{file}.dbr}. @item D Dump all macro definitions, at the end of preprocessing, in addition to normal output. -@item y -Dump debugging information during parsing, to standard error. @item r Dump after RTL generation, to @file{@var{file}.rtl}. -@item x -Just generate RTL for a function instead of compiling it. Usually used -with @samp{r}. @item j Dump after first jump optimization, to @file{@var{file}.jump}. -@item s -Dump after CSE (including the jump optimization that sometimes -follows CSE), to @file{@var{file}.cse}. @item F Dump after purging ADDRESSOF, to @file{@var{file}.addressof}. @item f @@ -2049,9 +2096,6 @@ Dump after the first instruction scheduling pass, to @file{@var{file}.sched}. @item t Dump after the second CSE pass (including the jump optimization that sometimes follows CSE), to @file{@var{file}.cse2}. -@item x -Just generate RTL for a function instead of compiling it. Usually used -with @samp{r}. @item a Produce all the dumps listed above. @item m @@ -2059,18 +2103,28 @@ Print statistics on memory usage, at the end of the run, to standard error. @item p Annotate the assembler output with a comment indicating which -pattern and alternative was used. +pattern and alternative was used. The length of each instruction is +also printed. +@item x +Just generate RTL for a function instead of compiling it. Usually used +with @samp{r}. @item y Dump debugging information during parsing, to standard error. @item A Annotate the assembler output with miscellaneous debugging information. @end table +@item -fdump-unnumbered +When doing debugging dumps (see -d option above), suppress instruction +numbers and line number note output. This makes it more feasible to +use diff on debugging dumps for compiler invokations with different +options, in particular with and without -g. + @item -fpretend-float When running a cross-compiler, pretend that the target machine uses the same floating point format as the host machine. This causes incorrect output of the actual floating constants, but the actual instruction -sequence will probably be the same as GNU CC would make when running on +sequence will probably be the same as GCC would make when running on the target machine. @item -save-temps @@ -2082,7 +2136,7 @@ compiling @file{foo.c} with @samp{-c -save-temps} would produce files @item -print-file-name=@var{library} Print the full absolute name of the library file @var{library} that would be used when linking---and don't do anything else. With this -option, GNU CC does not compile or link anything; it just prints the +option, GCC does not compile or link anything; it just prints the file name. @item -print-prog-name=@var{program} @@ -2146,7 +2200,7 @@ without a frame pointer. On some machines the compiler also turns on other flags.@refill @item -O2 -Optimize even more. GNU CC performs nearly all supported optimizations +Optimize even more. GCC performs nearly all supported optimizations that do not involve a space-speed tradeoff. The compiler does not perform loop unrolling or function inlining when you specify @samp{-O2}. As compared to @samp{-O}, this option increases both compilation time @@ -2192,7 +2246,8 @@ the 68000 where the floating registers (of the 68881) keep more precision than a @code{double} is supposed to have. Similarly for the x86 architecture. For most programs, the excess precision does only good, but a few programs rely on the precise definition of IEEE floating -point. Use @samp{-ffloat-store} for such programs. +point. Use @samp{-ffloat-store} for such programs, after modifying +them to store all pertinent intermediate computations into variables. @item -fno-default-inline Do not make member functions inline by default merely because they are @@ -2256,6 +2311,23 @@ If all calls to a given function are integrated, and the function is declared @code{static}, then the function is normally not output as assembler code in its own right. +@item -finline-limit-@var{n} +By default, gcc limits the size of functions that can be inlined. This flag +allows the control of this limit for functions that are explicitly marked as +inline (ie marked with the inline keyword or defined within the class +definition in c++). @var{n} is the size of functions that can be inlined in +number of pseudo instructions (not counting parameter handling). The default +value of n is 10000. Increasing this value can result in more inlined code at +the cost of compilation time and memory consumption. Decreasing usually makes +the compilation faster and less code will be inlined (which presumably +means slower programs). This option is particularly useful for programs that +use inlining heavily such as those based on recursive templates with c++. + +@emph{Note:} pseudo instruction represents, in this particular context, an +abstract measurement of function's size. In no way, it represents a count +of assembly instructions and as such its exact meaning might change from one +release to an another. + @item -fkeep-inline-functions Even if all calls to a given function are integrated, and the function is declared @code{static}, nevertheless output a separate run-time @@ -2266,7 +2338,7 @@ callable version of the function. This switch does not affect Emit variables declared @code{static const} when optimization isn't turned on, even if the variables aren't referenced. -GNU CC enables this option by default. If you want to force the compiler to +GCC enables this option by default. If you want to force the compiler to check if the variable was referenced, regardless of whether or not optimization is turned on, use the @samp{-fno-keep-static-consts} option. @@ -2343,11 +2415,11 @@ This pass also performs global constant and copy propagation. Perform a number of minor optimizations that are relatively expensive. @item -foptimize-register-moves -@item -fregmove +@itemx -fregmove Attempt to reassign register numbers in move instructions and as operands of other simple instructions in order to maximize the amount of register tying. This is especially helpful on machines with two-operand -instructions. GNU CC enables this optimization by default with @samp{-O2} +instructions. GCC enables this optimization by default with @samp{-O2} or higher. Note @code{-fregmove} and @code{-foptimize-register-moves} are the same @@ -2372,18 +2444,20 @@ especially useful on machines with a relatively small number of registers and where memory load instructions take more than one cycle. @item -ffunction-sections -Place each function into its own section in the output file if the -target supports arbitrary sections. The function's name determines -the section's name in the output file. +@itemx -fdata-sections +Place each function or data item into its own section in the output +file if the target supports arbitrary sections. The name of the +function or the name of the data item determines the section's name +in the output file. -Use this option on systems where the linker can perform optimizations +Use these options on systems where the linker can perform optimizations to improve locality of reference in the instruction space. HPPA processors running HP-UX and Sparc processors running Solaris 2 have linkers with such optimizations. Other systems using the ELF object format as well as AIX may have these optimizations in the future. -Only use this option when there are significant benefits from doing -so. When you specify this option, the assembler and linker will +Only use these options when there are significant benefits from doing +so. When you specify these options, the assembler and linker will create larger object and executable files and will also be slower. You will not be able to use @code{gprof} on all systems if you specify this option and you may have problems with debugging if @@ -2395,13 +2469,16 @@ function calls, by emitting extra instructions to save and restore the registers around such calls. Such allocation is done only when it seems to result in better code than would otherwise be produced. -This option is enabled by default on certain machines, usually those -which have no call-preserved registers to use instead. +This option is always enabled by default on certain machines, usually +those which have no call-preserved registers to use instead. + +For all machines, optimization level 2 and higher enables this flag by +default. @item -funroll-loops Perform the optimization of loop unrolling. This is only done for loops whose number of iterations can be determined at compile time or run time. -@samp{-funroll-loop} implies both @samp{-fstrength-reduce} and +@samp{-funroll-loops} implies both @samp{-fstrength-reduce} and @samp{-frerun-cse-after-loop}. @item -funroll-all-loops @@ -2418,7 +2495,7 @@ Forces all general-induction variables in loops to be strength-reduced. @emph{Note:} When compiling programs written in Fortran, -@samp{-fmove-all-moveables} and @samp{-freduce-all-givs} are enabled +@samp{-fmove-all-movables} and @samp{-freduce-all-givs} are enabled by default when you use the optimizer. These options may generate better or worse code; results are highly @@ -2428,7 +2505,7 @@ These two options are intended to be removed someday, once they have helped determine the efficacy of various approaches to improving loop optimizations. -Please let us (@code{egcs@@egcs.cygnus.com} and @code{fortran@@gnu.org}) +Please let us (@code{gcc@@gcc.gnu.org} and @code{fortran@@gnu.org}) know how use of these options affects the performance of your production code. We're very interested in code that runs @emph{slower} @@ -2492,10 +2569,6 @@ int f() @{ @} @end example -This option is not enabled by default at any optimization level because -it is new and has yet to be subjected to thorough testing. You may -of course enable it manually with @samp{-fstrict-aliasing}. - @ifset INTERNALS Every language that wishes to perform language-specific alias analysis should define a function that computes, given an @code{tree} @@ -2504,17 +2577,6 @@ allowed to alias. For an example, see the C front-end function @code{c_get_alias_set}. @end ifset -@item -fstructure-noalias -Allows the compiler to assume that structure / varying array references -do not alias fixed scalars. - -Although this optimization is safe, GCC can occasionally lose track -of which references refer to scalars and which to structures, -leading it to perform unsafe transformations. Release 1.2 of EGCS -will incorporate changes which allow GCC to track the -scalar/structure distinction safely. Thus, the optimization will -always be same, and this option will likely be removed or will have -no effect. @end table @node Preprocessor Options @@ -2788,20 +2850,20 @@ mechanism when this option is specified. @cindex unresolved references and @code{-nodefaultlibs} One of the standard libraries bypassed by @samp{-nostdlib} and @samp{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines -that GNU CC uses to overcome shortcomings of particular machines, or special +that GCC uses to overcome shortcomings of particular machines, or special needs for some languages. @ifset INTERNALS -(@xref{Interface,,Interfacing to GNU CC Output}, for more discussion of +(@xref{Interface,,Interfacing to GCC Output}, for more discussion of @file{libgcc.a}.) @end ifset @ifclear INTERNALS -(@xref{Interface,,Interfacing to GNU CC Output,gcc.info,Porting GNU CC}, +(@xref{Interface,,Interfacing to GCC Output,gcc.info,Porting GCC}, for more discussion of @file{libgcc.a}.) @end ifclear In most cases, you need @file{libgcc.a} even when you want to avoid other standard libraries. In other words, when you specify @samp{-nostdlib} or @samp{-nodefaultlibs} you should usually specify @samp{-lgcc} as well. -This ensures that you have no unresolved references to internal GNU CC +This ensures that you have no unresolved references to internal GCC library subroutines. (For example, @samp{__main}, used to ensure C++ constructors will be called; @pxref{Collect2,,@code{collect2}}.) @@ -2826,7 +2888,7 @@ this option. @item -Xlinker @var{option} Pass @var{option} as an option to the linker. You can use this to -supply system-specific linker options which GNU CC does not know how to +supply system-specific linker options which GCC does not know how to recognize. If you want to pass an option that takes an argument, you must use @@ -2941,24 +3003,24 @@ are processed in order, from left to right. @cindex compiler version, specifying @cindex target machine, specifying -By default, GNU CC compiles code for the same type of machine that you +By default, GCC compiles code for the same type of machine that you are using. However, it can also be installed as a cross-compiler, to compile for some other type of machine. In fact, several different -configurations of GNU CC, for different target machines, can be +configurations of GCC, for different target machines, can be installed side by side. Then you specify which one to use with the @samp{-b} option. -In addition, older and newer versions of GNU CC can be installed side +In addition, older and newer versions of GCC can be installed side by side. One of them (probably the newest) will be the default, but you may sometimes wish to use another. @table @code @item -b @var{machine} The argument @var{machine} specifies the target machine for compilation. -This is useful when you have installed GNU CC as a cross-compiler. +This is useful when you have installed GCC as a cross-compiler. The value to use for @var{machine} is the same as was specified as the -machine type when configuring GNU CC as a cross-compiler. For +machine type when configuring GCC as a cross-compiler. For example, if a cross-compiler was configured with @samp{configure i386v}, meaning to compile for an 80386 running System V, then you would specify @samp{-b i386v} to run that cross compiler. @@ -2967,17 +3029,17 @@ When you do not specify @samp{-b}, it normally means to compile for the same type of machine that you are using. @item -V @var{version} -The argument @var{version} specifies which version of GNU CC to run. +The argument @var{version} specifies which version of GCC to run. This is useful when multiple versions are installed. For example, -@var{version} might be @samp{2.0}, meaning to run GNU CC version 2.0. +@var{version} might be @samp{2.0}, meaning to run GCC version 2.0. The default version, when you do not specify @samp{-V}, is the last -version of GNU CC that you installed. +version of GCC that you installed. @end table The @samp{-b} and @samp{-V} options actually work by controlling part of the file name used for the executable files and libraries used for -compilation. A given version of GNU CC, for a given target machine, is +compilation. A given version of GCC, for a given target machine, is normally kept in the directory @file{/usr/local/lib/gcc-lib/@var{machine}/@var{version}}.@refill Thus, sites can customize the effect of @samp{-b} or @samp{-V} either by @@ -3063,8 +3125,10 @@ that macro, which enables you to change the defaults. * H8/300 Options:: * SH Options:: * System V Options:: +* TMS320C3x/C4x Options:: * V850 Options:: * ARC Options:: +* NS32K Options:: @end menu @node M680x0 Options @@ -3192,13 +3256,13 @@ The @code{rtd} instruction is supported by the 68010, 68020, 68030, @item -malign-int @itemx -mno-align-int -Control whether GNU CC aligns @code{int}, @code{long}, @code{long long}, +Control whether GCC aligns @code{int}, @code{long}, @code{long long}, @code{float}, @code{double}, and @code{long double} variables on a 32-bit boundary (@samp{-malign-int}) or a 16-bit boundary (@samp{-mno-align-int}). Aligning variables on 32-bit boundaries produces code that runs somewhat faster on processors with 32-bit busses at the expense of more memory. -@strong{Warning:} if you use the @samp{-malign-int} switch, GNU CC will +@strong{Warning:} if you use the @samp{-malign-int} switch, GCC will align structures containing the above types differently than most published application binary interface specifications for the m68k. @@ -3259,7 +3323,7 @@ cross-compilation. The embedded targets @samp{sparc-*-aout} and @samp{-msoft-float} changes the calling convention in the output file; therefore, it is only useful if you compile @emph{all} of a program with this option. In particular, you need to compile @file{libgcc.a}, the -library that comes with GNU CC, with @samp{-msoft-float} in order for +library that comes with GCC, with @samp{-msoft-float} in order for this to work. @item -mhard-quad-float @@ -3304,7 +3368,7 @@ instructions (except for leaf functions) and is the normal mode of operation. @itemx -munaligned-doubles Assume that doubles have 8 byte alignment. This is the default. -With @samp{-munaligned-doubles}, GNU CC assumes that doubles have 8 byte +With @samp{-munaligned-doubles}, GCC assumes that doubles have 8 byte alignment only if they are contained in another type, or if they have an absolute address. Otherwise, it assumes they have 4 byte alignment. Specifying this option avoids some rare compatibility problems with code @@ -3326,7 +3390,7 @@ divide instructions which exist in SPARC v8 but not in SPARC v7. multiply, integer divide step and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC v7. -These options are deprecated and will be deleted in GNU CC 2.9. +These options are deprecated and will be deleted in a future GCC release. They have been replaced with @samp{-mcpu=xxx}. @item -mcypress @@ -3341,15 +3405,15 @@ With @samp{-msupersparc} the compiler optimizes code for the SuperSparc cpu, as used in the SparcStation 10, 1000 and 2000 series. This flag also enables use of the full SPARC v8 instruction set. -These options are deprecated and will be deleted in GNU CC 2.9. +These options are deprecated and will be deleted in a future GCC release. They have been replaced with @samp{-mcpu=xxx}. @item -mcpu=@var{cpu_type} Set the instruction set, register set, and instruction scheduling parameters for machine type @var{cpu_type}. Supported values for @var{cpu_type} are @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite}, -@samp{f930}, @samp{f934}, @samp{sparclet}, @samp{tsc701}, @samp{v9}, and -@samp{ultrasparc}. +@samp{hypersparc}, @samp{sparclite86x}, @samp{f930}, @samp{f934}, +@samp{sparclet}, @samp{tsc701}, @samp{v9}, and @samp{ultrasparc}. Default instruction scheduling parameters are used for values that select an architecture and not an implementation. These are @samp{v7}, @samp{v8}, @@ -3360,8 +3424,8 @@ implementations. @smallexample v7: cypress - v8: supersparc - sparclite: f930, f934 + v8: supersparc, hypersparc + sparclite: f930, f934, sparclite86x sparclet: tsc701 v9: ultrasparc @end smallexample @@ -3374,7 +3438,8 @@ option @samp{-mcpu=}@var{cpu_type} would. The same values for @samp{-mcpu=}@var{cpu_type} are used for @samp{-mtune=}@*@var{cpu_type}, though the only useful values are those that select a particular cpu implementation: @samp{cypress}, @samp{supersparc}, -@samp{f930}, @samp{f934}, @samp{tsc701}, @samp{ultrasparc}. +@samp{hypersparc}, @samp{f930}, @samp{f934}, @samp{sparclite86x}, +@samp{tsc701}, @samp{ultrasparc}. @item -malign-loops=@var{num} Align loops to a 2 raised to a @var{num} byte boundary. If @@ -3454,7 +3519,7 @@ Programs are statically linked, PIC is not supported. @item -mstack-bias @itemx -mno-stack-bias -With @samp{-mstack-bias}, GNU CC assumes that the stack pointer, and +With @samp{-mstack-bias}, GCC assumes that the stack pointer, and frame pointer if present, are offset by -2047 which must be added back when making stack frame references. Otherwise, assume no such offset is present. @@ -3621,11 +3686,16 @@ not pass @samp{-assert pure-text} to the linker when linking a shared object. @item -msoft-float @kindex -msoft-float Generate output containing library calls for floating point. -@strong{Warning:} the requisite libraries are not part of GNU CC. +@strong{Warning:} the requisite libraries are not part of GCC. Normally the facilities of the machine's usual C compiler are used, but this can't be done directly in cross-compilation. You must make your own arrangements to provide suitable library functions for cross-compilation. + +@item -mno-multm +@kindex -mno-multm +Do not generate multm or multmu instructions. This is useful for some embedded +systems which do not have trap handlers for these instructions. @end table @node ARM Options @@ -3725,7 +3795,7 @@ cross-compilation. @samp{-msoft-float} changes the calling convention in the output file; therefore, it is only useful if you compile @emph{all} of a program with this option. In particular, you need to compile @file{libgcc.a}, the -library that comes with GNU CC, with @samp{-msoft-float} in order for +library that comes with GCC, with @samp{-msoft-float} in order for this to work. @item -mlittle-endian @@ -3785,13 +3855,17 @@ suppresses this pass. The post-processor is never run when the compiler is built for cross-compilation. @item -mcpu=<name> +@itemx -mtune=<name> @kindex -mcpu= +@kindex -mtune= This specifies the name of the target ARM processor. GCC uses this name to determine what kind of instructions it can use when generating assembly code. Permissable names are: arm2, arm250, arm3, arm6, arm60, arm600, arm610, arm620, arm7, arm7m, arm7d, arm7dm, arm7di, arm7dmi, arm70, arm700, arm700i, arm710, arm710c, arm7100, arm7500, arm7500fe, -arm7tdmi, arm8, strongarm, strongarm110 +arm7tdmi, arm8, strongarm, strongarm110, strongarm1100, arm8, arm810, +arm9, arm9tdmi. @samp{-mtune=} is a synonym for @samp{-mcpue=} to +support older versions of GCC. @item -march=<name> @kindex -march= @@ -3802,9 +3876,12 @@ of the @samp{-mcpu=} option. Permissable names are: armv2, armv2a, armv3, armv3m, armv4, armv4t @item -mfpe=<number> +@itemx -mfp=<number> @kindex -mfpe= +@kindex -mfp= This specifes the version of the floating point emulation available on -the target. Permissable values are 2 and 3. +the target. Permissable values are 2 and 3. @samp{-mfp=} is a synonym +for @samp{-mfpe=} to support older versions of GCC. @item -mstructure-size-boundary=<n> @kindex -mstructure-size-boundary @@ -3819,6 +3896,12 @@ libraries compiled with the other value, if they exchange information using structures or unions. Programmers are encouraged to use the 32 value as future versions of the toolchain may default to this value. +@item -mabort-on-noreturn +@kindex -mabort-on-noreturn +@kindex -mnoabort-on-noreturn +Generate a call to the function abort at the end of a noreturn function. +It will be executed if the function tries to return. + @end table @node Thumb Options @@ -4055,7 +4138,7 @@ Control how function arguments are stored in stack frames. @samp{-moptimize-arg-area} saves space by optimizing them, but this conflicts with the 88open specifications. The opposite alternative, @samp{-mno-optimize-arg-area}, agrees with 88open standards. By default -GNU CC does not optimize the argument area. +GCC does not optimize the argument area. @item -mshort-data-@var{num} @kindex -mshort-data-@var{num} @@ -4115,7 +4198,7 @@ Which variant of the assembler syntax to emit. @samp{-msvr4} makes the C preprocessor recognize @samp{#pragma weak} that is used on System V release 4. @item -@samp{-msvr4} makes GNU CC issue additional declaration directives used in +@samp{-msvr4} makes GCC issue additional declaration directives used in SVr4. @end enumerate @@ -4186,7 +4269,7 @@ particular, the behavior of such a division with and without @cindex bit shift overflow (88k) @cindex large bit shifts (88k) Include code to detect bit-shifts of more than 31 bits; respectively, -trap such shifts or emit code to handle them properly. By default GNU CC +trap such shifts or emit code to handle them properly. By default GCC makes no special provision for large bit shifts. @item -mwarn-passed-structs @@ -4195,7 +4278,7 @@ makes no special provision for large bit shifts. Warn when a function passes a struct as an argument or result. Structure-passing conventions have changed during the evolution of the C language, and are often the source of portability problems. By default, -GNU CC issues no such warning. +GCC issues no such warning. @end table @node RS/6000 and PowerPC Options @@ -4223,7 +4306,7 @@ These @samp{-m} options are defined for the IBM RS/6000 and PowerPC: @kindex -mpowerpc-gpopt @kindex -mpowerpc-gfxopt @kindex -mpowerpc64 -GNU CC supports two related instruction set architectures for the +GCC supports two related instruction set architectures for the RS/6000 and PowerPC. The @dfn{POWER} instruction set are those instructions supported by the @samp{rios} chip set used in the original RS/6000 systems and the @dfn{PowerPC} instruction set is the @@ -4236,36 +4319,36 @@ register is included in processors supporting the POWER architecture. You use these options to specify which instructions are available on the processor you are using. The default value of these options is -determined when configuring GNU CC. Specifying the +determined when configuring GCC. Specifying the @samp{-mcpu=@var{cpu_type}} overrides the specification of these options. We recommend you use the @samp{-mcpu=@var{cpu_type}} option rather than the options listed above. -The @samp{-mpower} option allows GNU CC to generate instructions that +The @samp{-mpower} option allows GCC to generate instructions that are found only in the POWER architecture and to use the MQ register. -Specifying @samp{-mpower2} implies @samp{-power} and also allows GNU CC +Specifying @samp{-mpower2} implies @samp{-power} and also allows GCC to generate instructions that are present in the POWER2 architecture but not the original POWER architecture. -The @samp{-mpowerpc} option allows GNU CC to generate instructions that +The @samp{-mpowerpc} option allows GCC to generate instructions that are found only in the 32-bit subset of the PowerPC architecture. Specifying @samp{-mpowerpc-gpopt} implies @samp{-mpowerpc} and also allows -GNU CC to use the optional PowerPC architecture instructions in the +GCC to use the optional PowerPC architecture instructions in the General Purpose group, including floating-point square root. Specifying -@samp{-mpowerpc-gfxopt} implies @samp{-mpowerpc} and also allows GNU CC to +@samp{-mpowerpc-gfxopt} implies @samp{-mpowerpc} and also allows GCC to use the optional PowerPC architecture instructions in the Graphics group, including floating-point select. -The @samp{-mpowerpc64} option allows GNU CC to generate the additional +The @samp{-mpowerpc64} option allows GCC to generate the additional 64-bit instructions that are found in the full PowerPC64 architecture -and to treat GPRs as 64-bit, doubleword quantities. GNU CC defaults to +and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to @samp{-mno-powerpc64}. -If you specify both @samp{-mno-power} and @samp{-mno-powerpc}, GNU CC +If you specify both @samp{-mno-power} and @samp{-mno-powerpc}, GCC will use only the instructions in the common subset of both architectures plus some special AIX common-mode calls, and will not use the MQ register. Specifying both @samp{-mpower} and @samp{-mpowerpc} -permits GNU CC to use any instruction from either architecture and to +permits GCC to use any instruction from either architecture and to allow use of the MQ register; specify this for the Motorola MPC601. @item -mnew-mnemonics @@ -4277,10 +4360,10 @@ Select which mnemonics to use in the generated assembler code. defined for the PowerPC architecture, while @samp{-mold-mnemonics} requests the assembler mnemonics defined for the POWER architecture. Instructions defined in only one architecture have only one mnemonic; -GNU CC uses that mnemonic irrespective of which of these options is +GCC uses that mnemonic irrespective of which of these options is specified. -GNU CC defaults to the mnemonics appropriate for the architecture in +GCC defaults to the mnemonics appropriate for the architecture in use. Specifying @samp{-mcpu=@var{cpu_type}} sometimes overrides the value of these option. Unless you are building a cross-compiler, you should normally not specify either @samp{-mnew-mnemonics} or @@ -4292,13 +4375,13 @@ Set architecture type, register usage, choice of mnemonics, and instruction scheduling parameters for machine type @var{cpu_type}. Supported values for @var{cpu_type} are @samp{rs6000}, @samp{rios1}, @samp{rios2}, @samp{rsc}, @samp{601}, @samp{602}, @samp{603}, -@samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{power}, -@samp{power2}, @samp{powerpc}, @samp{403}, @samp{505}, @samp{801}, -@samp{821}, @samp{823}, and @samp{860} and @samp{common}. -@samp{-mcpu=power}, @samp{-mcpu=power2}, and @samp{-mcpu=powerpc} -specify generic POWER, POWER2 and pure PowerPC (i.e., not MPC601) -architecture machine types, with an appropriate, generic processor model -assumed for scheduling purposes.@refill +@samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{740}, +@samp{750}, @samp{power}, @samp{power2}, @samp{powerpc}, @samp{403}, +@samp{505}, @samp{801}, @samp{821}, @samp{823}, and @samp{860} and +@samp{common}. @samp{-mcpu=power}, @samp{-mcpu=power2}, and +@samp{-mcpu=powerpc} specify generic POWER, POWER2 and pure PowerPC +(i.e., not MPC601) architecture machine types, with an appropriate, +generic processor model assumed for scheduling purposes.@refill @c overfull hbox here --bob 22 jul96 @c original text between ignore ... end ignore @@ -4333,9 +4416,9 @@ enable the @samp{-mpowerpc} option and disable the @samp{-mpower} option. AIX versions 4 or greater selects @samp{-mcpu=common} by default, so that code will operate on all members of the RS/6000 and PowerPC -families. In that case, GNU CC will use only the instructions in the +families. In that case, GCC will use only the instructions in the common subset of both architectures plus some special AIX common-mode -calls, and will not use the MQ register. GNU CC assumes a generic +calls, and will not use the MQ register. GCC assumes a generic processor model for scheduling purposes. Specifying any of the options @samp{-mcpu=rios1}, @samp{-mcpu=rios2}, @@ -4364,25 +4447,25 @@ instruction scheduling parameters. @kindex -mminimal-toc Modify generation of the TOC (Table Of Contents), which is created for every executable file. The @samp{-mfull-toc} option is selected by -default. In that case, GNU CC will allocate at least one TOC entry for -each unique non-automatic variable reference in your program. GNU CC +default. In that case, GCC will allocate at least one TOC entry for +each unique non-automatic variable reference in your program. GCC will also place floating-point constants in the TOC. However, only 16,384 entries are available in the TOC. If you receive a linker error message that saying you have overflowed the available TOC space, you can reduce the amount of TOC space used with the @samp{-mno-fp-in-toc} and @samp{-mno-sum-in-toc} options. -@samp{-mno-fp-in-toc} prevents GNU CC from putting floating-point -constants in the TOC and @samp{-mno-sum-in-toc} forces GNU CC to +@samp{-mno-fp-in-toc} prevents GCC from putting floating-point +constants in the TOC and @samp{-mno-sum-in-toc} forces GCC to generate code to calculate the sum of an address and a constant at run-time instead of putting that sum into the TOC. You may specify one -or both of these options. Each causes GNU CC to produce very slightly +or both of these options. Each causes GCC to produce very slightly slower and larger code at the expense of conserving TOC space. If you still run out of space in the TOC even when you specify both of these options, specify @samp{-mminimal-toc} instead. This option causes -GNU CC to make only one TOC entry for every file. When you specify this -option, GNU CC will produce code that is slower and larger but which +GCC to make only one TOC entry for every file. When you specify this +option, GCC will produce code that is slower and larger but which uses extremely little TOC space. You may wish to use this option only on files that contain less frequently executed code. @refill @@ -4394,7 +4477,7 @@ Enable AIX 64-bit ABI and calling convention: 64-bit pointers, 64-bit @code{long} type, and the infrastructure needed to support them. Specifying @samp{-maix64} implies @samp{-mpowerpc64} and @samp{-mpowerpc}, while @samp{-maix32} disables the 64-bit ABI and -implies @samp{-mno-powerpc64}. GNU CC defaults to @samp{-maix32}. +implies @samp{-mno-powerpc64}. GCC defaults to @samp{-maix32}. @item -mxl-call @itemx -mno-xl-call @@ -4433,7 +4516,7 @@ option are incompatible. @kindex -msoft-float Generate code that does not use (uses) the floating-point register set. Software floating point emulation is provided if you use the -@samp{-msoft-float} option, and pass the option to GNU CC when linking. +@samp{-msoft-float} option, and pass the option to GCC when linking. @item -mmultiple @itemx -mno-multiple @@ -4442,17 +4525,20 @@ instructions and the store multiple word instructions. These instructions are generated by default on POWER systems, and not generated on PowerPC systems. Do not use @samp{-mmultiple} on little endian PowerPC systems, since those instructions do not work when the -processor is in little endian mode. +processor is in little endian mode. The exceptions are PPC740 and +PPC750 which permit the instructions usage in little endian mode. @item -mstring @itemx -mno-string @kindex -mstring -Generate code that uses (does not use) the load string instructions and the -store string word instructions to save multiple registers and do small block -moves. These instructions are generated by default on POWER systems, and not -generated on PowerPC systems. Do not use @samp{-mstring} on little endian -PowerPC systems, since those instructions do not work when the processor is in -little endian mode. +Generate code that uses (does not use) the load string instructions +and the store string word instructions to save multiple registers and +do small block moves. These instructions are generated by default on +POWER systems, and not generated on PowerPC systems. Do not use +@samp{-mstring} on little endian PowerPC systems, since those +instructions do not work when the processor is in little endian mode. +The exceptions are PPC740 and PPC750 which permit the instructions +usage in little endian mode. @item -mupdate @itemx -mno-update @@ -4652,7 +4738,9 @@ All modules should be compiled with the same @samp{-G @var{num}} value. @itemx -mno-regnames On System V.4 and embedded PowerPC systems do (do not) emit register names in the assembly language output using symbolic forms. + @end table + @node RT Options @subsection IBM RT Options @cindex RT options @@ -4712,11 +4800,15 @@ These @samp{-m} options are defined for the MIPS family of computers: @item -mcpu=@var{cpu type} Assume the defaults for the machine type @var{cpu type} when scheduling instructions. The choices for @var{cpu type} are @samp{r2000}, @samp{r3000}, -@samp{r4000}, @samp{r4400}, @samp{r4600}, and @samp{r6000}. While picking a -specific @var{cpu type} will schedule things appropriately for that -particular chip, the compiler will not generate any code that does not -meet level 1 of the MIPS ISA (instruction set architecture) without -the @samp{-mips2} or @samp{-mips3} switches being used. +@samp{r3900}, @samp{r4000}, @samp{r4100}, @samp{r4300}, @samp{r4400}, +@samp{r4600}, @samp{r4650}, @samp{r5000}, @samp{r6000}, @samp{r8000}, +and @samp{orion}. Additionally, the @samp{r2000}, @samp{r3000}, +@samp{r4000}, @samp{r5000}, and @samp{r6000} can be abbreviated as +@samp{r2k} (or @samp{r2K}), @samp{r3k}, etc. While picking a specific +@var{cpu type} will schedule things appropriately for that particular +chip, the compiler will not generate any code that does not meet level 1 +of the MIPS ISA (instruction set architecture) without a @samp{-mipsX} +or @samp{-mabi} switch being used. @item -mips1 Issue instructions from level 1 of the MIPS ISA. This is the default. @@ -4730,11 +4822,11 @@ ISA level. @item -mips3 Issue instructions from level 3 of the MIPS ISA (64 bit instructions). @samp{r4000} is the default @var{cpu type} at this ISA level. -This option does not change the sizes of any of the C data types. @item -mips4 -Issue instructions from level 4 of the MIPS ISA. @samp{r8000} is the -default @var{cpu type} at this ISA level. +Issue instructions from level 4 of the MIPS ISA (conditional move, +prefetch, enhanced FPU instructions). @samp{r8000} is the default +@var{cpu type} at this ISA level. @item -mfp32 Assume that 32 32-bit floating point registers are available. This is @@ -4753,18 +4845,36 @@ Assume that 32 64-bit general purpose registers are available. This is the default when the @samp{-mips3} option is used. @item -mint64 -Types long, int, and pointer are 64 bits. This works only if @samp{-mips3} -is also specified. +Force int and long types to be 64 bits wide. See @samp{-mlong32} for an +explanation of the default, and the width of pointers. @item -mlong64 -Types long and pointer are 64 bits, and type int is 32 bits. -This works only if @samp{-mips3} is also specified. +Force long types to be 64 bits wide. See @samp{-mlong32} for an +explanation of the default, and the width of pointers. -@itemx -mabi=32 +@item -mlong32 +Force long, int, and pointer types to be 32 bits wide. + +If none of @samp{-mlong32}, @samp{-mlong64}, or @samp{-mint64} are set, +the size of ints, longs, and pointers depends on the ABI and ISA choosen. +For @samp{-mabi=32}, and @samp{-mabi=n32}, ints and longs are 32 bits +wide. For @samp{-mabi=64}, ints are 32 bits, and longs are 64 bits wide. +For @samp{-mabi=eabi} and either @samp{-mips1} or @samp{-mips2}, ints +and longs are 32 bits wide. For @samp{-mabi=eabi} and higher ISAs, ints +are 32 bits, and longs are 64 bits wide. The width of pointer types is +the smaller of the width of longs or the width of general purpose +registers (which in turn depends on the ISA). + +@item -mabi=32 +@itemx -mabi=o64 @itemx -mabi=n32 @itemx -mabi=64 @itemx -mabi=eabi -Generate code for the indicated ABI. +Generate code for the indicated ABI. The default instruction level is +@samp{-mips1} for @samp{32}, @samp{-mips3} for @samp{n32}, and +@samp{-mips4} otherwise. Conversely, with @samp{-mips1} or +@samp{-mips2}, the default ABI is @samp{32}; otherwise, the default ABI +is @samp{64}. @item -mmips-as Generate code for the MIPS assembler, and invoke @file{mips-tfile} to @@ -4830,7 +4940,7 @@ prevents compilation. @item -msoft-float Generate output containing library calls for floating point. -@strong{Warning:} the requisite libraries are not part of GNU CC. +@strong{Warning:} the requisite libraries are not part of GCC. Normally the facilities of the machine's usual C compiler are used, but this can't be done directly in cross-compilation. You must make your own arrangements to provide suitable library functions for @@ -4889,6 +4999,14 @@ as on the @samp{r4650} chip. Turns on @samp{-msingle-float}, @samp{-mmad}, and, at least for now, @samp{-mcpu=r4650}. +@item -mips16 +@itemx -mno-mips16 +Enable 16-bit instructions. + +@item -mentry +Use the entry and exit pseudo ops. This option can only be used with +@samp{-mips16}. + @item -EL Compile code for the processor in little endian mode. The requisite libraries are assumed to exist. @@ -4932,25 +5050,31 @@ These @samp{-m} options are defined for the i386 family of computers: @table @code @item -mcpu=@var{cpu type} Assume the defaults for the machine type @var{cpu type} when scheduling -instructions. The choices for @var{cpu type} are: @samp{i386}, -@samp{i486}, @samp{i586} (@samp{pentium}), @samp{pentium}, @samp{i686} -(@samp{pentiumpro}) and @samp{pentiumpro}. While picking a specific -@var{cpu type} will schedule things appropriately for that particular -chip, the compiler will not generate any code that does not run on the -i386 without the @samp{-march=@var{cpu type}} option being used. +instructions. The choices for @var{cpu type} are: + +@multitable @columnfractions .20 .20 .20 .20 +@item @samp{i386} @tab @samp{i486} @tab @samp{i586} @tab @samp{i686} +@item @samp{pentium} @tab @samp{pentiumpro} @tab @samp{k6} +@end multitable + +While picking a specific @var{cpu type} will schedule things appropriately +for that particular chip, the compiler will not generate any code that +does not run on the i386 without the @samp{-march=@var{cpu type}} option +being used. @samp{i586} is equivalent to @samp{pentium} and @samp{i686} +is equivalent to @samp{pentiumpro}. @samp{k6} is the AMD chip as +opposed to the Intel ones. @item -march=@var{cpu type} Generate instructions for the machine type @var{cpu type}. The choices -for @var{cpu type} are: @samp{i386}, @samp{i486}, @samp{pentium}, and -@samp{pentiumpro}. Specifying @samp{-march=@var{cpu type}} implies -@samp{-mcpu=@var{cpu type}}. +for @var{cpu type} are the same as for @samp{-mcpu}. Moreover, +specifying @samp{-march=@var{cpu type}} implies @samp{-mcpu=@var{cpu type}}. @item -m386 @itemx -m486 @itemx -mpentium @itemx -mpentiumpro Synonyms for -mcpu=i386, -mcpu=i486, -mcpu=pentium, and -mcpu=pentiumpro -respectively. +respectively. These synonyms are deprecated. @item -mno-ieee-fp @itemx -mieee-fp @@ -4960,7 +5084,7 @@ comparison is unordered. @item -msoft-float Generate output containing library calls for floating point. -@strong{Warning:} the requisite libraries are not part of GNU CC. +@strong{Warning:} the requisite libraries are not part of GCC. Normally the facilities of the machine's usual C compiler are used, but this can't be done directly in cross-compilation. You must make your own arrangements to provide suitable library functions for @@ -4990,7 +5114,7 @@ also use the @samp{-ffast-math} switch. @item -malign-double @itemx -mno-align-double -Control whether GNU CC aligns @code{double}, @code{long double}, and +Control whether GCC aligns @code{double}, @code{long double}, and @code{long long} variables on a two word boundary or a one word boundary. Aligning @code{double} variables on a two word boundary will produce code that runs somewhat faster on a @samp{Pentium} at the @@ -5002,13 +5126,13 @@ the published application binary interface specifications for the 386. @item -msvr3-shlib @itemx -mno-svr3-shlib -Control whether GNU CC places uninitialized locals into @code{bss} or +Control whether GCC places uninitialized locals into @code{bss} or @code{data}. @samp{-msvr3-shlib} places these locals into @code{bss}. These options are meaningful only on System V Release 3. @item -mno-wide-multiply @itemx -mwide-multiply -Control whether GNU CC uses the @code{mul} and @code{imul} that produce +Control whether GCC uses the @code{mul} and @code{imul} that produce 64 bit results in @code{eax:edx} from 32 bit operands to do @code{long long} multiplies and 32-bit division by constants. @@ -5081,6 +5205,31 @@ than 8 bytes away. Align the start of functions to a 2 raised to @var{num} byte boundary. If @samp{-malign-functions} is not specified, the default is 2 if optimizing for a 386, and 4 if optimizing for a 486. + +@item -mpreferred-stack-boundary=@var{num} +Attempt to keep the stack boundary aligned to a 2 raised to @var{num} +byte boundary. If @samp{-mpreferred-stack-boundary} is not specified, +the default is 4 (16 bytes or 128 bits). + +The stack is required to be aligned on a 4 byte boundary. On Pentium +and PentiumPro, @code{double} and @code{long double} values should be +aligned to an 8 byte boundary (see @samp{-malign-double}) or suffer +significant run time performance penalties. On Pentium III, the +Streaming SIMD Extention (SSE) data type @code{__m128} suffers similar +penalties if it is not 16 byte aligned. + +To ensure proper alignment of this values on the stack, the stack boundary +must be as aligned as that required by any value stored on the stack. +Further, every function must be generated such that it keeps the stack +aligned. Thus calling a function compiled with a higher preferred +stack boundary from a function compiled with a lower preferred stack +boundary will most likely misalign the stack. It is recommended that +libraries that use callbacks always use the default setting. + +This extra alignment does consume extra stack space. Code that is sensitive +to stack space usage, such as embedded systems and operating system kernels, +may want to reduce the preferred alignment to +@samp{-mpreferred-stack-boundary=2}. @end table @node HPPA Options @@ -5090,11 +5239,23 @@ for a 386, and 4 if optimizing for a 486. These @samp{-m} options are defined for the HPPA family of computers: @table @code -@item -mpa-risc-1-0 -Generate code for a PA 1.0 processor. +@item -march=@var{architecture type} +Generate code for the specified architecture. The choices for +@var{architecture type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA +1.1, and @samp{2.0} for PA 2.0 processors. Refer to +@file{/usr/lib/sched.models} on an HP-UX system to determine the proper +architecture option for your machine. Code compiled for lower numbered +architectures will run on higher numbered architectures, but not the +other way around. + +PA 2.0 support currently requires gas snapshot 19990413 or later. The +next release of binutils (current is 2.9.1) will probably contain PA 2.0 +support. -@item -mpa-risc-1-1 -Generate code for a PA 1.1 processor. +@item -mpa-risc-1-0 +@itemx -mpa-risc-1-1 +@itemx -mpa-risc-2-0 +Synonyms for -march=1.0, -march=1.1, and -march=2.0 respectively. @item -mbig-switch Generate code suitable for big switch tables. Use this option only if @@ -5147,13 +5308,10 @@ Enable the use of assembler directives only GAS understands. @item -mschedule=@var{cpu type} Schedule code according to the constraints for the machine type -@var{cpu type}. The choices for @var{cpu type} are @samp{700} for -7@var{n}0 machines, @samp{7100} for 7@var{n}5 machines, and @samp{7100LC} -for 7@var{n}2 machines. @samp{7100} is the default for @var{cpu type}. - -Note the @samp{7100LC} scheduling information is incomplete and using -@samp{7100LC} often leads to bad schedules. For now it's probably best -to use @samp{7100} instead of @samp{7100LC} for the 7@var{n}2 machines. +@var{cpu type}. The choices for @var{cpu type} are @samp{700} +@samp{7100}, @samp{7100LC}, @samp{7200}, and @samp{8000}. Refer to +@file{/usr/lib/sched.models} on an HP-UX system to determine the +proper scheduling option for your machine. @item -mlinker-opt Enable the optimization pass in the HPUX linker. Note this makes symbolic @@ -5172,7 +5330,7 @@ does provide software floating point support. @samp{-msoft-float} changes the calling convention in the output file; therefore, it is only useful if you compile @emph{all} of a program with this option. In particular, you need to compile @file{libgcc.a}, the -library that comes with GNU CC, with @samp{-msoft-float} in order for +library that comes with GCC, with @samp{-msoft-float} in order for this to work. @end table @@ -5249,6 +5407,15 @@ Do not permit (do permit) unaligned accesses. @item -mold-align Enable structure-alignment compatibility with Intel's gcc release version 1.3 (based on gcc 1.37). This option implies @samp{-mstrict-align}. + +@item -mlong-double-64 +Implement type @samp{long double} as 64-bit floating point numbers. +Without the option @samp{long double} is implemented by 80-bit +floating point numbers. The only reason we have it because there is +no 128-bit @samp{long double} support in @samp{fp-bit.c} yet. So it +is only useful for people using soft-float targets. Otherwise, we +should recommend against use of it. + @end table @node DEC Alpha Options @@ -5375,13 +5542,14 @@ Dynamic rounding mode. A field in the floating point control register (@var{fpcr}, see Alpha architecture reference manual) controls the rounding mode in effect. The C library initializes this register for rounding towards plus infinity. Thus, unless your program modifies the -@var{fpcr}, @samp{d} corresponds to round towards plus infinity.@end table +@var{fpcr}, @samp{d} corresponds to round towards plus infinity. +@end table @item -mtrap-precision=@var{trap precision} In the Alpha architecture, floating point traps are imprecise. This means without software assistance it is impossible to recover from a floating trap and program execution normally needs to be terminated. -GNU CC can generate code that can assist operating system trap handlers +GCC can generate code that can assist operating system trap handlers in determining the exact location that caused a floating point trap. Depending on the requirements of an application, different levels of precisions can be selected: @@ -5412,12 +5580,12 @@ generated assembly file. Under DEC Unix, this has the effect that IEEE-conformant math library routines will be linked in. @item -mbuild-constants -Normally GNU CC examines a 32- or 64-bit integer constant to +Normally GCC examines a 32- or 64-bit integer constant to see if it can construct it from smaller constants in two or three instructions. If it cannot, it will output the constant as a literal and generate code to load it from the data segment at runtime. -Use this option to require GNU CC to construct @emph{all} integer constants +Use this option to require GCC to construct @emph{all} integer constants using code, even if it takes more instructions (the maximum is six). You would typically use this option to build a shared library dynamic @@ -5435,19 +5603,19 @@ assembler (@samp{-malpha-as}) or by the GNU assembler @samp{-mgas}. @itemx -mno-cix @itemx -mmax @itemx -mno-max -Indicate whether GNU CC should generate code to use the optional BWX, +Indicate whether GCC should generate code to use the optional BWX, CIX, and MAX instruction sets. The default is to use the instruction sets supported by the CPU type specified via @samp{-mcpu=} option or that -of the CPU on which GNU CC was built if none was specified. +of the CPU on which GCC was built if none was specified. @item -mcpu=@var{cpu_type} Set the instruction set, register set, and instruction scheduling parameters for machine type @var{cpu_type}. You can specify either the -@samp{EV} style name or the corresponding chip number. GNU CC +@samp{EV} style name or the corresponding chip number. GCC supports scheduling parameters for the EV4 and EV5 family of processors and will choose the default values for the instruction set from the processor you specify. If you do not specify a processor type, -GNU CC will default to the processor on which the compiler was built. +GCC will default to the processor on which the compiler was built. Supported values for @var{cpu_type} are @@ -5508,7 +5676,7 @@ These @samp{-m} options are defined for the Clipper implementations: @item -mc300 Produce code for a C300 Clipper processor. This is the default. -@itemx -mc400 +@item -mc400 Produce code for a C400 Clipper processor i.e. use floating point registers f8..f15. @end table @@ -5604,6 +5772,130 @@ The assembler uses this option. @c the generic assembler that comes with Solaris takes just -Ym. @end table +@node TMS320C3x/C4x Options +@subsection TMS320C3x/C4x Options +@cindex TMS320C3x/C4x Options + +These @samp{-m} options are defined for TMS320C3x/C4x implementations: + +@table @code + +@item -mcpu=@var{cpu_type} +Set the instruction set, register set, and instruction scheduling +parameters for machine type @var{cpu_type}. Supported values for +@var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and +@samp{c44}. The default is @samp{c40} to generate code for the +TMS320C40. + +@item -mbig-memory +@item -mbig +@itemx -msmall-memory +@itemx -msmall +Generates code for the big or small memory model. The small memory +model assumed that all data fits into one 64K word page. At run-time +the data page (DP) register must be set to point to the 64K page +containing the .bss and .data program sections. The big memory model is +the default and requires reloading of the DP register for every direct +memory access. + +@item -mbk +@itemx -mno-bk +Allow (disallow) allocation of general integer operands into the block +count register BK. + +@item -mdb +@itemx -mno-db +Enable (disable) generation of code using decrement and branch, +DBcond(D), instructions. This is enabled by default for the C4x. To be +on the safe side, this is disabled for the C3x, since the maximum +iteration count on the C3x is 2^23 + 1 (but who iterates loops more than +2^23 times on the C3x?). Note that GCC will try to reverse a loop so +that it can utilise the decrement and branch instruction, but will give +up if there is more than one memory reference in the loop. Thus a loop +where the loop counter is decremented can generate slightly more +efficient code, in cases where the RPTB instruction cannot be utilised. + +@item -mdp-isr-reload +@itemx -mparanoid +Force the DP register to be saved on entry to an interrupt service +routine (ISR), reloaded to point to the data section, and restored on +exit from the ISR. This should not be required unless someone has +violated the small memory model by modifying the DP register, say within +an object library. + +@item -mmpyi +@itemx -mno-mpyi +For the C3x use the 24-bit MPYI instruction for integer multiplies +instead of a library call to guarantee 32-bit results. Note that if one +of the operands is a constant, then the multiplication will be performed +using shifts and adds. If the -mmpyi option is not specified for the C3x, +then squaring operations are performed inline instead of a library call. + +@item -mfast-fix +@itemx -mno-fast-fix +The C3x/C4x FIX instruction to convert a floating point value to an +integer value chooses the nearest integer less than or equal to the +floating point value rather than to the nearest integer. Thus if the +floating point number is negative, the result will be incorrectly +truncated an additional code is necessary to detect and correct this +case. This option can be used to disable generation of the additional +code required to correct the result. + +@item -mrptb +@itemx -mno-rptb +Enable (disable) generation of repeat block sequences using the RPTB +instruction for zero overhead looping. The RPTB construct is only used +for innermost loops that do not call functions or jump across the loop +boundaries. There is no advantage having nested RPTB loops due to the +overhead required to save and restore the RC, RS, and RE registers. +This is enabled by default with -O2. + +@item -mrpts=@var{count} +@itemx -mno-rpts +Enable (disable) the use of the single instruction repeat instruction +RPTS. If a repeat block contains a single instruction, and the loop +count can be guaranteed to be less than the value @var{count}, GCC will +emit a RPTS instruction instead of a RPTB. If no value is specified, +then a RPTS will be emitted even if the loop count cannot be determined +at compile time. Note that the repeated instruction following RPTS does +not have to be reloaded from memory each iteration, thus freeing up the +CPU buses for oeprands. However, since interrupts are blocked by this +instruction, it is disabled by default. + +@item -mloop-unsigned +@itemx -mno-loop-unsigned +The maximum iteration count when using RPTS and RPTB (and DB on the C40) +is 2^31 + 1 since these instructions test if the iteration count is +negative to terminate the loop. If the iteration count is unsigned +there is a possibility than the 2^31 + 1 maximum iteration count may be +exceeded. This switch allows an unsigned iteration count. + +@item -mti +Try to emit an assembler syntax that the TI assembler (asm30) is happy +with. This also enforces compatibility with the API employed by the TI +C3x C compiler. For example, long doubles are passed as structures +rather than in floating point registers. + +@item -mregparm +@itemx -mmemparm +Generate code that uses registers (stack) for passing arguments to functions. +By default, arguments are passed in registers where possible rather +than by pushing arguments on to the stack. + +@item -mparallel-insns +@itemx -mno-parallel-insns +Allow the generation of parallel instructions. This is enabled by +default with -O2. + +@item -mparallel-mpy +@itemx -mno-parallel-mpy +Allow the generation of MPY||ADD and MPY||SUB parallel instructions, +provided -mparallel-insns is also specified. These instructions have +tight register constraints which can pessimize the code generation +of large functions. + +@end table + @node V850 Options @subsection V850 Options @cindex V850 Options @@ -5686,8 +5978,8 @@ Which variants are supported depend on the configuration. All variants support @samp{-mcpu=base}, this is the default. @item -mtext=@var{text section} -@item -mdata=@var{data section} -@item -mrodata=@var{readonly data section} +@itemx -mdata=@var{data section} +@itemx -mrodata=@var{readonly data section} Put functions, data, and readonly data in @var{text section}, @var{data section}, and @var{readonly data section} respectively by default. This can be overridden with the @code{section} attribute. @@ -5695,6 +5987,121 @@ by default. This can be overridden with the @code{section} attribute. @end table +@node NS32K Options +@subsection NS32K Options +@cindex NS32K options + +These are the @samp{-m} options defined for the 32000 series. The default +values for these options depends on which style of 32000 was selected when +the compiler was configured; the defaults for the most common choices are +given below. + +@table @code +@item -m32032 +@itemx -m32032 +Generate output for a 32032. This is the default +when the compiler is configured for 32032 and 32016 based systems. + +@item -m32332 +@itemx -m32332 +Generate output for a 32332. This is the default +when the compiler is configured for 32332-based systems. + +@item -m32532 +@itemx -m32532 +Generate output for a 32532. This is the default +when the compiler is configured for 32532-based systems. + +@item -m32081 +Generate output containing 32081 instructions for floating point. +This is the default for all systems. + +@item -m32381 +Generate output containing 32381 instructions for floating point. This +also implies @samp{-m32081}. The 32381 is only compatible with the 32332 +and 32532 cpus. This is the default for the pc532-netbsd configuration. + +@item -mmulti-add +Try and generate multiply-add floating point instructions @code{polyF} +and @code{dotF}. This option is only available if the @samp{-m32381} +option is in effect. Using these instructions requires changes to to +register allocation which generally has a negative impact on +performance. This option should only be enabled when compiling code +particularly likely to make heavy use of multiply-add instructions. + +@item -mnomulti-add +Do not try and generate multiply-add floating point instructions +@code{polyF} and @code{dotF}. This is the default on all platforms. + +@item -msoft-float +Generate output containing library calls for floating point. +@strong{Warning:} the requisite libraries may not be available. + +@item -mnobitfield +Do not use the bit-field instructions. On some machines it is faster to +use shifting and masking operations. This is the default for the pc532. + +@item -mbitfield +Do use the bit-field instructions. This is the default for all platforms +except the pc532. + +@item -mrtd +Use a different function-calling convention, in which functions +that take a fixed number of arguments return pop their +arguments on return with the @code{ret} instruction. + +This calling convention is incompatible with the one normally +used on Unix, so you cannot use it if you need to call libraries +compiled with the Unix compiler. + +Also, you must provide function prototypes for all functions that +take variable numbers of arguments (including @code{printf}); +otherwise incorrect code will be generated for calls to those +functions. + +In addition, seriously incorrect code will result if you call a +function with too many arguments. (Normally, extra arguments are +harmlessly ignored.) + +This option takes its name from the 680x0 @code{rtd} instruction. + + +@item -mregparam +Use a different function-calling convention where the first two arguments +are passed in registers. + +This calling convention is incompatible with the one normally +used on Unix, so you cannot use it if you need to call libraries +compiled with the Unix compiler. + +@item -mnoregparam +Do not pass any arguments in registers. This is the default for all +targets. + +@item -msb +It is OK to use the sb as an index register which is always loaded with +zero. This is the default for the pc532-netbsd target. + +@item -mnosb +The sb register is not available for use or has not been initialized to +zero by the run time system. This is the default for all targets except +the pc532-netbsd. It is also implied whenever @samp{-mhimem} or +@samp{-fpic} is set. + +@item -mhimem +Many ns32000 series addressing modes use displacements of up to 512MB. +If an address is above 512MB then displacements from zero can not be used. +This option causes code to be generated which can be loaded above 512MB. +This may be useful for operating systems or ROM code. + +@item -mnohimem +Assume code will be loaded in the first 512MB of virtual address space. +This is the default for all platforms. + + +@end table + + @node Code Gen Options @section Options for Code Generation Conventions @@ -5713,9 +6120,12 @@ it. @table @code @item -fexceptions -Enable exception handling, and generate extra code needed to propagate -exceptions. If you do not specify this option, GNU CC enables it by -default for languages like C++ that normally require exception handling, +Enable exception handling. Generates extra code needed to propagate +exceptions. For some targets, this implies generation of frame unwind +information for all functions. This can produce significant data size +overhead, although it does not affect execution. +If you do not specify this option, it is enabled by +default for languages like C++ which normally require exception handling, and disabled for languages like C that do not normally require it. However, when compiling C code that needs to interoperate properly with exception handlers written in C++, you may need to enable this option. @@ -5726,7 +6136,7 @@ programs that don't use exception handling. Return ``short'' @code{struct} and @code{union} values in memory like longer ones, rather than in registers. This convention is less efficient, but it has the advantage of allowing intercallability between -GNU CC-compiled files and files compiled with other compilers. +GCC-compiled files and files compiled with other compilers. The precise convention for returning structures in memory depends on the target configuration macros. @@ -5740,9 +6150,9 @@ returned in registers when possible. This is more efficient for small structures than @samp{-fpcc-struct-return}. If you specify neither @samp{-fpcc-struct-return} nor its contrary -@samp{-freg-struct-return}, GNU CC defaults to whichever convention is -standard for the target. If there is no standard convention, GNU CC -defaults to @samp{-fpcc-struct-return}, except on targets where GNU CC +@samp{-freg-struct-return}, GCC defaults to whichever convention is +standard for the target. If there is no standard convention, GCC +defaults to @samp{-fpcc-struct-return}, except on targets where GCC is the principal compiler. In those cases, we can choose the standard, and we chose the more efficient register return alternative. @@ -5778,7 +6188,7 @@ destructors) in the form used by the GNU linker (on systems where the GNU linker is the standard method of handling them). Use this option when you want to use a non-GNU linker, which also requires using the @code{collect2} program to make sure the system linker includes -constructors and destructors. (@code{collect2} is included in the GNU CC +constructors and destructors. (@code{collect2} is included in the GCC distribution.) For systems which @emph{must} use @code{collect2}, the compiler driver @code{gcc} is configured to do this automatically. @@ -5804,7 +6214,11 @@ Consider all memory references through pointers to be volatile. @item -fvolatile-global Consider all memory references to extern and global data items to -be volatile. +be volatile. GCC does not consider static data items to be volatile +because of this switch. + +@item -fvolatile-static +Consider all memory references to static data to be volatile. @item -fpic @cindex global offset table @@ -5813,7 +6227,7 @@ Generate position-independent code (PIC) suitable for use in a shared library, if supported for the target machine. Such code accesses all constant addresses through a global offset table (GOT). The dynamic loader resolves the GOT entries when the program starts (the dynamic -loader is not part of GNU CC; it is part of the operating system). If +loader is not part of GCC; it is part of the operating system). If the GOT size for the linked executable exceeds a machine-specific maximum size, you get an error message from the linker indicating that @samp{-fpic} does not work; in that case, recompile with @samp{-fPIC} @@ -5821,7 +6235,7 @@ instead. (These maximums are 16k on the m88k, 8k on the Sparc, and 32k on the m68k and RS/6000. The 386 has no such limit.) Position-independent code requires special support, and therefore works -only on certain machines. For the 386, GNU CC supports PIC for System V +only on certain machines. For the 386, GCC supports PIC for System V but not for the Sun 386i. Code generated for the IBM RS/6000 is always position-independent. @@ -5852,9 +6266,9 @@ clobbered by function calls. It may be allocated for temporaries or variables that do not live across a call. Functions compiled this way will not save and restore the register @var{reg}. -Use of this flag for a register that has a fixed pervasive role in the -machine's execution model, such as the stack pointer or frame pointer, -will produce disastrous results. +It is an error to used this flag with the frame pointer or stack pointer. +Use of this flag for other registers that have fixed pervasive roles in +the machine's execution model will produce disastrous results. This flag does not have a negative form, because it specifies a three-way choice. @@ -5865,9 +6279,9 @@ functions. It may be allocated even for temporaries or variables that live across a call. Functions compiled this way will save and restore the register @var{reg} if they use it. -Use of this flag for a register that has a fixed pervasive role in the -machine's execution model, such as the stack pointer or frame pointer, -will produce disastrous results. +It is an error to used this flag with the frame pointer or stack pointer. +Use of this flag for other registers that have fixed pervasive roles in +the machine's execution model will produce disastrous results. A different sort of disaster will result from the use of this flag for a register in which function values may be returned. @@ -5881,29 +6295,51 @@ not want to use this option, since it makes the code suboptimal, and the offsets of structure members won't agree with system libraries. @item -fcheck-memory-usage -Generate extra code to check each memory access. GNU CC will generate +Generate extra code to check each memory access. GCC will generate code that is suitable for a detector of bad memory accesses such as -@file{Checker}. If you specify this option, you can not use the -@code{asm} or @code{__asm__} keywords. +@file{Checker}. + +Normally, you should compile all, or none, of your code with this option. + +If you do mix code compiled with and without this option, +you must ensure that all code that has side effects +and that is called by code compiled with this option +is, itself, compiled with this option. +If you do not, you might get erroneous messages from the detector. -You must also specify this option when you compile functions you call that -have side effects. If you do not, you may get erroneous messages from -the detector. Normally, you should compile all your code with this option. If you use functions from a library that have side-effects (such as -@code{read}), you may not be able to recompile the library and +@code{read}), you might not be able to recompile the library and specify this option. In that case, you can enable the -@samp{-fprefix-function-name} option, which requests GNU CC to encapsulate +@samp{-fprefix-function-name} option, which requests GCC to encapsulate your code and make other functions look as if they were compiled with @samp{-fcheck-memory-usage}. This is done by calling ``stubs'', which are provided by the detector. If you cannot find or build -stubs for every function you call, you may have to specify +stubs for every function you call, you might have to specify @samp{-fcheck-memory-usage} without @samp{-fprefix-function-name}. +If you specify this option, you can not use the @code{asm} or +@code{__asm__} keywords in functions with memory checking enabled. The +compiler cannot understand what the @code{asm} statement will do, and +therefore cannot generate the appropriate code, so it is rejected. +However, the function attribute @code{no_check_memory_usage} will +disable memory checking within a function, and @code{asm} statements can +be put inside such functions. Inline expansion of a non-checked +function within a checked function is permitted; the inline function's +memory accesses won't be checked, but the rest will. + +If you move your @code{asm} statements to non-checked inline functions, +but they do access memory, you can add calls to the support code in your +inline function, to indicate any reads, writes, or copies being done. +These calls would be similar to those done in the stubs described above. + +@c FIXME: The support-routine interface is defined by the compiler and +@c should be documented! + @item -fprefix-function-name -Request GNU CC to add a prefix to the symbols generated for function names. -GNU CC adds a prefix to the names of functions defined as well as +Request GCC to add a prefix to the symbols generated for function names. +GCC adds a prefix to the names of functions defined as well as functions called. Code compiled with this option and code compiled -without the option can't be linked together, unless or stubs are used. +without the option can't be linked together, unless stubs are used. If you compile the following code with @samp{-fprefix-function-name} @example @@ -5912,12 +6348,11 @@ void foo (int a) @{ return bar (a + 5); - @} @end example @noindent -GNU CC will compile the code as if it was written: +GCC will compile the code as if it was written: @example extern void prefix_bar (int); void @@ -5928,6 +6363,41 @@ prefix_foo (int a) @end example This option is designed to be used with @samp{-fcheck-memory-usage}. +@item -finstrument-functions +Generate instrumentation calls for entry and exit to functions. Just +after function entry and just before function exit, the following +profiling functions will be called with the address of the current +function and its call site. (On some platforms, +@code{__builtin_return_address} does not work beyond the current +function, so the call site information may not be available to the +profiling functions otherwise.) + +@example +void __cyg_profile_func_enter (void *this_fn, void *call_site); +void __cyg_profile_func_exit (void *this_fn, void *call_site); +@end example + +The first argument is the address of the start of the current function, +which may be looked up exactly in the symbol table. + +This instrumentation is also done for functions expanded inline in other +functions. The profiling calls will indicate where, conceptually, the +inline function is entered and exited. This means that addressable +versions of such functions must be available. If all your uses of a +function are expanded inline, this may mean an additional expansion of +code size. If you use @samp{extern inline} in your C code, an +addressable version of such functions must be provided. (This is +normally the case anyways, but if you get lucky and the optimizer always +expands the functions inline, you might have gotten away without +providing static copies.) + +A function may be given the attribute @code{no_instrument_function}, in +which case this instrumentation will not be done. This can be used, for +example, for the profiling functions listed above, high-priority +interrupt routines, and any functions from which the profiling functions +cannot safely be called (perhaps signal handlers, if the profiling +routines generate output or allocate memory). + @item -fstack-check Generate code to verify that you do not go beyond the boundary of the stack. You should specify this flag if you are running in an @@ -5935,32 +6405,6 @@ environment with multiple threads, but only rarely need to specify it in a single-threaded environment since stack overflow is automatically detected on nearly all systems if there is only one stack. -@item -fexceptions -Enable exception handling. For some targets, this implies -generation of frame unwind information for all functions, which can produce -significant data size overhead, though it does not affect execution. - -This option is on by default for languages that support exception -handling (such as C++), and off for those that don't (such as C). - -@item +e0 -@itemx +e1 -Control whether virtual function definitions in classes are used to -generate code, or only to define interfaces for their callers. (C++ -only). - -These options are provided for compatibility with @code{cfront} 1.x -usage; the recommended alternative GNU C++ usage is in flux. @xref{C++ -Interface,,Declarations and Definitions in One Header}. - -With @samp{+e0}, virtual function definitions in classes are declared -@code{extern}; the declaration is used only as an interface -specification, not to generate code for the virtual functions (in this -compilation). - -With @samp{+e1}, G++ actually generates the code implementing virtual -functions defined in the code, and makes them publicly visible. - @cindex aliasing of parameters @cindex parameters, aliased @item -fargument-alias @@ -5978,36 +6422,85 @@ alias each other and do not alias global storage. Each language will automatically use whatever option is required by the language standard. You should not need to use these options yourself. + +@item -fleading-underscore +This option and its counterpart, -fno-leading-underscore, forcibly +change the way C symbols are represented in the object file. One use +is to help link with legacy assembly code. + +Be warned that you should know what you are doing when invoking this +option, and that not all targets provide complete support for it. @end table @node Environment Variables -@section Environment Variables Affecting GNU CC +@section Environment Variables Affecting GCC @cindex environment variables -This section describes several environment variables that affect how GNU -CC operates. They work by specifying directories or prefixes to use -when searching for various kinds of files. +This section describes several environment variables that affect how GCC +operates. Some of them work by specifying directories or prefixes to use +when searching for various kinds of files. Some are used to specify other +aspects of the compilation environment. @ifclear INTERNALS Note that you can also specify places to search using options such as @samp{-B}, @samp{-I} and @samp{-L} (@pxref{Directory Options}). These take precedence over places specified using environment variables, which -in turn take precedence over those specified by the configuration of GNU -CC. +in turn take precedence over those specified by the configuration of GCC. + @end ifclear @ifset INTERNALS Note that you can also specify places to search using options such as @samp{-B}, @samp{-I} and @samp{-L} (@pxref{Directory Options}). These take precedence over places specified using environment variables, which -in turn take precedence over those specified by the configuration of GNU -CC. @xref{Driver}. +in turn take precedence over those specified by the configuration of GCC. +@xref{Driver}. @end ifset @table @code +@item LANG +@itemx LC_CTYPE +@c @itemx LC_COLLATE +@itemx LC_MESSAGES +@c @itemx LC_MONETARY +@c @itemx LC_NUMERIC +@c @itemx LC_TIME +@itemx LC_ALL +@findex LANG +@findex LC_CTYPE +@c @findex LC_COLLATE +@findex LC_MESSAGES +@c @findex LC_MONETARY +@c @findex LC_NUMERIC +@c @findex LC_TIME +@findex LC_ALL +@cindex locale +These environment variables control the way that GCC uses +localization information that allow GCC to work with different +national conventions. GCC inspects the locale categories +@code{LC_CTYPE} and @code{LC_MESSAGES} if it has been configured to do +so. These locale categories can be set to any value supported by your +installation. A typical value is @samp{en_UK} for English in the United +Kingdom. + +The @code{LC_CTYPE} environment variable specifies character +classification. GCC uses it to determine the character boundaries in +a string; this is needed for some multibyte encodings that contain quote +and escape characters that would otherwise be interpreted as a string +end or escape. + +The @code{LC_MESSAGES} environment variable specifies the language to +use in diagnostic messages. + +If the @code{LC_ALL} environment variable is set, it overrides the value +of @code{LC_CTYPE} and @code{LC_MESSAGES}; otherwise, @code{LC_CTYPE} +and @code{LC_MESSAGES} default to the value of the @code{LANG} +environment variable. If none of these variables are set, GCC +defaults to traditional C English behavior. + @item TMPDIR @findex TMPDIR If @code{TMPDIR} is set, it specifies the directory to use for temporary -files. GNU CC uses temporary files to hold the output of one stage of +files. GCC uses temporary files to hold the output of one stage of compilation which is to be used as input to the next stage: for example, the output of the preprocessor, which is the input to the compiler proper. @@ -6019,7 +6512,7 @@ names of the subprograms executed by the compiler. No slash is added when this prefix is combined with the name of a subprogram, but you can specify a prefix that ends with a slash if you wish. -If GNU CC cannot find the subprogram using the specified prefix, it +If GCC cannot find the subprogram using the specified prefix, it tries looking in the usual places for the subprogram. The default value of @code{GCC_EXEC_PREFIX} is @@ -6034,9 +6527,9 @@ used for linking. In addition, the prefix is used in an unusual way in finding the directories to search for header files. For each of the standard directories whose name normally begins with @samp{/usr/local/lib/gcc-lib} -(more precisely, with the value of @code{GCC_INCLUDE_DIR}), GNU CC tries +(more precisely, with the value of @code{GCC_INCLUDE_DIR}), GCC tries replacing that beginning with the specified prefix to produce an -alternate directory name. Thus, with @samp{-Bfoo/}, GNU CC will search +alternate directory name. Thus, with @samp{-Bfoo/}, GCC will search @file{foo/bar} where it would normally search @file{/usr/local/lib/bar}. These alternate directories are searched first; the standard directories come next. @@ -6044,7 +6537,7 @@ come next. @item COMPILER_PATH @findex COMPILER_PATH The value of @code{COMPILER_PATH} is a colon-separated list of -directories, much like @code{PATH}. GNU CC tries the directories thus +directories, much like @code{PATH}. GCC tries the directories thus specified when searching for subprograms, if it can't find the subprograms using @code{GCC_EXEC_PREFIX}. @@ -6052,9 +6545,9 @@ subprograms using @code{GCC_EXEC_PREFIX}. @findex LIBRARY_PATH The value of @code{LIBRARY_PATH} is a colon-separated list of directories, much like @code{PATH}. When configured as a native compiler, -GNU CC tries the directories thus specified when searching for special +GCC tries the directories thus specified when searching for special linker files, if it can't find them using @code{GCC_EXEC_PREFIX}. Linking -using GNU CC also uses these directories when searching for ordinary +using GCC also uses these directories when searching for ordinary libraries for the @samp{-l} option (but directories specified with @samp{-L} come first). @@ -6067,7 +6560,7 @@ libraries for the @samp{-l} option (but directories specified with @c @itemx OBJCPLUS_INCLUDE_PATH These environment variables pertain to particular languages. Each variable's value is a colon-separated list of directories, much like -@code{PATH}. When GNU CC searches for header files, it tries the +@code{PATH}. When GCC searches for header files, it tries the directories listed in the variable for the language you are using, after the directories specified with @samp{-I} but before the standard header file directories. @@ -6086,6 +6579,28 @@ which case the Make rules are written to that file, guessing the target name from the source file name. Or the value can have the form @samp{@var{file} @var{target}}, in which case the rules are written to file @var{file} using @var{target} as the target name. + +@item LANG +@findex LANG +@cindex locale definition +This variable is used to pass locale information to the compiler. One way in +which this information is used is to determine the character set to be used +when character literals, string literals and comments are parsed in C and C++. +When the compiler is configured to allow multibyte characters, +the following values for @code{LANG} are recognized: + +@table @code +@item C-JIS +Recognize JIS characters. +@item C-SJIS +Recognize SJIS characters. +@item C-EUCJP +Recognize EUCJP characters. +@end table + +If @code{LANG} is not defined, or if it has some other value, then the +compiler will use mblen and mbtowc as defined by the default locale to +recognize and translate multibyte characters. @end table @node Running Protoize @@ -6138,9 +6653,9 @@ original source file. The original file is renamed to a name ending with @samp{.save}. If the @samp{.save} file already exists, then the source file is simply discarded. -@code{protoize} and @code{unprotoize} both depend on GNU CC itself to +@code{protoize} and @code{unprotoize} both depend on GCC itself to scan the program and collect information about the functions it uses. -So neither of these programs will work until GNU CC is installed. +So neither of these programs will work until GCC is installed. Here is a table of the options you can use with @code{protoize} and @code{unprotoize}. Each option works with both programs unless |