Alien-TinyCC
view release on metacpan or search on metacpan
src/tcc-doc.texi view on Meta::CPAN
@table @option
@item -Ldir
Specify an additional static library path for the @option{-l} option. The
default library paths are @file{/usr/local/lib}, @file{/usr/lib} and @file{/lib}.
@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
@option{-L} option and @env{LIBRARY_PATH} variable.
@item -Bdir
Set the path where the tcc internal libraries (and include files) can be
found (default is @file{PREFIX/lib/tcc}).
@item -shared
Generate a shared library instead of an executable.
@item -soname name
set name for shared library to be used at runtime
@item -static
Generate a statically linked executable (default is a shared linked
executable).
@item -rdynamic
Export global symbols to the dynamic linker. It is useful when a library
opened with @code{dlopen()} needs to access executable symbols.
@item -r
Generate an object file combining all input files.
@item -Wl,-rpath=path
Put custom seatch path for dynamic libraries into executable.
@item -Wl,--oformat=fmt
Use @var{fmt} as output format. The supported output formats are:
@table @code
@item elf32-i386
ELF output format (default)
@item binary
Binary image (only for executable output)
@item coff
COFF output format (only for executable output for TMS320C67xx target)
@end table
@item -Wl,-subsystem=console/gui/wince/...
Set type for PE (Windows) executables.
@item -Wl,-[Ttext=# | section-alignment=# | file-alignment=# | image-base=# | stack=#]
Modify executable layout.
@item -Wl,-Bsymbolic
Set DT_SYMBOLIC tag.
@end table
Debugger options:
@table @option
@item -g
Generate run time debug information so that you get clear run time
error messages: @code{ test.c:68: in function 'test5()': dereferencing
invalid pointer} instead of the laconic @code{Segmentation
fault}.
@item -b
Generate additional support code to check
memory allocations and array/pointer bounds. @option{-g} is implied. Note
that the generated code is slower and bigger in this case.
Note: @option{-b} is only available on i386 for the moment.
@item -bt N
Display N callers in stack traces. This is useful with @option{-g} or
@option{-b}.
@end table
Misc options:
@table @option
@item -MD
Generate makefile fragment with dependencies.
@item -MF depfile
Use @file{depfile} as output for -MD.
@end table
Note: GCC options @option{-Ox}, @option{-fx} and @option{-mx} are
ignored.
@c man end
@c man begin ENVIRONMENT
Environment variables that affect how tcc operates.
@table @option
@item CPATH
@item C_INCLUDE_PATH
A colon-separated list of directories searched for include files,
directories given with @option{-I} are searched first.
@item LIBRARY_PATH
A colon-separated list of directories searched for libraries for the
@option{-l} option, directories given with @option{-L} are searched first.
@end table
@c man end
@ignore
@setfilename tcc
@settitle Tiny C Compiler
@c man begin SEEALSO
cpp(1),
gcc(1)
@c man end
src/tcc-doc.texi view on Meta::CPAN
Four main symbol stacks are defined:
@table @code
@item define_stack
for the macros (@code{#define}s).
@item global_stack
for the global variables, functions and types.
@item local_stack
for the local variables, functions and types.
@item global_label_stack
for the local labels (for @code{goto}).
@item label_stack
for GCC block local labels (see the @code{__label__} keyword).
@end table
@code{sym_push()} is used to add a new symbol in the local symbol
stack. If no local symbol stack is active, it is added in the global
symbol stack.
@code{sym_pop(st,b)} pops symbols from the symbol stack @var{st} until
the symbol @var{b} is on the top of stack. If @var{b} is NULL, the stack
is emptied.
@code{sym_find(v)} return the symbol associated to the identifier
@var{v}. The local stack is searched first from top to bottom, then the
global stack.
@section Sections
The generated code and datas are written in sections. The structure
@code{Section} contains all the necessary information for a given
section. @code{new_section()} creates a new section. ELF file semantics
is assumed for each section.
The following sections are predefined:
@table @code
@item text_section
is the section containing the generated code. @var{ind} contains the
current position in the code section.
@item data_section
contains initialized data
@item bss_section
contains uninitialized data
@item bounds_section
@itemx lbounds_section
are used when bound checking is activated
@item stab_section
@itemx stabstr_section
are used when debugging is actived to store debug information
@item symtab_section
@itemx strtab_section
contain the exported symbols (currently only used for debugging).
@end table
@section Code generation
@cindex code generation
@subsection Introduction
The TCC code generator directly generates linked binary code in one
pass. It is rather unusual these days (see gcc for example which
generates text assembly), but it can be very fast and surprisingly
little complicated.
The TCC code generator is register based. Optimization is only done at
the expression level. No intermediate representation of expression is
kept except the current values stored in the @emph{value stack}.
On x86, three temporary registers are used. When more registers are
needed, one register is spilled into a new temporary variable on the stack.
@subsection The value stack
@cindex value stack, introduction
When an expression is parsed, its value is pushed on the value stack
(@var{vstack}). The top of the value stack is @var{vtop}. Each value
stack entry is the structure @code{SValue}.
@code{SValue.t} is the type. @code{SValue.r} indicates how the value is
currently stored in the generated code. It is usually a CPU register
index (@code{REG_xxx} constants), but additional values and flags are
defined:
@example
#define VT_CONST 0x00f0
#define VT_LLOCAL 0x00f1
#define VT_LOCAL 0x00f2
#define VT_CMP 0x00f3
#define VT_JMP 0x00f4
#define VT_JMPI 0x00f5
#define VT_LVAL 0x0100
#define VT_SYM 0x0200
#define VT_MUSTCAST 0x0400
#define VT_MUSTBOUND 0x0800
#define VT_BOUNDED 0x8000
#define VT_LVAL_BYTE 0x1000
#define VT_LVAL_SHORT 0x2000
#define VT_LVAL_UNSIGNED 0x4000
#define VT_LVAL_TYPE (VT_LVAL_BYTE | VT_LVAL_SHORT | VT_LVAL_UNSIGNED)
@end example
@table @code
@item VT_CONST
indicates that the value is a constant. It is stored in the union
@code{SValue.c}, depending on its type.
@item VT_LOCAL
indicates a local variable pointer at offset @code{SValue.c.i} in the
stack.
( run in 0.695 second using v1.01-cache-2.11-cpan-02777c243ea )