Name

tcc — User interface to the TDF system

Synopsis

tcc 

[ -E | -Fletter | -P | -S | -c | -d | -disp | -disp_t | -dry | -i | -k | -prod ]
file

tcc 

-ch [ -api_check ] [ -api_check_out file ] [ -im ] [ -im0 ]
file

tcc 

{ -query | -version | -V }

Most options are common to both -ch and to normal use. For brevity, these are not repeated above:

    

[ -Astr ] [ -C ] [ -Dmacro | -Dmacro=defn ] [ -Ustr ] [ -efile ] [ -ffile ] [ -no_startup_options ]
[ -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:

SuffixContextFormat
.cC source files
.iPreprocessed C source files
.C-Yc++ onlyC++ source files
.I-Yc++ onlyPreprocessed C++ source files
.jTarget-independent TDF capsules
.taArchives of target-independent TDF capsules
.tTarget-dependent TDF capsules
.sAssembly source files
.dTenDRA dump files
.K-Yc++ onlyC++ spec files
.p-Ytnc onlyTDF notation source files (AKA TDF text)
.tpl-Ypl_tdf onlyPL_TDF source files
otherBinary 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:

SuffixCodeContextDescription
.ccC source file
.iiPreprocessed C source file
.jjTarget independent TDF capsule
.ttTarget dependent TDF capsule
.ssAssembly source file
.ooBinary object file
.kk-im onlyC spec file
.pp-Ytnc onlyTDF notation source file
.taATDF archive
.tplP-Ypl_tdf onlyPL_TDF source file
.GGMips onlyBinasm source file
.TTMips onlyAssembler source file
otherBinary object file
Table 1. Input File Suffixes

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:

FilenameDescription
a.jDefault merged TDF capsule name (with -M option)
a.outDefault executable name in binary object linking phase
a.taDefault output TDF archive name
a.kDefault output file in intermodular checks linking phase
tcc_startup.hStart-up file used by tcc for -D and -U options.
tcc_endup.hEnd-up file used by tcc
Table 2. Default Output Filenames

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:

ExecutableCodeActionDescription
tdfcc.c.jC to TDF producer
.i.j
.c.j + .k(in intermodular checking mode)
.i.j + .k
tldL.j.tC to TDF producer
n × .j .j(in TDF merging mode)
transt.t.sTDF translator
asa.s.oSystem assembler
ldln × .oexecSystem linker
Jn × .j.taArchive builder (built into tcc)
J.tan × .jArchive splitter (built into tcc)
tdfcppp.c.iC preprocessor
spec_linkerSn × .k.kC spec linker
dispd.j.pTDF pretty printer
.t.p
tncn.p.jTDF notation compiler
tnc -pn.j.pReverse TDF notation compiler
.t.p
tplP.tpl.jPL_TDF compiler
trans.mipst.t.G + .TTDF to Mips translator
aslA.G + .T.oAuxillary assembler (Mips only)
ccC(various)System C compiler (specified with -cc option)
Table 3. Compilation Phases

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.

  1. TDF archives are split into their constituent target independent capsules.

  2. 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.)

  3. Target independent TDF capsules are linked, using tld, with the TDF libraries to produce target dependent TDF capsules.

  4. 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.

  5. Assembly source files are compiled into binary object files using as(1).

  6. 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:

CodeContextPhase
cC to TDF producer
pC preprocessor
x-Yc++ onlyC++ to TDF producer
g-Yc++ onlyC++ preprocessor
LTDF linker (or builder)
tTDF translator
aSystem assembler
lSystem linker
SC++ spec linker
e-Ycompact onlyCompact-output error reporter
uTenDRA dump file linker
dTDF 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.

Command-line Options

The following options are accepted by tcc. They can be given by command-line options or the TCCOPTS system variable. The spaces in the option descriptions are optional, they show where two-part or multi-part options can be split over more than one command-line argument.

OptionEffect
-o stringSpecifies output file name
-D string=stringDefines a macro
-D stringDefines a macro to be 1
-FstringHalts the compilation at the given stage
-I stringSpecifies an include file directory
-L stringSpecifies a system library directory
-N string: stringSpecifies an include file directory (with mode)
-OstringSwitches optimisation level
-Pstring...Causes intermediate files to be preserved
-SHalts compilation after creating .s files
-T stringSpecifies a command-line token
-U stringUndefines a macro
-Wstringstring, ...Passed an option to a compilation tool
-WstringstringPassed an option to a compilation tool
-X: string, ...Specifies a compilation option
-XstringSpecifies a compilation mode
-Y stringReads an environment
-cHalts compilation after creating .o files
-dHalts compilation after creating .d files
-dryCauses a dry run
-e stringSpecifies a producer end-up file
-f stringSpecifies a producer start-up file
-gProduces debugging information (default format)
-g1Produces debugging information (old format)
-g2Produces debugging information (new format)
-g3Produces debugging information (new format)
-kHalts compilation after creating .k and .K files
-l stringSpecifies a system library
-not_ansiAllows some non-ANSI C features
-nepcSwitches off extra portability checks
-symEnables symbol table dump linking
-sym:stringEnables symbol table dump linking with flags
-vSpecifies verbose mode
-vbSpecifies fairly verbose mode
-vdDump the env information tcc got hold of
-veVerbose information about tool chain environment
-vtVerbose information about tool chain invocation
-no_shuffleTurns off shuffle ranking of cmd line args
-y string=stringSets an env directory variable
-J stringSpecifies a TDF library directory
-MCauses all .j files to be merged
-MAAs -M, but with hiding
-chInvokes checker mode
-dispCauses all .j files to be pretty printed
-disp_tCauses all .t files to be pretty printed
-iHalts compilation after creating .j files
-imEnables intermodular checks
-j stringSpecifies a TDF library
-prodCauses a TDF archive to be produced
-A -Unasserts all built-in predicates
-A stringAsserts a predicate
-B stringPassed to the system linker
-CPreserves comments when preprocessing
-ECauses C source files to be preprocessed
-EstringstringSpecifies an executable to be used
-HCauses included files to be printed
-Sstringstring, ...Specifies input files
-SstringstringSpecifies input files
-VCauses all tools to print their version numbers
-ccForces the system compiler to be used
-cc_onlyForces only the system compiler to be used
-dostring stringSets a default output file name
-dumpDumps the current status
-ignore_caseIgnores case in file names
-im0Disables intermodular checks
-infoCauses API information to be printed
-keep_errorsCauses files to be preserved on errors
-make_up_namesMakes up names for intermediate files
-message stringCauses tcc to print a message
-pCauses profiling information to be produced
-qSpecifies quiet mode
-quietEquivalent to -q
-queryCauses a list of options to be printed
-sstringstringSpecifies a suffix override
-show_errorsCauses error producing commands to be shown
-special stringAllows various internal options
-startup stringSpecifies a start-up option
-target stringProvided for cc(1) compatibility
-temp stringSpecifies the temporary directory
-tidyCauses tcc to tidy up as it goes along
-timeCauses all commands to be timed
-verboseEquivalent to -v
-versionCauses tcc to print its version number
-wSuppresses tcc warnings
-work stringSpecifies the work directory
-GProvided for cc(1) compatibility
-K string, ...Provided for cc(1) compatibility
-ZstringProvided for cc(1) compatibility
-bSuppresses -lc in system linking
-dnPassed to the system linker
-dyPassed to the system linker
-h stringPassed to the system linker
-no_startup_optionsSuppresses start-up options
-sPassed to the system linker
-u stringPassed to the system linker
-wslCauses string literals to be made writable
-z stringPassed to the system linker
-#Equivalent to -v
-##Equivalent to -v
-###Equivalent to -dry
-- string, ...Communicates directly with the option interpreter

The following two tables list the producer and archiver options which can be passed using the -Wc, opt and -WJ, opt options, respectively.

OptionDescription
-D macroDefines the macro macro to be 1
-D macro=defnDefines the macro macro to be defn
-E numberSets maximum number of allowed errors (default 20)
-HCauses #include'd files to be printed as they are processed
-I dirSpecifies the additional include file directory dir
-U macroUndefines the macro macro
-e fileSpecifies the end-up file file
-f fileSpecifies the start-up file file
-nepcSwitches off extra portability, and certian other, checks
-not_ansiAllows a selection of non-ISO/ANSI C features
Table 4. Producer Options
OptionDefaultDescription
-copy or -cCopies files into archives
-full or -fUses full pathnames for archive links
-link or -lLinks files into archives
-names or -nUses real names for copied files
-no_names or -nnMakes up names for copied files
-no_options or -noDoes not interpret any archived options
-options or -oInterprets any archived options
-short or -sUses short pathnames for archive links
Table 5. Archiver Options

Options

The following options are supported by tcc. All options are scanned before input files are dealt with. The system variable TCCOPTS may be used to specify a list of options which are processed before the first command-line option.

-Astr

Asserts the predicate str.

-Bstr

Passed to the system linker. The valid values of str are target dependent.

-Dmacro
-Dmacro=defn

Where str is of the form macro or macro=defn, is equivalent to inserting the preprocessor directives #define macro 1 or #define macro defn at the start of each C source file. This is implemented by tcc writing this directive into a start-up file.

-Eletter:file

Causes file to be invoked as the executable for the compilation stage given by letter.

-H

Causes the names of files included by a #include directive to be printed.

-Idir

Tells the producers and preprocessors to search the directory dir for included files. The directories are searched in the order given, followed by the system default directories.

-Jdir

Tells the TDF linker to search the directory dir for TDF libraries. The linker searches the directories in the order given, followed by the system default directories.

-Kstr,

Provided for cc(1) compatibility. Specifies various installer options.

-Ldir

Tells the system linker to search the directory dir for libraries. It searches the directories in the order given, followed by the system default directories.

-M
-MA

Specifies that the TDF linker should link all the given target independent TDF capsules into one. This is done between stages 2 and 3 above. The default name for the produced capsule is a.j.

The -MA form additionally hides all the defined tag and token names from the resultant TDF, except the tag "main". -MA should only be used to compile complete programs.

-Nident:dir

As -Idir except that the identifier ident is associated with the directory dir in the producer.

-Ostr

This flag has no effect other than to cancel any previous diagnostics flag and is included only for compatibility with other compilers. All TDF optimisations are on by default. All optimisations are believed to be correct; any bug which occurs in the fully-optimised state is a genuine bug.

-P

Tells tcc to preserve those files indicated by letter. Each letter is a single character corresponding to the suffix of the files to be preserved. The tcc startup-file can be preserved as tcc_startup.h using -Ph. All intermediate files can be preserved using -Pa.

-Sletter,file,
-Sletter:file

The specifies that the list of input files file all have type letter, where letter is a single character giving the normal suffix of the file type. This gives an alternative method of passing input files to tcc, one which does not depend on it having to recognise suffixes to find the type of a file.

The -Sletter:file form is similar to the option above, but specifies a single input file, file (which may contain a comma).

-Ustr

Is equivalent to inserting the preprocessor directive #undef str at the start of each C source file. This is implemented by tcc writing this directive into a start-up file. The only macros built into the C to TDF producer are __LINE__, __FILE__, __DATE__, __TIME__, __STDC__, __ANDF__ and __TenDRA__.

-V

Causes all tools invoked by tcc to print their version numbers.

-Wletter,str,
-Wletter:str

This passes the list of options str to the compilation phase indicated by letter.

The -Wletter:str form is similar to the option above, but specifies a single file str (which may contain a comma).

-Xstr

Specifies a compilation mode. The mode may be one of of the following:

ModeMeaning
aLenient ANSI
cStrict ANSI (default)
pStrict ANSI with some extra checks
sStrict ANSI with many extra checks
tTraditional (pre-ANSI) C
-X:str

Specifies an individual compilation option. See the TCC Users' Guide for details.

-Yfile

Specifies the environment to use. An environment is a file telling tcc to modify its defaults. If the full pathname of env is not given, the file is searched for along the tcc environments path which is a list of directories separated by colons. This search path can be printed using -vd.

There are certain standard environments, for example, ansi, representing the ANSI API (this is the default API environment), posix represents the POSIX API, xpg3 the XPG3 API, and so on. The system environment allows tcc to behave like cc(1), using the system header files etc. See the TCC Users' Guide and tccenv manual page for more details about environments.

-Zstr

Provided for cc(1) compatibility. Specifies various installer options.

-api_check

Causes tcc to create an API usage analysis file, with default name a.api.

-api_check_out file

If an API usage analysis file is produced, call it file.

-b

Stops the library libc.a being used by the linker by default.

-cc

Causes tcc to invoke cc(1) for its code production, using the C to TDF producer as a checking front-end to cc(1). This allows the checking capabilities of the front-end of the TDF compiler to be exploited on machines where no TDF back-end is available.

-cc_only

Causes tcc to invoke cc(1) only.

-ch

Causes tcc to operate as a stand-alone static checker. Intermodular checks are enabled in this mode.

-dn
-dy

Passed to the system linker.

-doletter file

Sets the name of the default output file of type letter to file. For example, -doh can be used to set the name of the preserved start-up file.

-dry

Makes tcc print information on what system commands it would execute with the given files and options (as in verbose mode) but not actually perform them.

-dump

Causes tcc to dump its current status. This option is only used during the actual compilation of tcc.

-efile

Is equivalent to inserting the preprocessor directive #include "file" at the end of each C source file.

-ffile

Is equivalent to inserting the preprocessor directive #include "file" at the start of each C source file.

-g

Tells tcc to produce diagnostic information compatible with the system debugger.

-hstr

Passed to the system linker.

-im

Enables intermodular checks.

-im0

Disables intermodular checks.

-info

Causes tcc to print information on the current API.

-jstr

Tells the TDF linker to use the TDF library str.tl.

-keep_errors

By default, if an error occurs during the production of a file, tcc will remove it. This option will preserve such files.

-lstr

Tells the system linker to use the library libstr.a.

-make_up_names

Causes tcc to make up names for all intermediate files rather than forming them from the basenames of the input files.

-message str

Causes tcc to print the message str.

-nepc

Tells the C to TDF producer to allow certain non-portable constructs through.

-not_ansi

Tells the C to TDF producer to allow certain non-ANSI features through.

-no_startup_options

Ensures that no start-up or end-up options are passed to the C to TDF producer (unlikely to be useful).

-o file

If a final executable is produced, call it file (the default is a.out). Otherwise, if only one file is preserved, call it file.

-p

Produces profiling data for use with prof/gprof(1) on those machines for which this command is available.

-q
-quiet

Specifies that tcc should work silently. This is the default.

-query

Causes tcc to print a list of all the options it recognises, together with a brief description of each. Since this list is automatically generated it is likely to be more accurate than this manual page.

-s

Passed to the system linker.

-sletter:suffix

Specifies that files with suffix suffix are interpreted as having type indicated by letter.

-show_errors

Makes tcc report on the command it was executing when an error occurred.

-special str

Allows various internal options to be specified.

-startup str

Causes str to be printed to the tcc built-in start-up file.

-sym
-sym: str

Enables dump-linking (with mode specified by options in str, if present).

-target str

No effect (allowed for compatibility with cc(1) on some systems).

-temp dir

Specifies that tcc should use dir as its temporary directory.

-tidy

Causes tcc to remove its intermediate files when they are no longer required rather than waiting to the end of the compilation.

-ustr

Passed to the system linker.

-v
-verbose

Specifies that tcc should work in verbose mode, sending information on what system commands it is executing to the standard output.

-vb

Causes the name of each input file to be printed as it is processed.

-vd

Causes a dump of the environment information tcc got hold of.

-ve

Causes verbose information about tool chain environment to be printed.

-vt

Causes verbose information about tool chain invocation to be printed.

-version

Makes tcc report its version number.

-w

Suppresses all tcc warning messages.

-work dir

Specifies that all preserved intermediate files are placed in the directory dir rather than where they are placed by default, in the current working directory.

-wsl

Tells the TDF translator to make all string literals writable.

-zstr

Passed to the system linker.

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.

TCC Users' Guide.