Alien-TinyCC
view release on metacpan or search on metacpan
src/tcc-doc.texi view on Meta::CPAN
@item .global symbol
@item .section section
@item .text
@item .data
@item .bss
@item .fill repeat[,size[,value]]
@item .org n
@item .previous
@item .string string[,...]
@item .asciz string[,...]
@item .ascii string[,...]
@end itemize
@section X86 Assembler
@cindex assembler
All X86 opcodes are supported. Only ATT syntax is supported (source
then destination operand order). If no size suffix is given, TinyCC
tries to guess it from the operand sizes.
Currently, MMX opcodes are supported but not SSE ones.
@node linker
@chapter TinyCC Linker
@cindex linker
@section ELF file generation
@cindex ELF
TCC can directly output relocatable ELF files (object files),
executable ELF files and dynamic ELF libraries without relying on an
external linker.
Dynamic ELF libraries can be output but the C compiler does not generate
position independent code (PIC). It means that the dynamic library
code generated by TCC cannot be factorized among processes yet.
TCC linker eliminates unreferenced object code in libraries. A single pass is
done on the object and library list, so the order in which object files and
libraries are specified is important (same constraint as GNU ld). No grouping
options (@option{--start-group} and @option{--end-group}) are supported.
@section ELF file loader
TCC can load ELF object files, archives (.a files) and dynamic
libraries (.so).
@section PE-i386 file generation
@cindex PE-i386
TCC for Windows supports the native Win32 executable file format (PE-i386). It
generates EXE files (console and gui) and DLL files.
For usage on Windows, see also tcc-win32.txt.
@section GNU Linker Scripts
@cindex scripts, linker
@cindex linker scripts
@cindex GROUP, linker command
@cindex FILE, linker command
@cindex OUTPUT_FORMAT, linker command
@cindex TARGET, linker command
Because on many Linux systems some dynamic libraries (such as
@file{/usr/lib/libc.so}) are in fact GNU ld link scripts (horrible!),
the TCC linker also supports a subset of GNU ld scripts.
The @code{GROUP} and @code{FILE} commands are supported. @code{OUTPUT_FORMAT}
and @code{TARGET} are ignored.
Example from @file{/usr/lib/libc.so}:
@example
/* GNU ld script
Use the shared library, but some functions are only in
the static library, so try that secondarily. */
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a )
@end example
@node Bounds
@chapter TinyCC Memory and Bound checks
@cindex bound checks
@cindex memory checks
This feature is activated with the @option{-b} (@pxref{Invoke}).
Note that pointer size is @emph{unchanged} and that code generated
with bound checks is @emph{fully compatible} with unchecked
code. When a pointer comes from unchecked code, it is assumed to be
valid. Even very obscure C code with casts should work correctly.
For more information about the ideas behind this method, see
@url{http://www.doc.ic.ac.uk/~phjk/BoundsChecking.html}.
Here are some examples of caught errors:
@table @asis
@item Invalid range with standard string function:
@example
@{
char tab[10];
memset(tab, 0, 11);
@}
@end example
@item Out of bounds-error in global or local arrays:
@example
@{
int tab[10];
for(i=0;i<11;i++) @{
sum += tab[i];
@}
@}
@end example
@item Out of bounds-error in malloc'ed data:
@example
@{
int *tab;
tab = malloc(20 * sizeof(int));
for(i=0;i<21;i++) @{
sum += tab4[i];
@}
free(tab);
@}
@end example
@item Access of freed memory:
( run in 0.772 second using v1.01-cache-2.11-cpan-f0fbb3f571b )