.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "TCC 1" .TH TCC 1 "2018-03-15" "0.9.27" "Tiny C Compiler" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" tcc \- Tiny C Compiler .SH "SYNOPSIS" .IX Header "SYNOPSIS" usage: tcc [options] [\fIinfile1\fR \fIinfile2\fR...] [\fB\-run\fR \fIinfile\fR \fIargs\fR...] .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\s-1TCC\s0 options are a very much like gcc options. The main difference is that \s-1TCC\s0 can also execute directly the resulting program and give it runtime arguments. .PP Here are some examples to understand the logic: .ie n .IP """\fBtcc \-run a.c\fP""" 4 .el .IP "\f(CW\f(CBtcc \-run a.c\f(CW\fR" 4 .IX Item "tcc -run a.c" Compile \fIa.c\fR and execute it directly .ie n .IP """\fBtcc \-run a.c arg1\fP""" 4 .el .IP "\f(CW\f(CBtcc \-run a.c arg1\f(CW\fR" 4 .IX Item "tcc -run a.c arg1" Compile a.c and execute it directly. arg1 is given as first argument to the \f(CW\*(C`main()\*(C'\fR of a.c. .ie n .IP """\fBtcc a.c \-run b.c arg1\fP""" 4 .el .IP "\f(CW\f(CBtcc a.c \-run b.c arg1\f(CW\fR" 4 .IX Item "tcc a.c -run b.c arg1" Compile \fIa.c\fR and \fIb.c\fR, link them together and execute them. arg1 is given as first argument to the \f(CW\*(C`main()\*(C'\fR of the resulting program. .ie n .IP """\fBtcc \-o myprog a.c b.c\fP""" 4 .el .IP "\f(CW\f(CBtcc \-o myprog a.c b.c\f(CW\fR" 4 .IX Item "tcc -o myprog a.c b.c" Compile \fIa.c\fR and \fIb.c\fR, link them and generate the executable \fImyprog\fR. .ie n .IP """\fBtcc \-o myprog a.o b.o\fP""" 4 .el .IP "\f(CW\f(CBtcc \-o myprog a.o b.o\f(CW\fR" 4 .IX Item "tcc -o myprog a.o b.o" link \fIa.o\fR and \fIb.o\fR together and generate the executable \fImyprog\fR. .ie n .IP """\fBtcc \-c a.c\fP""" 4 .el .IP "\f(CW\f(CBtcc \-c a.c\f(CW\fR" 4 .IX Item "tcc -c a.c" Compile \fIa.c\fR and generate object file \fIa.o\fR. .ie n .IP """\fBtcc \-c asmfile.S\fP""" 4 .el .IP "\f(CW\f(CBtcc \-c asmfile.S\f(CW\fR" 4 .IX Item "tcc -c asmfile.S" Preprocess with C preprocess and assemble \fIasmfile.S\fR and generate object file \fIasmfile.o\fR. .ie n .IP """\fBtcc \-c asmfile.s\fP""" 4 .el .IP "\f(CW\f(CBtcc \-c asmfile.s\f(CW\fR" 4 .IX Item "tcc -c asmfile.s" Assemble (but not preprocess) \fIasmfile.s\fR and generate object file \&\fIasmfile.o\fR. .ie n .IP """\fBtcc \-r \-o ab.o a.c b.c\fP""" 4 .el .IP "\f(CW\f(CBtcc \-r \-o ab.o a.c b.c\f(CW\fR" 4 .IX Item "tcc -r -o ab.o a.c b.c" Compile \fIa.c\fR and \fIb.c\fR, link them together and generate the object file \fIab.o\fR. .PP Scripting: .PP \&\s-1TCC\s0 can be invoked from \fIscripts\fR, just as shell scripts. You just need to add \f(CW\*(C`#!/usr/local/bin/tcc \-run\*(C'\fR at the start of your C source: .PP .Vb 2 \& #!/usr/local/bin/tcc \-run \& #include \& \& int main() \& { \& printf("Hello World\en"); \& return 0; \& } .Ve .PP \&\s-1TCC\s0 can read C source code from \fIstandard input\fR when \fB\-\fR is used in place of \fBinfile\fR. Example: .PP .Vb 1 \& echo \*(Aqmain(){puts("hello");}\*(Aq | tcc \-run \- .Ve .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-c\fR" 4 .IX Item "-c" Generate an object file. .IP "\fB\-o outfile\fR" 4 .IX Item "-o outfile" Put object file, executable, or dll into output file \fIoutfile\fR. .IP "\fB\-run source [args...]\fR" 4 .IX Item "-run source [args...]" Compile file \fIsource\fR and run it with the command line arguments \&\fIargs\fR. In order to be able to give more than one argument to a script, several \s-1TCC\s0 options can be given \fIafter\fR the \&\fB\-run\fR option, separated by spaces: .Sp .Vb 1 \& tcc "\-run \-L/usr/X11R6/lib \-lX11" ex4.c .Ve .Sp In a script, it gives the following header: .Sp .Vb 1 \& #!/usr/local/bin/tcc \-run \-L/usr/X11R6/lib \-lX11 .Ve .IP "\fB\-v\fR" 4 .IX Item "-v" Display \s-1TCC\s0 version. .IP "\fB\-vv\fR" 4 .IX Item "-vv" Show included files. As sole argument, print search dirs. \-vvv shows tries too. .IP "\fB\-bench\fR" 4 .IX Item "-bench" Display compilation statistics. .PP Preprocessor options: .IP "\fB\-Idir\fR" 4 .IX Item "-Idir" Specify an additional include path. Include paths are searched in the order they are specified. .Sp System include paths are always searched after. The default system include paths are: \fI/usr/local/include\fR, \fI/usr/include\fR and \fIPREFIX/lib/tcc/include\fR. (\fI\s-1PREFIX\s0\fR is usually \&\fI/usr\fR or \fI/usr/local\fR). .IP "\fB\-Dsym[=val]\fR" 4 .IX Item "-Dsym[=val]" Define preprocessor symbol \fBsym\fR to val. If val is not present, its value is \fB1\fR. Function-like macros can also be defined: \fB\-DF(a)=a+1\fR .IP "\fB\-Usym\fR" 4 .IX Item "-Usym" Undefine preprocessor symbol \fBsym\fR. .IP "\fB\-E\fR" 4 .IX Item "-E" Preprocess only, to stdout or file (with \-o). .PP Compilation flags: .PP Note: each of the following options has a negative form beginning with \&\fB\-fno\-\fR. .IP "\fB\-funsigned\-char\fR" 4 .IX Item "-funsigned-char" Let the \f(CW\*(C`char\*(C'\fR type be unsigned. .IP "\fB\-fsigned\-char\fR" 4 .IX Item "-fsigned-char" Let the \f(CW\*(C`char\*(C'\fR type be signed. .IP "\fB\-fno\-common\fR" 4 .IX Item "-fno-common" Do not generate common symbols for uninitialized data. .IP "\fB\-fleading\-underscore\fR" 4 .IX Item "-fleading-underscore" Add a leading underscore at the beginning of each C symbol. .IP "\fB\-fms\-extensions\fR" 4 .IX Item "-fms-extensions" Allow a \s-1MS C\s0 compiler extensions to the language. Currently this assumes a nested named structure declaration without an identifier behaves like an unnamed one. .IP "\fB\-fdollars\-in\-identifiers\fR" 4 .IX Item "-fdollars-in-identifiers" Allow dollar signs in identifiers .PP Warning options: .IP "\fB\-w\fR" 4 .IX Item "-w" Disable all warnings. .PP Note: each of the following warning options has a negative form beginning with \&\fB\-Wno\-\fR. .IP "\fB\-Wimplicit\-function\-declaration\fR" 4 .IX Item "-Wimplicit-function-declaration" Warn about implicit function declaration. .IP "\fB\-Wunsupported\fR" 4 .IX Item "-Wunsupported" Warn about unsupported \s-1GCC\s0 features that are ignored by \s-1TCC.\s0 .IP "\fB\-Wwrite\-strings\fR" 4 .IX Item "-Wwrite-strings" Make string constants be of type \f(CW\*(C`const char *\*(C'\fR instead of \f(CW\*(C`char *\*(C'\fR. .IP "\fB\-Werror\fR" 4 .IX Item "-Werror" Abort compilation if warnings are issued. .IP "\fB\-Wall\fR" 4 .IX Item "-Wall" Activate all warnings, except \fB\-Werror\fR, \fB\-Wunusupported\fR and \&\fB\-Wwrite\-strings\fR. .PP Linker options: .IP "\fB\-Ldir\fR" 4 .IX Item "-Ldir" Specify an additional static library path for the \fB\-l\fR option. The default library paths are \fI/usr/local/lib\fR, \fI/usr/lib\fR and \fI/lib\fR. .IP "\fB\-lxxx\fR" 4 .IX Item "-lxxx" Link your program with dynamic library libxxx.so or static library libxxx.a. The library is searched in the paths specified by the \&\fB\-L\fR option and \fB\s-1LIBRARY_PATH\s0\fR variable. .IP "\fB\-Bdir\fR" 4 .IX Item "-Bdir" Set the path where the tcc internal libraries (and include files) can be found (default is \fIPREFIX/lib/tcc\fR). .IP "\fB\-shared\fR" 4 .IX Item "-shared" Generate a shared library instead of an executable. .IP "\fB\-soname name\fR" 4 .IX Item "-soname name" set name for shared library to be used at runtime .IP "\fB\-static\fR" 4 .IX Item "-static" Generate a statically linked executable (default is a shared linked executable). .IP "\fB\-rdynamic\fR" 4 .IX Item "-rdynamic" Export global symbols to the dynamic linker. It is useful when a library opened with \f(CW\*(C`dlopen()\*(C'\fR needs to access executable symbols. .IP "\fB\-r\fR" 4 .IX Item "-r" Generate an object file combining all input files. .IP "\fB\-Wl,\-rpath=path\fR" 4 .IX Item "-Wl,-rpath=path" Put custom search path for dynamic libraries into executable. .IP "\fB\-Wl,\-\-enable\-new\-dtags\fR" 4 .IX Item "-Wl,--enable-new-dtags" When putting a custom search path for dynamic libraries into the executable, create the new \s-1ELF\s0 dynamic tag \s-1DT_RUNPATH\s0 instead of the old legacy \s-1DT_RPATH.\s0 .IP "\fB\-Wl,\-\-oformat=fmt\fR" 4 .IX Item "-Wl,--oformat=fmt" Use \fIfmt\fR as output format. The supported output formats are: .RS 4 .ie n .IP """elf32\-i386""" 4 .el .IP "\f(CWelf32\-i386\fR" 4 .IX Item "elf32-i386" \&\s-1ELF\s0 output format (default) .ie n .IP """binary""" 4 .el .IP "\f(CWbinary\fR" 4 .IX Item "binary" Binary image (only for executable output) .ie n .IP """coff""" 4 .el .IP "\f(CWcoff\fR" 4 .IX Item "coff" \&\s-1COFF\s0 output format (only for executable output for TMS320C67xx target) .RE .RS 4 .RE .IP "\fB\-Wl,\-subsystem=console/gui/wince/...\fR" 4 .IX Item "-Wl,-subsystem=console/gui/wince/..." Set type for \s-1PE\s0 (Windows) executables. .IP "\fB\-Wl,\-[Ttext=# | section\-alignment=# | file\-alignment=# | image\-base=# | stack=#]\fR" 4 .IX Item "-Wl,-[Ttext=# | section-alignment=# | file-alignment=# | image-base=# | stack=#]" Modify executable layout. .IP "\fB\-Wl,\-Bsymbolic\fR" 4 .IX Item "-Wl,-Bsymbolic" Set \s-1DT_SYMBOLIC\s0 tag. .IP "\fB\-Wl,\-(no\-)whole\-archive\fR" 4 .IX Item "-Wl,-(no-)whole-archive" Turn on/off linking of all objects in archives. .PP Debugger options: .IP "\fB\-g\fR" 4 .IX Item "-g" Generate run time debug information so that you get clear run time error messages: \f(CW\*(C` test.c:68: in function \*(Aqtest5()\*(Aq: dereferencing invalid pointer\*(C'\fR instead of the laconic \f(CW\*(C`Segmentation fault\*(C'\fR. .IP "\fB\-b\fR" 4 .IX Item "-b" Generate additional support code to check memory allocations and array/pointer bounds. \fB\-g\fR is implied. Note that the generated code is slower and bigger in this case. .Sp Note: \fB\-b\fR is only available on i386 when using libtcc for the moment. .IP "\fB\-bt N\fR" 4 .IX Item "-bt N" Display N callers in stack traces. This is useful with \fB\-g\fR or \&\fB\-b\fR. .PP Misc options: .IP "\fB\-MD\fR" 4 .IX Item "-MD" Generate makefile fragment with dependencies. .IP "\fB\-MF depfile\fR" 4 .IX Item "-MF depfile" Use \fIdepfile\fR as output for \-MD. .IP "\fB\-print\-search\-dirs\fR" 4 .IX Item "-print-search-dirs" Print the configured installation directory and a list of library and include directories tcc will search. .IP "\fB\-dumpversion\fR" 4 .IX Item "-dumpversion" Print version. .PP Target specific options: .IP "\fB\-mms\-bitfields\fR" 4 .IX Item "-mms-bitfields" Use an algorithm for bitfield alignment consistent with \s-1MSVC.\s0 Default is gcc's algorithm. .IP "\fB\-mfloat\-abi (\s-1ARM\s0 only)\fR" 4 .IX Item "-mfloat-abi (ARM only)" Select the float \s-1ABI.\s0 Possible values: \f(CW\*(C`softfp\*(C'\fR and \f(CW\*(C`hard\*(C'\fR .IP "\fB\-mno\-sse\fR" 4 .IX Item "-mno-sse" Do not use sse registers on x86_64 .IP "\fB\-m32, \-m64\fR" 4 .IX Item "-m32, -m64" Pass command line to the i386/x86_64 cross compiler. .PP Note: \s-1GCC\s0 options \fB\-Ox\fR, \fB\-fx\fR and \fB\-mx\fR are ignored. .SH "ENVIRONMENT" .IX Header "ENVIRONMENT" Environment variables that affect how tcc operates. .IP "\fB\s-1CPATH\s0\fR" 4 .IX Item "CPATH" .PD 0 .IP "\fBC_INCLUDE_PATH\fR" 4 .IX Item "C_INCLUDE_PATH" .PD A colon-separated list of directories searched for include files, directories given with \fB\-I\fR are searched first. .IP "\fB\s-1LIBRARY_PATH\s0\fR" 4 .IX Item "LIBRARY_PATH" A colon-separated list of directories searched for libraries for the \&\fB\-l\fR option, directories given with \fB\-L\fR are searched first. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIcpp\fR\|(1), \&\fIgcc\fR\|(1) .SH "AUTHOR" .IX Header "AUTHOR" Fabrice Bellard