The gcc compiler
is a driver program. It invokes a
sequence of other programs to compile, assemble and
link. GCC interprets its command-line parameters and uses these to
deduce which programs it should invoke, and which command-line options
it ought to place on their command lines. This behavior is controlled
by spec strings. In most cases there is one spec string for each
program that GCC can invoke, but a few programs have multiple spec
strings to control their behavior.
The spec strings built into GCC can
be overridden by using the
-specs=
command-line switch to specify
a spec file. Spec files are plaintext files that are used to construct spec strings. They consist of a sequence of directives separated by blank lines. The type of directive is determined by the first non-whitespace character on the line and it can be one of the following:
%
command
e.g.
%rename link old_link
*[
spec_name]:
create, override or delete the named spec string
e.g. Modify link
*link:
-T redboot.ld%s -Ttext 0x20000 %(old_link)
[
suffix]:
when this suffix is encountered, the defined spec will be used
e.g.
.c
gcc -input %i
.cpp
g++
-input %iGCC has the following spec strings built into it. Spec files can override these strings or create their own. Note that individual targets can also add their own spec strings to this list.
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
endfile Object files to include at the end of the link
link Options to pass to the linker
lib Libraries to include on the command line to the linker
libgcc Decides which GCC support library to pass to the linker
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
- REF: http://gcc.gnu.org/onlinedocs/gcc-3.1/gcc/Spec-Files.html
No comments:
Post a Comment