tcc-65816/tcc.1

380 lines
12 KiB
Groff

.\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.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. | will give a
.\" real vertical bar. \*(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-|\(bv\*(Tr
.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" ''
'br\}
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.\"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" 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 "2005-06-18" " " " "
.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 """\f(CBtcc \-run a.c\f(CW""" 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 """\f(CBtcc \-run a.c arg1\f(CW""" 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 """\f(CBtcc a.c \-run b.c arg1\f(CW""" 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. Because
multiple C files are specified, \fB\-\-\fR are necessary to clearly separate the
program arguments from the \s-1TCC\s0 options.
.ie n .IP """\f(CBtcc \-o myprog a.c b.c\f(CW""" 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 """\f(CBtcc \-o myprog a.o b.o\f(CW""" 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 """\f(CBtcc \-c a.c\f(CW""" 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 """\f(CBtcc \-c asmfile.S\f(CW""" 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 """\f(CBtcc \-c asmfile.s\f(CW""" 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 """\f(CBtcc \-r \-o ab.o a.c b.c\f(CW""" 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 <stdio.h>
.Ve
.PP
.Vb 5
\& int main()
\& {
\& printf("Hello World\en");
\& return 0;
\& }
.Ve
.SH "OPTIONS"
.IX Header "OPTIONS"
.IP "\fB\-v\fR" 4
.IX Item "-v"
Display current \s-1TCC\s0 version.
.IP "\fB\-c\fR" 4
.IX Item "-c"
Generate an object file (\fB\-o\fR option must also be given).
.IP "\fB\-o outfile\fR" 4
.IX Item "-o outfile"
Put object file, executable, or dll into output file \fIoutfile\fR.
.IP "\fB\-Bdir\fR" 4
.IX Item "-Bdir"
Set the path where the tcc internal libraries can be found (default is
\&\fIPREFIX/lib/tcc\fR).
.IP "\fB\-bench\fR" 4
.IX Item "-bench"
Output compilation statistics.
.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. Example:
.Sp
.Vb 1
\& tcc "-run -L/usr/X11R6/lib -lX11" ex4.c
.Ve
.Sp
In a script, it gives the following header:
.Sp
.Vb 6
\& #!/usr/local/bin/tcc -run -L/usr/X11R6/lib -lX11
\& #include <stdlib.h>
\& int main(int argc, char **argv)
\& {
\& ...
\& }
.Ve
.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.
.PP
Compilation flags:
.PP
Note: each of the following warning 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.
.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.
.IP "\fB\-shared\fR" 4
.IX Item "-shared"
Generate a shared library instead of an executable (\fB\-o\fR option
must also be given).
.IP "\fB\-static\fR" 4
.IX Item "-static"
Generate a statically linked executable (default is a shared linked
executable) (\fB\-o\fR option must also be given).
.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 (\fB\-o\fR option must
also be given).
.IP "\fB\-Wl,\-Ttext,address\fR" 4
.IX Item "-Wl,-Ttext,address"
Set the start of the .text section to \fIaddress\fR.
.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
.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 'test5()': 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.
.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
Note: \s-1GCC\s0 options \fB\-Ox\fR, \fB\-fx\fR and \fB\-mx\fR are
ignored.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIgcc\fR\|(1)
.SH "AUTHOR"
.IX Header "AUTHOR"
Fabrice Bellard