Name
tcc — User interface to the TDF system
Synopsis
tcc
tcc
tcc
Most options are common to both -ch and to normal use. For brevity, these are not repeated above:
[ -startup str ] [ -H ] [ -w ] [ -dump ] [ -info ] [ -message str ] [ -q | -quiet ] [ -v | -verbose ]
[ -show_errors ] [ -vb ] [ -vd ] [ -ve ] [ -vt ] [ -Idir ] [ -Jdir ] [ -Ldir ] [ -Nident:dir ]
[ -temp dir ] [ -work dir ] [ -Bstr ] [ -Eletter:file ] [ -G ] [ -Kstr,… ] [ -M | -MA ] [ -Ostr ] [ -P ] [ -Yfile ]
[ -Sletter,file,… ] [ -S | -Wletter,str,… ] [ -Wletter:str | -Xstr ] [ -X:str ] [ -Zstr ] [ -b ] [ -g ] [ -p ]
[ -dn | -dy ] [ -cc ] [ -cc_only ] [ -doletter file ] [ -hstr ] [ -jstr ] [ -keep_errors ] [ -make_up_names ]
[ -lstr ] [ -nepc ] [ -not_ansi ] [ -o file ] [ -s ] [ -sletter:suffix ] [ -special str ] [ -sym ] [ -sym: str ]
[ -wsl ] [ -target str ] [ -tidy ] [ -ustr ] [ -zstr ]
Description
tcc is the user interface to the TDF system. It is more fully documented in the TCC Users' Guide.
tcc accepts several types of arguments as file. The formats of these files are automatically inferred from their names:
Suffix | Context | Format |
---|---|---|
.c | – | C source files |
.i | – | Preprocessed C source files |
.C | -Yc++ only | C++ source files |
.I | -Yc++ only | Preprocessed C++ source files |
.j | – | Target-independent TDF capsules |
.ta | – | Archives of target-independent TDF capsules |
.t | – | Target-dependent TDF capsules |
.s | – | Assembly source files |
.d | – | TenDRA dump files |
.K | -Yc++ only | C++ spec files |
.p | -Ytnc only | TDF notation source files (AKA TDF text) |
.tpl | -Ypl_tdf only | PL_TDF source files |
other | – | Binary object files (typically *.o and *.a |
tcc's purpose is to provide a convenient interface through which these files may be converted from one format to another. This is a broad function, and encompasses many situations; the exact details of each of these situations are beyond the scope of this manual. These are covered in depth in the TCC Users' Guide.
tcc is configured almost entirely at runtime—many of the options passed on the command line (in particular the -Y and -X options) draw their configurations from files on the filesystem. Alternate files may be specified, to provide a mechanism for user-specific customisation. This is discussed in tccenv.
Input and Output Files
tcc identifies the file type of the input files it is passed by means of their file suffix. The recognised file suffixes are as follows:
Suffix | Code | Context | Description |
---|---|---|---|
.c | c | – | C source file |
.i | i | – | Preprocessed C source file |
.j | j | – | Target independent TDF capsule |
.t | t | – | Target dependent TDF capsule |
.s | s | – | Assembly source file |
.o | o | – | Binary object file |
.k | k | -im only | C spec file |
.p | p | -Ytnc only | TDF notation source file |
.ta | A | – | TDF archive |
.tpl | P | -Ypl_tdf only | PL_TDF source file |
.G | G | Mips only | Binasm source file |
.T | T | Mips only | Assembler source file |
other | – | – | Binary object file |
Each file type is assigned an identifying letter, usually corresponding to its file suffix, which may be used in various command-line options. For example, -Fs instructs tcc to halt the compilation after creating the assembly source files, and is therefore equivalent to -S. Similarly -Po instructs it to preserve any binary object files it creates. There are a couple of special file type codes which may be used with the -P option. The option -Pa causes all intermediate files to be created, whereas -Ph causes the start-up file, tcc_startup.h, used by tcc to be preserved. The -P option can also be used to specify that intermediate files of various forms should not be preserved. For example, the option -P-o indicates that binary object files should not be preserved.
Most output file names are derived from the input file names with a simple substitution of file suffix, however certain output files (and other files) have default names. These are as follows:
Filename | Description |
---|---|
a.j | Default merged TDF capsule name (with -M option) |
a.out | Default executable name in binary object linking phase |
a.ta | Default output TDF archive name |
a.k | Default output file in intermodular checks linking phase |
tcc_startup.h | Start-up file used by tcc for -D and -U options. |
tcc_endup.h | End-up file used by tcc |
If there is a single output file, its name may be specified using the -o option. The default output filenames can also be overridden. For example, -doj b.j sets the default merged TDF capsule name to b.j.
Compilation Phases
The various compilation phases under the control of tcc may be summarised as follows:
Executable | Code | Action | Description | |
---|---|---|---|---|
tdfc | c | .c | .j | C to TDF producer |
.i | .j | |||
.c | .j + .k | (in intermodular checking mode) | ||
.i | .j + .k | |||
tld | L | .j | .t | C to TDF producer |
n × .j | .j | (in TDF merging mode) | ||
trans | t | .t | .s | TDF translator |
as | a | .s | .o | System assembler |
ld | l | n × .o | exec | System linker |
– | J | n × .j | .ta | Archive builder (built into tcc) |
– | J | .ta | n × .j | Archive splitter (built into tcc) |
tdfcpp | p | .c | .i | C preprocessor |
spec_linker | S | n × .k | .k | C spec linker |
disp | d | .j | .p | TDF pretty printer |
.t | .p | |||
tnc | n | .p | .j | TDF notation compiler |
tnc -p | n | .j | .p | Reverse TDF notation compiler |
.t | .p | |||
tpl | P | .tpl | .j | PL_TDF compiler |
trans.mips | t | .t | .G + .T | TDF to Mips translator |
asl | A | .G + .T | .o | Auxillary assembler (Mips only) |
cc | C | (various) | System C compiler (specified with -cc option) |
Each compilation phase is assigned a code letter which is used to identify that phase in various command-line options. For example, in order to pass the -x option to tdfc2 the -Wc, -x command-line option may be used. Similarly, to set the tld executable an option of the form -EL: /usr/local/bin/tld may be used.
Compilation Stages
The compilation process is as follows.
-
TDF archives are split into their constituent target independent capsules.
-
C source files (including preprocessed C) are compiled into target independent TDF capsules using tdfc2. (tcpplus does the same for C++ source files when -Yc++ is specified.)
-
Target independent TDF capsules are linked, using tld, with the TDF libraries to produce target dependent TDF capsules.
-
Target dependent TDF capsules are translated into assembly source files using one of trans.mips (q.v.—things are not quite so simple in this case), trans.x86 etc.
-
Assembly source files are compiled into binary object files using as(1).
-
Binary object files are linked with the precompiled libraries, using ld(1), to produce a final executable.
With the exception of binary object files, intermediate files are not preserved unless explicitly instructed.
The standard file suffixes .c, .i, .C, .I, .j, .t, .s, .o, .d, .k, and .K, together with .p (pretty-printed TDF capsule) and .tpl (PL_TDF source file), are used to indicate file types in some options. Also the various compilation phases are identified by letters in some options. These are:
Code | Context | Phase |
---|---|---|
c | – | C to TDF producer |
p | – | C preprocessor |
x | -Yc++ only | C++ to TDF producer |
g | -Yc++ only | C++ preprocessor |
L | – | TDF linker (or builder) |
t | – | TDF translator |
a | – | System assembler |
l | – | System linker |
S | – | C++ spec linker |
e | -Ycompact only | Compact-output error reporter |
u | – | TenDRA dump file linker |
d | – | TDF pretty-printer |
Depending on the options given, compilation may halt at any stage. The options which effect halting are:
- -E
-
Invokes the C preprocessor only, putting the result into a file with a .i suffix if other options indicate that preprocessed C files are to be preserved, or onto the standard output otherwise. Similarly, C++ source files are preprocessed and put into files with .I suffixes.
- -Fletter
-
Tells tcc to stop after producing the files indicated by letter, and to preserve these files. letter is a single character corresponding to the suffix of the files to be preserved.
- -P
-
Invokes the C preprocessor only, putting the result into a file with a .i suffix. The C++ preprocessor is similarly invoked for C++ source files, putting the result into a file with a .I suffix.
- -S
-
Tells tcc to stop after producing an assembly source file. This is equivalent to -Fs.
- -c
-
Tells tcc to stop after producing the binary object files. This is equivalent to -Fo.
- -d
-
Halts the compilation after the creation of the dump files. This is equivalent to -Fd.
- -disp
-
Runs the TDF pretty-printer on all files at stage 2 or 3 and then terminates. The results are put into files with .p suffixes.
- -disp_t
-
Runs the pretty-printer on all files at stage 3 and then terminates. This differs from the -disp option in that it displays the TDF after linking with the target-dependent TDF libraries rather than before. The output is put into a file with a .p suffix.
- -i
-
Tells tcc to stop after producing the target independent TDF capsules. This is equivalent to -Fj.
- -k
-
In intermodular checking mode, halts the compilation after the creation of the C++ spec files. This is equivalent to -FK.
- -prod
-
Specifies that tcc should stop after producing the target independent TDF capsules and combine them into a TDF archive. The default archive name is a.ta.
Files
- file.c
-
C source file
- file.i
-
Preprocessed C source file
- file.C
-
C++ source file (only if -Yc++ is specified)
- file.I
-
Preprocessed C++ source file (only if -Yc++ is specified)
- file.j
-
Target independent TDF capsule
- file.t
-
Target dependent TDF capsule
- file.s
-
Assembly source file
- file.o
-
Binary object file
- file.d
-
TenDRA dump file
- file.K
-
C++ spec file (only if -Yc++ is specified)
- file.p
-
Pretty-printed TDF capsule
- file.tpl
-
PL_TDF source file (only if -Ypl_tdf is specified)
- file.ta
-
TDF archive
- file.G
-
Binasm source file (Mips and Alpha only)
- file.T
-
Assembler symbol table (Mips and Alpha only)
- a.out
-
Default executable name
- a.ta
-
Default TDF archive name
- a.d
-
Default dump file name
- a.api
-
Default API usage analysis file name
- a.j
-
Default output file for merge-TDF-capsules option
- tcc_startup.h
-
Name of preserved tcc start-up file
- /tmp/tcc*
-
Temporary directory (this may be changed using the TMPDIR system variable, see tempnam(1)).
See Also
as(1), cc(1), ld(1), prof/gprof(1), disp, tdfc2, tcpplus, tld, trans, tccenv, tccmodes.