| @@ -67,9 +67,7 @@ generation (@pxref{Libtcc}). · 66 unmodified lines |
| 67 | 67 | |
| 68 | 68 | @example |
| 69 | 69 | @c man begin SYNOPSIS |
| 70 | | −usage: tcc [@option{-v}] [@option{-c}] [@option{-o}@var{outfile}] [@option{-B}@var{dir}] [@option{-bench}] [@option{-I}@var{dir}] [@option{-D}@var{sym[=val]}] [@option{-U}@var{sym}] |
| 71 | | − [@option{-g}] [@option{-b}] [@option{-bt}@var{N}] [@option{-L}@var{dir}] [@option{-l}@var{lib}] [@option{-shared}] [@option{-static}] |
| 72 | | − [@var{infile1} @var{infile2}@dots{}] [@option{run} @var{infile} @var{args}@dots{}] |
| 70 | +usage: tcc [options] [@var{infile1} @var{infile2}@dots{}] [@option{-run} @var{infile} @var{args}@dots{}] |
| 73 | 71 | @c man end |
| 74 | 72 | @end example |
| 75 | 73 | |
| @@ -181,6 +179,27 @@ also be defined: @option{-DF(a)=a+1} · 105 unmodified lines |
| 181 | 179 | Undefine preprocessor symbol @samp{sym}. |
| 182 | 180 | @end table |
| 183 | 181 | |
| 182 | +Warning options: |
| 183 | + |
| 184 | +Note: each warning option has a negative form beginning with @option{-Wno-}. |
| 185 | + |
| 186 | +@table @option |
| 187 | +@item -Wunsupported |
| 188 | +Warn about unsupported GCC features that are ignored by TCC. |
| 189 | + |
| 190 | +@item -Wwrite-strings |
| 191 | +Make string constants being of type @code{const char *} intead of @code{char |
| 192 | +*}. |
| 193 | + |
| 194 | +@item -Werror |
| 195 | +Abort compilation if warnings are issued. |
| 196 | + |
| 197 | +@item -Wall |
| 198 | +Activate all warnings, except @option{-Werror}, @option{-Wunusupported} and |
| 199 | +@option{-Wwrite-strings} (currently not useful). |
| 200 | + |
| 201 | +@end table |
| 202 | + |
| 184 | 203 | Linker options: |
| 185 | 204 | |
| 186 | 205 | @table @option |
| @@ -201,6 +220,10 @@ must also be given). · 14 unmodified lines |
| 201 | 220 | Generate a statically linked executable (default is a shared linked |
| 202 | 221 | executable) (@option{-o} option must also be given). |
| 203 | 222 | |
| 223 | +@item -rdynamic |
| 224 | +Export global symbols to the dynamic linker. It is useful when a library |
| 225 | +opened with @code{dlopen()} needs to access executable symbols. |
| 226 | + |
| 204 | 227 | @item -r |
| 205 | 228 | Generate an object file combining all input files (@option{-o} option must |
| 206 | 229 | also be given). |
| @@ -227,7 +250,7 @@ Display N callers in stack traces. This is useful with @option{-g} or · 20 unmodified lines |
| 227 | 250 | |
| 228 | 251 | @end table |
| 229 | 252 | |
| 230 | | −Note: GCC options @option{-Ox}, @option{-Wx}, @option{-fx} and @option{-mx} are |
| 253 | +Note: GCC options @option{-Ox}, @option{-fx} and @option{-mx} are |
| 231 | 254 | ignored. |
| 232 | 255 | @c man end |
| 233 | 256 | |
| @@ -434,6 +457,9 @@ TCC includes its own x86 inline assembler with a @code{gas}-like (GNU · 200 unmodified lines |
| 434 | 457 | assembler) syntax. No intermediate files are generated. GCC 3.x named |
| 435 | 458 | operands are supported. |
| 436 | 459 | |
| 460 | +@item @code{__builtin_types_compatible_p()} and @code{__builtin_constant_p()} |
| 461 | +are supported. |
| 462 | + |
| 437 | 463 | @end itemize |
| 438 | 464 | |
| 439 | 465 | @section TinyCC extensions |
| @@ -531,6 +557,12 @@ They can be defined several times in the same source. Use 'b' · 91 unmodified lines |
| 531 | 557 | @cindex .short |
| 532 | 558 | @cindex .int |
| 533 | 559 | @cindex .long |
| 560 | +@cindex .string |
| 561 | +@cindex .globl |
| 562 | +@cindex .section |
| 563 | +@cindex .text |
| 564 | +@cindex .data |
| 565 | +@cindex .bss |
| 534 | 566 | |
| 535 | 567 | All directives are preceeded by a '.'. The following directives are |
| 536 | 568 | supported: |
| @@ -544,6 +576,12 @@ supported: · 7 unmodified lines |
| 544 | 576 | @item .short value1[,value2...] |
| 545 | 577 | @item .int value1[,value2...] |
| 546 | 578 | @item .long value1[,value2...] |
| 579 | +@item .string string |
| 580 | +@item .global symbol |
| 581 | +@item .section section |
| 582 | +@item .text |
| 583 | +@item .data |
| 584 | +@item .bss |
| 547 | 585 | @end itemize |
| 548 | 586 | |
| 549 | 587 | @section X86 Assembler |
| @@ -569,10 +607,10 @@ Dynamic ELF libraries can be output but the C compiler does not generate · 19 unmodified lines |
| 569 | 607 | position independent code (PIC). It means that the dynamic librairy |
| 570 | 608 | code generated by TCC cannot be factorized among processes yet. |
| 571 | 609 | |
| 572 | | −TCC linker cannot currently eliminate unused object code. But TCC |
| 573 | | −will soon integrate a novel feature not found in GNU tools: unused code |
| 574 | | −will be eliminated at the function or variable level, provided you only |
| 575 | | −use TCC to compile your files. |
| 610 | +TCC linker eliminates unreferenced object code in libraries. A single pass is |
| 611 | +done on the object and library list, so the order in which object files and |
| 612 | +libraries are specified is important (same constraint as GNU ld). No grouping |
| 613 | +options (@option{--start-group} and @option{--end-group}) are supported. |
| 576 | 614 | |
| 577 | 615 | @section ELF file loader |
| 578 | 616 | |
| @@ -584,12 +622,15 @@ libraries (.so). · 5 unmodified lines |
| 584 | 622 | @cindex linker scripts |
| 585 | 623 | @cindex GROUP, linker command |
| 586 | 624 | @cindex FILE, linker command |
| 625 | +@cindex OUTPUT_FORMAT, linker command |
| 626 | +@cindex TARGET, linker command |
| 587 | 627 | |
| 588 | 628 | Because on many Linux systems some dynamic libraries (such as |
| 589 | 629 | @file{/usr/lib/libc.so}) are in fact GNU ld link scripts (horrible!), |
| 590 | 630 | the TCC linker also supports a subset of GNU ld scripts. |
| 591 | 631 | |
| 592 | | −The @code{GROUP} and @code{FILE} commands are supported. |
| 632 | +The @code{GROUP} and @code{FILE} commands are supported. @code{OUTPUT_FORMAT} |
| 633 | +and @code{TARGET} are ignored. |
| 593 | 634 | |
| 594 | 635 | Example from @file{/usr/lib/libc.so}: |
| 595 | 636 | @example |