This page describes the options supported by
gcc.exe
, the driver program of the GNU Compiler Collection, whose C compiler and assembler are used here. This program is called either by tigcc.exe
or by the IDE. tigcc.exe
simulates some of these options itself, namely '-E', '-S', and '-c', and it also has some additional ones. In the IDE, there is an item in the project settings where you can set the options on this page, with some exceptions, including the switches mentioned above.
tigcc.exe
normally does preprocessing, compilation, assembling, and linking all in one step. The "overall options" allow you to stop this process at an intermediate stage. For example, the '-c' option says not to run the linker. Then the output consists of object files output by the assembler. Note that instead of the default GNU Linker (ld
), TIGCC uses a special linker, which produces .89z
or .9xz
files, since the GNU Linker does not support them (of course).
tigcc.exe
accepts options and file names as operands. Many options have multiletter names; therefore multiple single-letter options may not be grouped: '-dr' is very different from '-d
-r'.
Command-Line Options: | Options that are available in the command-line compiler (tigcc.exe ) |
Overall Options: | Options controlling the kind of output: executables, object files, assembler files, or preprocessed source. |
C Dialect Options: | Options controlling the variant of C language compiled. |
Warning Options: | How picky should the compiler be? |
Debugging Options: | Symbol tables, measurements, and debugging dumps. |
Optimize Options: | How much optimization? |
Preprocessor Options: | Options controlling header files and macro definitions. Also, getting dependency information for Make utility (which is not a part of TIGCC package). |
Assembler Options: | Passing options to the assembler. |
Link Options: | Passing options to the linker. |
Directory Options: | Where to find header files etc., and where to find the compiler executable files. |
Spec Files: | How to pass switches to sub-processes. |
Target Options: | Different options that are only present in TIGCC. |
Code Gen Options: | Specifying conventions for function calls, data layout and register usage. |
Environment Variables: | Environment variables that affect GCC. |
These options apply only to the command line compiler. If you want to use the IDE instead, you do not need to worry about these topics.
tigcc.exe
has an important difference to the standard program gcc.exe
: tigcc.exe
always overwrites assembly or object files. For example, if a file 'test.c'
is compiled, the files 'test.s'
and 'test.o'
will be created and overwritten if necessary, but they will automatically be deleted again if neither '-c' nor '-S' are specified.
'ppg'
. varname cannot be the same as the on-calc name of the program itself. When you use this switch, two variables will be created; one with the extension '.89y'
or '.9xy'
, and one '.89z'
or '.9xz'
variable.
Compilation can involve up to four stages: preprocessing, compilation
proper, assembly and linking, always in that order. The first three
stages apply to an individual source file, and end by producing an
object file; linking combines all the object files (those newly
compiled, and those specified as input) into an executable file. Note
that TIGCC does not use GNU C linker, because it can not produce TI-89
and TI-92+ executables (.89z
and .9xz
). Instead, it uses special linker, created
by Xavier Vassor & Niklas Brunlid.
For any given input file, the file name suffix determines what kind of
compilation is done:
c
, objective-c
, c++
,
c-header
, cpp-output
, c++-cpp-output
,
assembler
and assembler-with-cpp
.
As TIGCC does not support C++ and Objective-C, the only valid options with TIGCC are
c
,
c-header
, cpp-output
,
assembler
and assembler-with-cpp
.
asm
and typeof
keywords, and
some predefined macros that identify the
type of system you are using. It also enables the undesirable and
rarely used ANSI trigraph feature. It also disables recognition of C++ style
'//'
comments as well as
the inline
keyword.
The alternate keywords __asm__
, __extension__
,
__inline__
and __typeof__
continue to work despite
'-ansi'. You would not want to use them in an ANSI C program, of
course, but it is useful to put them in header files that might be included
in compilations done with '-ansi'. Alternate predefined macros
such as __unix__
are also available instead of unix
, with or
without '-ansi'.
__STRICT_ANSI__
is predefined when the '-ansi'
option is used. Some header files may notice this macro and refrain
from declaring certain functions or defining certain macros that the
ANSI standard doesn't call for; this is to avoid interfering with any
programs that might use these names for other things.
iso9899:1990 | Same as -ansi |
iso9899:199409 | ISO C as modified in amend. 1 |
iso9899:199x | ISO C 9x |
c89 | same as -std=iso9899:1990 |
c9x | same as -std=iso9899:199x |
gnu89 | default, iso9899:1990 + gnu extensions |
gnu9x | iso9899:199x + gnu extensions |
__restrict__
even
when -fstd=c9x is not specified.
asm
, inline
or typeof
as a
keyword, so that code can use these words as identifiers. You can use
the keywords __asm__
, __inline__
and __typeof__
instead. '-ansi' implies '-fno-asm'.
main
has a return
type of int
(TIGCC is such environment). Examples are nearly everything except a kernel.
This is equivalent to '-fno-freestanding'.
main
. The most obvious example is an OS kernel.
This is equivalent to '-fno-hosted'. This option is obviously
useless with TIGCC.
extern
declarations take effect globally even if they
are written inside of a function definition. This includes implicit
declarations of functions.
typeof
, inline
, signed
, const
and volatile
are not recognized (you can still use the
alternative keywords such as __typeof__
, __inline__
, and
so on).
unsigned short
and unsigned char
promote
to unsigned int
.
'0xe-0xd'
, are treated as expressions instead.
register
are preserved by
longjmp (I am not sure that this is true
under TIGCC). Ordinarily, GNU C follows ANSI C: automatic variables
not declared volatile
may be clobbered.
'\x'
and '\a'
evaluate as the
literal characters 'x'
and 'a'
respectively. Without
'-traditional', '\x'
is a prefix for the hexadecimal
representation of a character, and '\a'
produces a bell code.
'#'
symbol must appear as the first
character of a line.
__STDC__
is not defined when you use
'-traditional', but __GNUC__
is (since the GNU extensions
which __GNUC__
indicates are not affected by
'-traditional'). If you need to write header files that work
differently depending on whether '-traditional' is in use, by
testing both of these predefined macros you can distinguish four
situations: GNU C, traditional GNU C, other ANSI C compilers, and other
old C compilers. The predefined macro __STDC_VERSION__
is also
not defined when you use '-traditional'. See section
'Standard Predefined Macros' in The C Preprocessor,
for more discussion of these and other predefined macros.
'\'
). Without '-traditional',
string constants can contain the newline character as typed.
char
be unsigned, like unsigned char
.
Note that on TIGCC default char type is signed char
.
Ideally, a portable program should always use signed char
or
unsigned char
when it depends on the signedness of an object.
But many programs have been written to use plain char
and
expect it to be signed, or expect it to be unsigned, depending on the
machines they were written for. This option, and its inverse, let you
make such a program work with the opposite default.
The type char
is always a distinct type from each of
signed char
or unsigned char
, even though its behavior
is always just like one of those two.
char
be signed, like signed char
.
Note that this is equivalent to '-fno-unsigned-char', which is
the negative form of '-funsigned-char'. Likewise, the option
'-fno-signed-char' is equivalent to '-funsigned-char'.
signed
or unsigned
. By
default, such a bitfield is signed, because this is consistent: the
basic integer types such as int
are signed types.
However, when '-traditional' is used, bitfields are all unsigned
no matter what.
float
and double
are the same in TIGCC,
this option is meaningless.
__extension__
. However, only system header files should use
these escape routes; application programs should avoid them.
See section Alternate Keywords.
'#import'
.
char
. This is a common cause
of error, as programmers often forget that this type is signed on some
machines (including TI).
'main'
is suspicious. 'main'
should be a
function with external linkage, returning int, taking either zero
arguments, two, or three arguments of appropriate types. Anyway, 'main'
is
meaningless under TIGCC: its main entry point is '_main'
instead, and it
should be a void function, taking zero arguments.
'FOOF'
) is used. Usually they
indicate a typo in the user's code, as they have implementation-defined
values, and should not be used in portable code.
if
statement an else
branch belongs. Here is an example of
such a case:
{ if (a) if (b) foo (); else bar (); }In C, every
else
branch belongs to the innermost possible if
statement, which in this example is if (b)
. This is often not
what the programmer expected, as illustrated in the above example by
indentation the programmer chose. When there is the potential for this
confusion, GNU C will issue a warning when this flag is specified.
To eliminate the warning, add explicit braces around the innermost
if
statement so there is no way the else
could belong to
the enclosing if
. The resulting code would look like this:
{ if (a) { if (b) foo (); else bar (); } }Misunderstanding of if-else matching is quite common error in C programming.
int
. Also warn about any return
statement with no
return-value in a function whose return-type is not void
.
switch
statement has an index of enumeral type
and lacks a case
for one or more of the named codes of that
enumeration (the presence of a default
label prevents this
warning). case
labels outside the enumeration range also
provoke warnings when this option is used.
setjmp
problems may be detected with TIGCC).
These warnings are possible only in optimizing compilation,
because they require data flow information that is computed only
when optimizing. If you don't specify '-O', you simply won't
get these warnings.
volatile
, or whose address is taken, or whose size
is other than 1, 2, 4 or 8 bytes. Also, they do not occur for
structures, unions or arrays, even when they are in registers.
Note that there may be no warning about a variable that is used only
to compute a value that itself is never used, because such
computations may be deleted by data flow analysis before the warnings
are printed.
{ int x; switch (y) { case 1: x = 1; break; case 2: x = 4; break; case 3: x = 5; } foo (x); }If the value of
y
is always 1, 2 or 3, then x
is
always initialized, but GCC doesn't know this. Here is
another common case:
{ int save_y; if (change_y) save_y = y, y = new_y; ... if (change_y) y = save_y; }This has no bug because
save_y
is used only if it is set.
noreturn
. See section Declaring Attributes of Functions.
#pragma
directive is encountered which is not understood by
GCC. If this command line option is used, warnings will even be issued
for unknown pragmas in system header files. This is not the case if
the warnings were only enabled by the '-Wall' command line option.
int foo (a) { if (a < 0) return a; }
'x[i,j]'
will cause a warning,
but 'x[(void)i,j]'
will not.
'<'
or '<='
.
'x <= y <= z'
appears;
in fact, this is equivalent to
'(x<=y ? 1 : 0) <= z'
,
which is a quite different interpretation from that of ordinary mathematical notation.
static
are not the first things in
a declaration. According to the C Standard, this usage is obsolescent.
x.h
:
struct s {int f, g;}; struct t {struct s h; int i;}; struct t x = {1, 2, 3};
x.h
would be implicitly initialized to zero:
struct s {int f, g, h;}; struct s x = {3, 4};
switch
statement has an operand of type long
.
static
function declaration follows a static
one.
This construct is not accepted by some traditional C compilers.
'#if'
directive.
void
. GNU C assigns these types a size of 1, for
convenience in calculations with 'void *'
pointers and pointers
to functions.
'int malloc()'
is cast to 'anything *'
.
'const char *'
is cast
to an ordinary 'char *'
.
'char *'
is cast to
an 'int *'
on machines where integers can only be accessed at
two- or four-byte boundaries (which is the case with TI models).
'const char[length]'
so that
copying the address of one into a non-constant 'char *'
pointer will get a warning. These warnings will help you find at
compile time code that can try to write into a string constant, but
only if you have been very careful about using const
in
declarations and prototypes. Otherwise, it will just be a nuisance;
this is why we did not make '-Wall' request these warnings.
'x = -1'
if 'x'
is unsigned. But do not warn about explicit
casts like '(unsigned) -1'
.
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 noreturn
attribute, otherwise subtle code generation
bugs could be introduced.
'f.x'
in 'struct bar'
will be misaligned even though 'struct bar'
does not itself
have the packed attribute:
struct foo { int x; char a, b, c, d; } __attribute__((packed)); struct bar { char z; struct foo f; };However, such cases are not very likely.
extern
declaration is encountered within a function.
'long long'
type is used. This is default. To inhibit
the warning messages, use '-Wno-long-long'. Flags
'-Wlong-long' and '-Wno-long-long' are taken into account
only when '-pedantic' flag is used.
GCC has a lot of special options that are used for debugging either your program or GCC itself. For example, '-g' Produce debugging information in the operating system's native format. Unfortunately, as the TIGCC linker doesn't understand debugging information yet, and as there is still no TIGCC debugger, a lot of these options are useless with TIGCC. This will probably be corrected in the future. Some debugging options like '-p', '-a' and '-ax' (which are used for generating the code for writing profile information and for profiling basic blocks) will not be rejected by the TIGCC linker, but they require special library support which is not implemented yet. At the moment, only debugging options which have any sense with the TIGCC are the following ones:
'foo.c.00.rtl'
or
'foo.c.01.jump'
). The purpose of this option is for debugging the
compiler itself, but maybe you can find some other applications for them.
Here are the possible letters for use in letters, and their meanings
(note that you need to know something about the compiler theory to understand
some of these options):
'A' | Annotate the assembler output with miscellaneous debugging information. |
'b' |
Dump after computing branch probabilities, to 'file.07.bp' .
|
'c' |
Dump after instruction combination, to the file 'file.09.combine' .
|
'd' |
Dump after delayed branch scheduling, to 'file.19.dbr' .
|
'D' | Dump all macro definitions, at the end of preprocessing, in addition to normal output. |
'F' |
Dump after purging ADDRESSOF , to 'file.03.addressof' .
|
'f' |
Dump after flow analysis, to 'file.08.flow' .
|
'g' |
Dump after global register allocation, to 'file.13.greg' .
|
'G' |
Dump after GCSE , to 'file.04.gcse' .
|
'j' |
Dump after first jump optimization, to 'file.01.jump' .
|
'J' |
Dump after last jump optimization, to 'file.17.jump2' .
|
'k' |
Dump after conversion from registers to stack, to 'file.20.stack' .
|
'l' |
Dump after local register allocation, to 'file.12.lreg' .
|
'L' |
Dump after loop optimization, to 'file.05.loop' .
|
'M' |
Dump after performing the machine dependent reorganisation pass, to
'file.18.mach' .
|
'N' |
Dump after the register move pass, to 'file.10.regmove' .
|
'r' |
Dump after RTL generation, to 'file.00.rtl' .
|
'R' |
Dump after the second instruction scheduling pass, to
'file.16.sched2' .
|
's' |
Dump after CSE (including the jump optimization that sometimes follows
CSE ), to 'file.02.cse' .
|
'S' |
Dump after the first instruction scheduling pass, to
'file.11.sched' .
|
't' |
Dump after the second CSE pass (including the jump optimization that
sometimes follows CSE ), to 'file.06.cse2' .
|
'a' | Produce all the dumps listed above. |
'm' | Print statistics on memory usage, at the end of the run, to standard error. |
'p' | Annotate the assembler output with a comment indicating which innstruction pattern and alternative was used. The length of each instruction is also printed. |
'v' |
For each of the other indicated dump files (except for
'file.00.rtl' ), dump a representation of the control flow graph
suitible for viewing with VCG to 'file.pass.vcg' .
|
'w' |
Dump after the second flow pass to 'file.14.flow2' .
|
'x' |
Just generate RTL for a function instead of compiling it. Usually used
with 'r' .
|
'y' | Dump debugging information during parsing, to standard error. |
'z' |
Dump after the peephole2 pass to 'file.15.peephole2' .
|
'foo.c'
with '-c -save-temps' would produce files
'foo.i'
and 'foo.s'
, as well as 'foo.o'
.
# cpp 0.04 0.04 # cc1 0.12 0.01 # as 0.00 0.01The first number on each line is the "user time," that is time spent executing the program itself. The second number is "system time," time spent executing operating system routines on behalf of the program. Both numbers are in seconds.
'cpp'
etc.) if it was called successfully, and don't
do anything else. With this purely diagnostic option, GCC does not
compile or link anything; it just prints the file name.
installation problem, cannot exec cpp: No such file or directoryTo resolve this you either need to put
'cpp'
and the other compiler
components where gcc expects to find them, or you can set the environment
variable GCC_EXEC_PREFIX
to the directory where you installed them.
Don't forget the trailing '/'. See section Environment Variables
Affecting GCC. Anyway, it is not likely that you will ever use this option
with TIGCC.
register
in registers.
inline
keyword. Normally this option
is used to keep the compiler from expanding any functions inline.
Note that if you are not optimizing, no functions can be expanded inline.
static
, then the function is normally not output as
assembler code in its own right.
inline
keyword). 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 (be aware that this default is too big for
usage on TI calculators). 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).
static
, nevertheless output a separate run-time
callable version of the function. This switch does not affect
extern inline
functions.
static const
when optimization isn't turned
on, even if the variables aren't referenced.
sqrt
function are non-negative numbers and that no floating-point values
are NaNs (although, this option is useless with TIGCC, because it uses
non-IEEE floating point format).
This option should never be turned on by any '-O' option since
it can result in incorrect output for programs which depend on
an exact implementation of IEEE or ANSI rules/specifications for
math functions.
sqrt
. A program that relies on
IEEE exceptions for math error handling may want to use this flag
for speed while maintaining IEEE arithmetic compatibility
(useless with TIGCC, because it uses non-IEEE floating point format).
The default is '-fmath-errno'. The '-ffast-math' option
sets '-fno-math-errno'.
if
statement with an
else
clause, CSE will follow the jump when the condition
tested is false.
if
statement with no else clause,
'-fcse-skip-blocks' causes CSE to follow the jump around the
body of the if
.
NULL
pointer dereferences not
halting the program may not work properly with this option. Use
'-fno-delete-null-pointer-checks' to disable this optimizing for programs
which depend on that behavior.
'REG_EXEC_COUNT'
note on the first instruction of each basic block, and a
'REG_BR_PROB'
note on each 'JUMP_INSN'
and 'CALL_INSN'
.
These can be used to improve optimization.
'unsigned int'
can alias an 'int'
, but not a
'void *'
or a 'float'
. A character type may alias any other
type. Pay special attention to code like this:
union a_union { int i; float f; }; int foo() { a_union t; t.f = 3.0; return t.i; }The practice of reading from a different union member than the one most recently written to (called "type-punning") is common. Even with '-fstrict-aliasing', type-punning is allowed, provided the memory is accessed through the union type. So, the code above will work as expected. However, this code might not:
int foo() { a_union t; int *ip; t.f = 3.0; ip = &t.i; return *ip; }You can see from the above example what we are talking about.
'#line'
directives.
Used with the '-E' option.
make
describing the dependencies of each object file. For each source file,
the preprocessor outputs one make
-rule whose target is the object
file name for that source file and whose dependencies are all the
#include
header files it uses. This rule may be a single line or
may be continued with backslash-newline if it is long. The list of rules
is printed on standard output instead of the preprocessed C program.
Note that '-M' implies '-E' too.
Another way to specify output of a make
rule is by setting
the environment variable DEPENDENCIES_OUTPUT
(see section Environment Variables Affecting GCC).
Anyway, this option is hardly usable with TIGCC.
'#include "file"'
. System header files
included with '#include <file>'
are omitted.
'#if #question(answer)'
.
'-A-' disables the standard
assertions that normally describe the target machine.
.89z
or .9xz
executables, and it does not accept
any special options so far. That's why these options will not be described in
this document.
'#include "file"'
;
they are not searched for '#include <file>'
.
'#include'
directives (ordinarily all '-I' directories are used
this way).
In addition, the '-I-' option inhibits the use of the current
directory (where the current input file came from) as the first search
directory for '#include "file"'
. There is no way to
override this effect of '-I-'. With '-I.' you can specify
searching the directory which was current when the compiler was
invoked. That is not exactly the same as what the preprocessor does
by default, but it is often satisfactory.
'cpp'
, 'cc1'
, 'as'
and 'ld'
(a special linker is used instead of 'ld'
with TIGCC). It tries
prefix as a prefix for each program it tries to run, both with and
without 'machine/version/'
(see section
Specifying Target Machine and Compiler Version).
'/usr/lib/gcc/'
and '/usr/local/lib/gcc-lib/'
. If neither of
those results in a file name that is found, the unmodified program
name is searched for using the directories specified in your
'PATH'
environment variable.
GCC_EXEC_PREFIX
. See section Environment Variables Affecting GCC.
'specs'
file, in order to override the defaults that the 'gcc'
driver
program uses when determining what switches to pass to 'cc1',
'as', etc. More than one
'-specs='file can be specified on the command line, and they
are processed in order, from left to right.
'+'
character, in which case the text will be appended to the spec.
'[suffix] spec'
pair. All lines after this directive
and up to the next directive or blank line are considered to make up the
spec string for the indicated suffix. When the compiler encounters an
input file with the named suffix, it will processes the spec string in
order to work out how to compile that file. For example:
.ZZ: z-compile -input %iThis says that any input file whose name ends in
'.ZZ'
should be
passed to the program 'z-compile'
, which should be invoked with the
command-line switch '-input' and with the result of performing the
'%i' substitution (see below).
.ZZ: @c++Says that
'.ZZ'
files are, in fact, C++ source files.
name compiler not installed on this system.It allows recognizing of extensions which are not yet supported.
asm | Options to pass to the assembler |
asm_final | Options to pass to the assembler post-processor |
cpp | Options to pass to the C preprocessor |
cc1 | Options to pass to the C compiler |
cc1plus | Options to pass to the C++ compiler (not valid with TIGCC) |
endfile | Object files to include at the end of the link |
link | Options to pass to the linker (not valid with TIGCC) |
lib | Libraries to include on the command line to the linker (not valid with TIGCC) |
libgcc | Decides which GCC support library to pass to the linker (not valid with TIGCC) |
linker | Sets the name of the linker |
predefines | Defines to be passed to the C preprocessor |
signed_char | Defines to pass to CPP to say whether char is signed by default |
startfile | Object files to include at the start of the link (not valid with TIGCC) |
%rename lib old_lib *lib: --start-group -lgcc -lc -leval1 --end-group %(old_lib)This example renames the spec called
'lib'
to 'old_lib'
and
then overrides the previous definition of 'lib'
with a new one.
The new definition adds in some extra command-line options before
including the text of the old definition.
'%'
-prefixed sequences to substitute variable text or to
conditionally insert text into the command line. Using these constructs
it is possible to generate quite complex command lines.
'%'
-sequences for spec
strings. Note that spaces are not generated automatically around the
results of expanding these sequences. Therefore you can concatenate them
together or combine them with constant text in a single argument.
'%'
into the program name or argument.
'%d'
as a
temporary file name, so that that file will be deleted if GCC exits
successfully. Unlike '%g'
, this contributes no text to the
argument.
'%d'
. To reduce exposure to denial-of-service attacks, the file
name is now chosen in a way that is hard to predict even when previously
chosen file names are known. For example, '%g.s ... %g.o ... %g.s'
might turn into 'ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s'
.
suffix matches the regular expression '[.A-Za-z]*'
or the special string '%O'
, which is
treated exactly as if '%O'
had been preprocessed. Previously, '%g'
was simply substituted with a file name chosen once per compilation,
without regard to any appended suffix (which was therefore treated
just like ordinary text), making such attacks more likely to succeed.
'%g'
, but generates a new temporary file name even if
'%usuffix'
was already seen.
'%usuffix'
, generating a
new one if there is no such last file name. In the absence of any
'%usuffix'
, this is just like '%gsuffix'
, except they don't share
the same suffix space, so
'%g.s ... %U.s ... %g.s ... %U.s'
would involve the generation of two distinct file names, one
for each '%g.s'
and another for each '%U.s'
.
Previously, '%U'
was simply substituted with a file name
chosen for the previous '%u'
,
without regard to any appended suffix.
'%w'
as the
designated output file of this compilation. This puts the argument
into the sequence of arguments that '%o'
will substitute later.
'%o'
as well or the results are undefined.
'%o'
is for use in the specs for running the linker.
Input files whose names have no recognized suffix are not compiled
at all, but they are included among the output files, so they will
be linked.
'%g'
, '%u'
, or '%U'
,
because of the need for those to form complete file names. The
handling is such that '%O'
is treated exactly as if it had already
been substituted, except that '%g'
, '%u'
, and '%U'
do not currently
support additional suffix characters following '%O'
as they would
following, for example, '.o'
.
cpp
.
'__'
before and after the name of each
predefined macro, except for macros that start with '__'
or with
'_L'
, where L is an uppercase letter. This is for ANSI C.
GCC_EXEC_PREFIX
.
'-'
if the input for the current command is coming from a pipe.
'%(...)'
but put '__'
around '-D' arguments.
'%X'
.
'%x'
spec string.
asm
spec. This is used to compute the
switches to be passed to the assembler.
asm_final
spec. This is a spec string for
passing switches to an assembler post-processor, if such a program is
needed.
link
spec. This is the spec for computing the
command line passed to the linker. Typically it will make use of the
'%L'
, '%G'
, '%S'
, '%D'
and '%E'
sequences.
lib
spec. This is a spec string for deciding which
libraries should be included on the command line to the linker.
libgcc
spec. This is a spec string for deciding
which GCC support library should be included on the command line to the linker.
startfile
spec. This is a spec for deciding which
object files should be the first ones passed to the linker.
endfile
spec. This is a spec string that specifies
the last object files that will be passed to the linker.
cpp
spec. This is used to construct the arguments
to be passed to the C preprocessor.
signed_char
spec. This is intended to be used
to tell cpp whether a char is signed. It typically has the definition:
%{funsigned-char:-D__CHAR_UNSIGNED__}So, when '-funsigned-char' option is given,
__CHAR_UNSIGNED__
macro will be defined.
cc1
spec. This is used to construct the options to be
passed to the actual C compiler ('cc1'
).
cc1plus
spec. This is used to construct the options to be
passed to the actual C++ compiler ('cc1plus'
).
'-S'
switch, if that switch was given to GCC.
If that switch was not specified, this substitutes nothing. Note that
the leading dash is omitted when specifying this option, and it is
automatically inserted if the substitution is performed. Thus the spec
string '%{foo}'
would match the command-line option '-foo'
and would output the command line option '-foo'.
'%{S}'
but mark last argument supplied within as a file to be
deleted on failure.
'-S'
, but which also take an argument. This is used for
switches like '-o', '-D', '-I', etc.
GCC considers '-o foo' as being
one switch whose names starts with 'o'
. '%{o*}'
would substitute this
text, including the space. Thus two arguments would be generated.
'%{S*}'
, but don't put a blank between a switch and its
argument. Thus '%{^o*}'
would only generate one argument, not two.
'X'
if one or more switches whose names start with
'-S'
are specified to GCC. Note that the tail part of the
'-S'
option (i.e. the part matched by the '*'
) will be substituted
for each occurrence of '%*'
within 'X'
.
'X'
, but only if the '-S'
switch was given to GCC.
'X'
, but only if the '-S'
switch was not given to GCC.
'%{S:X}'
, but if no 'S'
switch, substitute '-'
.
'%{!S:X}'
, but if there is an 'S'
switch, substitute '-'
.
'X'
, but only if processing a file with suffix 'S'
.
'X'
, but only if not processing a file with suffix 'S'
.
'X'
if either '-S'
or '-P'
was given to GCC. This may be
combined with '!'
and '.'
sequences as well, although they
have a stronger binding than the '|'
. For example a spec string
like this:
%{.c:-foo} %{!.c:-bar} %{.c|d:-baz} %{!.c|d:-boggle}will output the following command-line options from the following input command-line options:
fred.c -foo -baz jim.d -bar -boggle -d fred.c -foo -baz -boggle -d jim.d -bar -baz -boggle
'X'
in a '%{S:X}'
or
'%{!S:X}'
construct may contain other nested '%'
constructs or spaces, or even newlines. They are processed as usual, as described above.
'{S*}'
where 'S'
is just one
letter, which passes all matching options.
'|'
at the beginning of the predicate text is used to indicate
that a command should be piped to the following command, but only if '-pipe'
is specified.
int
. The '-mshort' option is enabled by default in TIGCC; the negative is actually '-mnoshort', but '-mno-short' and '-mlong' have been added as aliases. Constants such as INT_MAX
are set to the appropriate values, and __INT_SHORT__
will
be defined if short integers are used (i.e. if this switch is not used). This options may be useful if you need to port code from a system which uses long integers.
struct
and 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
GCC-compiled files and files compiled with other compilers.
struct
and union
values are
returned in registers when possible. This is more efficient for small
structures than '-fpcc-struct-return'. This is just
contrary to '-fpcc-struct-return'.
enum
type only as many bytes as it needs for the
declared range of possible values. Specifically, the enum
type
will be equivalent to the smallest integer type which has enough room.
double
as for float
.
This is always true in TIGCC, regardless of this switch.
extern
) in
two different compilations, you will get an error when you link them.
'#ident'
directive.
'.size'
assembler directive, or anything else that
would cause trouble if the function is split in the middle, and the
two halves are placed at locations far apart in memory.
It is not likely that you will ever use this option.
'Checker'
. This option is currently not applicable with
TIGCC, because it requires some support of special library functions which
are not implemented yet.
asm
or
__asm__
keywords in functions with memory checking enabled. GNU
C cannot understand what the asm
statement may do, and therefore
cannot generate the appropriate code, so it will reject it. However, if
you specify the function attribute no_check_memory_usage
(see
see section Declaring Attributes of Functions,
GNU C will disable memory checking within a function; you may use asm
statements inside such functions. You
may have an inline expansion of a non-checked function within a checked
function; in that case GNU CC will not generate checks for the inlined
function's memory accesses.
asm
statements to non-checked inline functions
and 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.
extern void bar (int); void foo (int a) { return bar (a + 5); }GCC will compile the code as if it was written:
extern void prefix_bar (int); void prefix_foo (int a) { return prefix_bar (a + 5); }This option is designed to be used with '-fcheck-memory-usage'.
void __cyg_profile_func_enter (void *this_fn, void *call_site); void __cyg_profile_func_exit (void *this_fn, void *call_site);The first argument is the address of the start of the current function, which may be looked up exactly in the symbol table.
'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).
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).
LC_CTYPE
and 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 'en_UK' for English in the United
Kingdom.
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.
LC_MESSAGES
environment variable specifies the language to
use in diagnostic messages.
LC_ALL
environment variable is set, it overrides the value
of LC_CTYPE
and LC_MESSAGES
; otherwise, LC_CTYPE
and LC_MESSAGES
default to the value of the LANG
environment variable. If none of these variables are set, GCC
defaults to traditional C English behavior.
TMPDIR
is set, it specifies the directory to use for temporary
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.
GCC_EXEC_PREFIX
is set, it specifies a prefix to use in the
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.
GCC_EXEC_PREFIX
is not set, GNU C will attempt to figure out
an appropriate prefix to use based on the pathname it was invoked with.
If GCC cannot find the subprogram using the specified prefix, it
tries looking in the usual places for the subprogram.
GCC_INCLUDE_DIR
), GCC tries
replacing that beginning with the specified prefix to produce an
alternate directory name. Thus, with '-Bfoo/', GCC will search
'foo/bar'
where it would normally search '/usr/local/lib/bar'
.
These alternate directories are searched first; the standard directories
come next.
COMPILER_PATH
is a colon-separated list of
directories, much like PATH
. GCC tries the directories thus
specified when searching for subprograms, if it can't find the
subprograms using GCC_EXEC_PREFIX
.
LIBRARY_PATH
is a colon-separated list of
directories, much like PATH
.
GCC tries the directories thus specified when searching for special
linker files, if it can't find them using GCC_EXEC_PREFIX
. Linking
using GCC also uses these directories when searching for ordinary
libraries for the '-l' option (but directories specified with
'-L' come first).
PATH
. When GCC searches for header files, it tries the
directories listed in the variable, after
the directories specified with '-I' but before the standard header
file directories.
DEPENDENCIES_OUTPUT
can be just a file name, in
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
'file target'
, in which case the rules are written to
file file using target as the target name.