Commit Graph

340 Commits (meesbs)

Author SHA1 Message Date
James Lyon 2bbfaf436f Tests in abitest.c now work on Win32.
I expect that Linux-x86 is probably fine. All other architectures
except ARM are definitely broken since I haven't yet implemented
gfunc_sret for these, although replicating the current behaviour
should be straightforward.
2013-04-18 17:27:34 +01:00
James Lyon ce5e12c2f9 Added ABI compatibility tests with native compiler using libtcc.
Only one test so far, which fails on Windows (with MinGW as the native
compiler - I've tested the MinGW output against MSVC and it appears the
two are compatible).

I've also had to modify tcc.h so that tcc_set_lib_path can point to the
directory containing libtcc1.a on Windows to make the libtcc dependent
tests work. I'm not sure this is the right way to fix this problem.
2013-04-17 21:52:44 +01:00
Andrew Aladjev 0ad857c80e added CPATH, C_INCLUDE_PATH and LD_LIBRARY_PATH 2013-02-19 14:47:36 +03:00
Thomas Preud'homme 5d6cfe855a Fix GNU Hurd interpreter path 2013-02-18 11:53:00 +01:00
Thomas Preud'homme e946c3583f Add support for KfreeBSD 64bits 2013-02-18 11:42:49 +01:00
Urs Janssen 0bdbd49eac add version number to manpage
avoid c++/c99 style comments in preprocessor directives
avoid leadings whitespaces in preprocessor directives
mention implemented variable length arrays in documentation
fixed ambiguous option in texi2html call (Austin English)
2013-02-17 00:48:51 +01:00
Urs Janssen cec76c8b8a - document -dumpversion
- fixed a broken prototype
2013-02-15 12:48:33 +01:00
Thomas Preud'homme 0928761257 Revert "Don't search libgcc_s.so.1 on /lib64"
This reverts commit b9f089fc4a.
2013-02-14 23:52:11 +01:00
Thomas Preud'homme b9f089fc4a Don't search libgcc_s.so.1 on /lib64
It seems libgcc_s.so.1 is systematically on /lib/ (whether
/lib/$triplet for multiarch systems or just /lib for other systems).
2013-02-14 18:05:55 +01:00
grischka 762a43877b configure: pass CONFIG_xxxDIR/PATH options via commandline
- except for CONFIG_SYSROOT and CONFIG_TCCDIR

Strictly neccessary it is only for CONFIG_MULTIARCHDIR
because otherwise if it's in config.h it is impossible to
leave it undefined.

But it is also nicer not to use these definitions for
cross-compilers.

- Also:
lib/Makefile : include ../Makefile for CFLAGS
lib/libtcc1.c : fix an issue compiling tcc with tcc on x64
2013-02-14 17:43:24 +01:00
grischka 944627c479 configure: cleanup
- add quotes: eval opt=\"$opt\"
- use $source_path/conftest.c for OOT build
- add fn_makelink() for OOT build
- do not check lddir etc. on Windows/MSYS
- formatting

config-print.c
- rename to conftest.c (for consistency)
- change option e to b
- change output from that from "yes" to "no"
- remove inttypes.h dependency
- simpify version output

Makefile:
- improve GCC warning flag checks

tcc.h:
- add back default CONFIG_LDDIR
- add default CONFIG_TCCDIR also (just for fun)

tccpp.c:
- fix Christian's last warning
  tccpp.c: In function ‘macro_subst’:
  tccpp.c:2803:12: warning: ‘*((void *)&cval+4)’ is used uninitialized
     in this function [-Wuninitialized]
  That the change fixes the warning doesn't make sense but anyway.

libtcc.c:
- tcc_error/warning: print correct source filename/line for
  token :paste: (also inline :asm:)

lddir and multiarch logic still needs fixing.
2013-02-14 06:53:07 +01:00
Thomas Preud'homme f9ac201377 Detect multiarch triplet and lddir from ldd output 2013-02-13 20:14:13 +01:00
Thomas Preud'homme f6cfaa6d25 Improve multiarch detection
* Detect multiarch at configure time
* Detect based on the place where crti.o is
* Define multiarch triplet in tcc.h
2013-02-13 17:03:30 +01:00
grischka 05108a3b0a libtcc: new LIBTCCAPI tcc_set_options(TCCState*, const char*str)
This replaces       -> use instead:
-----------------------------------
- tcc_set_linker    -> tcc_set_options(s, "-Wl,...");
- tcc_set_warning   -> tcc_set_options(s, "-W...");
- tcc_enable_debug  -> tcc_set_options(s, "-g");

parse_args is moved to libtcc.c (now tcc_parse_args).

Also some cleanups:
- reorder TCCState members
- add some comments here and there
- do not use argv's directly, make string copies
- use const char* in tcc_set_linker
- tccpe: use fd instead of fp

tested with -D MEM_DEBUG: 0 bytes left
2013-02-12 19:13:28 +01:00
grischka 8042121d74 tcc -vv/--print-search-dirs: print more info
tests/Makefile:
- print-search-dirs when 'hello' fails
- split off hello-run

win32/include/_mingw.h:
- fix for compatibility with mingw headers
  (While our headers in win32 are from mingw-64 and don't have
  the problem)

tiny_libmaker:
- don't use "dangerous" mktemp
2013-02-10 00:38:40 +01:00
grischka d6d7686b60 tcc.h: declare CValue.tab[LDOUBLE_SIZE/4]
Should fix some warnings wrt. access out of array bounds.

tccelf.c: fix "static function unused" warning
x86_64-gen.c: fix "ctype.ref uninitialzed" warning and cleanup
tcc-win32.txt: remove obsolete limitation notes.
2013-02-08 19:07:11 +01:00
grischka 7a477d70ca lib/Makefile: use CC, add bcheck to libtcc1.a
Also:
- fix "make tcc_p" (profiling version)
- remove old gcc flags:
  -mpreferred-stack-boundary=2 -march=i386 -falign-functions=0
- remove test "hello" for Darwin (cannot compile to file)
2013-02-06 19:01:07 +01:00
grischka 82bcbd027f portability: fix void* <-> target address conversion confusion
- #define addr_t as ElfW(Addr)
- replace uplong by addr_t
- #define TCC_HAS_RUNTIME_PLTGOT and use it
2013-02-04 16:24:59 +01:00
grischka 3186455599 Makefile: allow CONFIG_LDDIR=lib64 configuration 2013-02-04 16:24:58 +01:00
grischka 263dc93cfa c67: remove global #define's for TRUE/FALSE/BOOL
Also use uppercase TRUE/FALSE instead of true/false
2013-02-04 16:24:56 +01:00
grischka c5892fe4f5 Revert "Optimize vswap()"
This reverts commit 63193d1794.

Had some problems (_STATIC_ASSERT) and was too ugly anyway.
For retry, I'd suggest to implement a general function
    static inline void memswap (void *p1, void* p2, size_t n);
and then use that.  If you do so, please keep the original code
as comment.
2013-01-14 18:41:37 +01:00
Thomas Preud'homme 8c56b0cf90 Revert "Added what I call virtual io to tinycc this way we can make a monolitic executable or library that contains all needed to compile programs, truly tinycc portable."
This reverts commit 59e18aee0e.
tcc is being stabilized now in order to do a new release soon.
Therefore, such a change is not appropriate now.
2013-01-14 17:34:07 +01:00
mingodad 59e18aee0e Added what I call virtual io to tinycc this way we can make a monolitic executable or library that contains all needed to compile programs, truly tinycc portable.
Tested under linux exec the "mk-it" shell script and you'll end up with a portable tinycc executable that doesn't depend on anything else.
2013-01-11 00:04:38 +00:00
grischka 2358b378b3 tccpp: alternative fix for #include_next infinite loop bug
This replaces commit 3d409b0889

- revert old fix in libtcc.c
- #include_next: look up the file in the include stack to see
  if it is already included.
Also:
- streamline include code
- remove 'type' from struct CachedInclude (obsolete because we check
  full filename anyway)
- remove inc_type & inc_filename from struct Bufferedfile (obsolete)
- fix bug with TOK_FLAG_ENDIF not being reset
- unrelated: get rid of an 'variable potentially uninitialized' warning
2013-01-06 17:20:44 +01:00
Kirill Smelkov 63193d1794 Optimize vswap()
vswap() is called often enough and shows in profile and it was easy to
hand optimize swapping vtop[-1] and vtop[0] - instead of large (28 bytes
on i386) tmp variable and two memory to memory copies, let's swap areas
by longs through registers with streamlined assembly.

For

    $ ./tcc -B. -bench -DONE_SOURCE -DCONFIG_MULTIARCHDIR=\"i386-linux-gnu\" -c tcc.c

before:

 # Overhead      Command        Shared Object                                          Symbol
 # ........  ...........  ...................  ..............................................
 #
     15.19%          tcc  tcc                  [.] next_nomacro1
      5.19%          tcc  libc-2.13.so         [.] _int_malloc
      4.57%          tcc  tcc                  [.] next
      3.36%          tcc  tcc                  [.] tok_str_add2
      3.03%          tcc  tcc                  [.] macro_subst_tok
      2.93%          tcc  tcc                  [.] macro_subst
      2.53%          tcc  tcc                  [.] next_nomacro_spc
      2.49%          tcc  tcc                  [.] vswap
      2.36%          tcc  libc-2.13.so         [.] _int_free

       │    ST_FUNC void vswap(void)
       │    {
  1,96 │      push   %edi
  2,65 │      push   %esi
  1,08 │      sub    $0x20,%esp
       │        SValue tmp;
       │
       │        /* cannot let cpu flags if other instruction are generated. Also
       │           avoid leaving VT_JMP anywhere except on the top of the stack
       │           because it would complicate the code generator. */
       │        if (vtop >= vstack) {
  0,98 │      mov    0x8078cac,%eax
       │      cmp    $0x8078d3c,%eax
  1,18 │   ┌──jb     24
       │   │        int v = vtop->r & VT_VALMASK;
  1,08 │   │  mov    0x8(%eax),%edx
  0,78 │   │  and    $0x3f,%edx
       │   │        if (v == VT_CMP || (v & ~1) == VT_JMP)
  0,78 │   │  cmp    $0x33,%edx
  0,69 │   │↓ je     54
  0,59 │   │  and    $0xfffffffe,%edx
  0,49 │   │  cmp    $0x34,%edx
  0,29 │   │↓ je     54
       │   │            gv(RC_INT);
       │   │    }
       │   │    tmp = vtop[0];
  1,08 │24:└─→lea    0x4(%esp),%edi
  0,39 │      mov    $0x7,%ecx
       │      mov    %eax,%esi
 14,41 │      rep    movsl %ds:(%esi),%es:(%edi)
       │        vtop[0] = vtop[-1];
  9,51 │      lea    -0x1c(%eax),%esi
  1,96 │      mov    $0x7,%cl
       │      mov    %eax,%edi
 17,06 │      rep    movsl %ds:(%esi),%es:(%edi)
       │        vtop[-1] = tmp;
 10,20 │      mov    0x8078cac,%edi
  2,35 │      sub    $0x1c,%edi
  0,78 │      lea    0x4(%esp),%esi
       │      mov    $0x7,%cl
 15,20 │      rep    movsl %ds:(%esi),%es:(%edi)
       │    }
  9,90 │      add    $0x20,%esp
  2,25 │      pop    %esi
  1,67 │      pop    %edi
  0,69 │      ret

after:

 # Overhead      Command        Shared Object                                          Symbol
 # ........  ...........  ...................  ..............................................
 #
     15.27%          tcc  tcc                  [.] next_nomacro1
      5.08%          tcc  libc-2.13.so         [.] _int_malloc
      4.57%          tcc  tcc                  [.] next
      3.17%          tcc  tcc                  [.] tok_str_add2
      3.12%          tcc  tcc                  [.] macro_subst
      2.99%          tcc  tcc                  [.] macro_subst_tok
      2.43%          tcc  tcc                  [.] next_nomacro_spc
      2.32%          tcc  libc-2.13.so         [.] _int_free

      . . .

      0.71%          tcc  tcc                  [.] vswap

       │    ST_FUNC void vswap(void)
       │    {
  7,22 │      push   %eax
       │        /* cannot let cpu flags if other instruction are generated. Also
       │           avoid leaving VT_JMP anywhere except on the top of the stack
       │           because it would complicate the code generator. */
       │        if (vtop >= vstack) {
 11,34 │      mov    0x8078cac,%eax
  2,75 │      cmp    $0x8078d3c,%eax
  0,34 │   ┌──jb     20
       │   │        int v = vtop->r & VT_VALMASK;
  0,34 │   │  mov    0x8(%eax),%edx
  8,93 │   │  and    $0x3f,%edx
       │   │        if (v == VT_CMP || (v & ~1) == VT_JMP)
  2,06 │   │  cmp    $0x33,%edx
  2,41 │   │↓ je     74
  2,41 │   │  and    $0xfffffffe,%edx
  0,34 │   │  cmp    $0x34,%edx
  2,41 │   │↓ je     74
       │   │        vtopl[-1*VSIZEL + i] = tmpl;    \
       │   │      } do {} while (0)
       │   │
       │   │    VSWAPL(15); VSWAPL(14); VSWAPL(13); VSWAPL(12);
       │   │    VSWAPL(11); VSWAPL(10); VSWAPL( 9); VSWAPL( 8);
       │   │    VSWAPL( 7); VSWAPL( 6); VSWAPL( 5); VSWAPL( 4);
  2,06 │20:└─→mov    0x18(%eax),%edx
  1,37 │      mov    -0x4(%eax),%ecx
  2,06 │      mov    %ecx,0x18(%eax)
  1,37 │      mov    %edx,-0x4(%eax)
  2,06 │      mov    0x14(%eax),%edx
  2,06 │      mov    -0x8(%eax),%ecx
  2,41 │      mov    %ecx,0x14(%eax)
  3,09 │      mov    %edx,-0x8(%eax)
  3,09 │      mov    0x10(%eax),%edx
  1,72 │      mov    -0xc(%eax),%ecx
  2,75 │      mov    %ecx,0x10(%eax)
  1,72 │      mov    %edx,-0xc(%eax)
       │        VSWAPL( 3); VSWAPL( 2); VSWAPL( 1); VSWAPL( 0);
  2,41 │      mov    0xc(%eax),%edx
  2,41 │      mov    -0x10(%eax),%ecx
  2,41 │      mov    %ecx,0xc(%eax)
  0,69 │      mov    %edx,-0x10(%eax)
  1,72 │      mov    0x8(%eax),%edx
  0,69 │      mov    -0x14(%eax),%ecx
  1,03 │      mov    %ecx,0x8(%eax)
  1,37 │      mov    %edx,-0x14(%eax)
  1,37 │      mov    0x4(%eax),%edx
  0,69 │      mov    -0x18(%eax),%ecx
  3,09 │      mov    %ecx,0x4(%eax)
  2,06 │      mov    %edx,-0x18(%eax)
  1,37 │      mov    (%eax),%edx
  2,41 │      mov    -0x1c(%eax),%ecx
  1,37 │      mov    %ecx,(%eax)
  4,12 │      mov    %edx,-0x1c(%eax)
       │        }
       │
       │    #   undef VSWAPL
       │    #   undef VSIZEL
       │    }
  1,03 │      pop    %eax
  3,44 │      ret

Overal speedup:

    # best of 5 runs
    before: 8268 idents, 47203 lines, 1526763 bytes, 0.148 s, 319217 lines/s, 10.3 MB/s
    after:  8273 idents, 47231 lines, 1527685 bytes, 0.146 s, 324092 lines/s, 10.5 MB/s

Static ASSERT macro taken from CCAN's[1] build_assert[2] which is in
public domain.

[1] http://ccodearchive.net/
[2] http://git.ozlabs.org/?p=ccan;a=blob;f=ccan/build_assert/build_assert.h;h=24e59c44cd930173178ac9b6e101b0af64a879e9;hb=HEAD
2012-12-21 20:46:26 +04:00
Kirill Smelkov 8eb92e6052 Optimize cstr_reset() to only reset string to empty, not call free() and later malloc()
A CString could be reset to empty just setting its .size to 0.

If memory was already allocated, that would be remembered in
.data_allocated and .size_allocated and on consequent string
manipulations that memory will be used without immediate need to call
malloc().

For

    $ ./tcc -B. -bench -DONE_SOURCE -DCONFIG_MULTIARCHDIR=\"i386-linux-gnu\" -c tcc.c

after the patch malloc/free are called less often:

(tcc is run in loop; perf record -a sleep 10 && perf report)
before:

 # Overhead      Command       Shared Object                                      Symbol
 # ........  ...........  ..................  ..........................................
 #
     13.89%          tcc  tcc                 [.] next_nomacro1
      4.73%          tcc  libc-2.13.so        [.] _int_malloc
      4.39%          tcc  tcc                 [.] next
      2.94%          tcc  tcc                 [.] tok_str_add2
      2.78%          tcc  tcc                 [.] macro_subst_tok
      2.75%          tcc  libc-2.13.so        [.] free
      2.74%          tcc  tcc                 [.] macro_subst
      2.63%          tcc  libc-2.13.so        [.] _int_free
      2.28%          tcc  tcc                 [.] vswap
      2.24%          tcc  tcc                 [.] next_nomacro_spc
      2.06%          tcc  libc-2.13.so        [.] realloc
      2.00%          tcc  libc-2.13.so        [.] malloc
      1.99%          tcc  tcc                 [.] unary
      1.85%          tcc  libc-2.13.so        [.] __i686.get_pc_thunk.bx
      1.76%  kworker/0:1  [kernel.kallsyms]   [k] delay_tsc
      1.70%          tcc  tcc                 [.] next_nomacro
      1.62%          tcc  tcc                 [.] preprocess
      1.41%          tcc  libc-2.13.so        [.] __memcmp_ssse3
      1.38%          tcc  [kernel.kallsyms]   [k] memset
      1.10%          tcc  tcc                 [.] g
      1.06%          tcc  tcc                 [.] parse_btype
      1.05%          tcc  tcc                 [.] sym_push2
      1.04%          tcc  libc-2.13.so        [.] _int_realloc
      1.00%          tcc  libc-2.13.so        [.] malloc_consolidate

after:

 # Overhead      Command       Shared Object                                          Symbol
 # ........  ...........  ..................  ..............................................
 #
     15.26%          tcc  tcc                 [.] next_nomacro1
      5.07%          tcc  libc-2.13.so        [.] _int_malloc
      4.62%          tcc  tcc                 [.] next
      3.22%          tcc  tcc                 [.] tok_str_add2
      3.03%          tcc  tcc                 [.] macro_subst_tok
      3.02%          tcc  tcc                 [.] macro_subst
      2.59%          tcc  tcc                 [.] next_nomacro_spc
      2.44%          tcc  tcc                 [.] vswap
      2.39%          tcc  libc-2.13.so        [.] _int_free
      2.28%          tcc  libc-2.13.so        [.] free
      2.22%          tcc  tcc                 [.] unary
      2.07%          tcc  libc-2.13.so        [.] realloc
      1.97%          tcc  libc-2.13.so        [.] malloc
      1.70%          tcc  tcc                 [.] preprocess
      1.69%          tcc  libc-2.13.so        [.] __i686.get_pc_thunk.bx
      1.68%          tcc  tcc                 [.] next_nomacro
      1.59%          tcc  [kernel.kallsyms]   [k] memset
      1.55%          tcc  libc-2.13.so        [.] __memcmp_ssse3
      1.22%          tcc  tcc                 [.] parse_comment
      1.11%          tcc  tcc                 [.] g
      1.11%          tcc  tcc                 [.] sym_push2
      1.10%          tcc  tcc                 [.] parse_btype
      1.10%          tcc  libc-2.13.so        [.] _int_realloc
      1.06%          tcc  tcc                 [.] vsetc
      0.98%          tcc  libc-2.13.so        [.] malloc_consolidate

and this gains small speedup for tcc:

    # best of 5 runs
    before: 8268 idents, 47191 lines, 1526670 bytes, 0.153 s, 307997 lines/s, 10.0 MB/s
    after:  8268 idents, 47203 lines, 1526763 bytes, 0.148 s, 319217 lines/s, 10.3 MB/s
2012-12-21 20:46:26 +04:00
Kirill Smelkov a55ecf6d2c Repair bounds-checking more, this time `tcc -b -run tcc.c -run tcc.c -run tcctest.c` works
Hello up there. On the list Grischka made a point that we can't recommend using
-b as long as tcc -b tcc.c doesn't produce anything useful. Now it does, so
please don't treat -b mode as second class citizen anymore.

Thanks,
Kirill

* bcheck2:
  tests: Add tests for compile/run tcc.c with `tcc -b` then compile tcc.c again, then run tcctest.c
  lib/bcheck: Fix code typo in __bound_delete_region()
  lib/bcheck: Don't assume heap goes right after bss
  Make tcc work after self-compiling with bounds-check enabled
2012-12-09 19:51:20 +04:00
Kirill Smelkov 43a11a7ed1 Make tcc work after self-compiling with bounds-check enabled
For vstack Fabrice used the trick to initialize vtop to &vstack[-1], so
that on first push, vtop becomes &vstack[0] and a value is also stored
there - everything works.

Except that when tcc is compiled with bounds-checking enabled, vstack - 1
returns INVALID_POINTER and oops...

Let's workaround it with artificial 1 vstack slot which will not be
used, but only serve as an indicator that pointing to &vstack[-1] is ok.

Now, tcc, after being self-compiled with -b works:

    $ ./tcc -B. -o tccb  -DONE_SOURCE -DCONFIG_MULTIARCHDIR=\"i386-linux-gnu\" tcc.c  -ldl
    $ cd tests
    $ ../tcc -B.. -run tcctest.c >1
    $ ../tccb -B.. -run tcctest.c >2
    $ diff -u 1 2

and note, tcc's compilation speed is not affected:

    $ ./tcc -B. -bench -DONE_SOURCE -DCONFIG_MULTIARCHDIR=\"i386-linux-gnu\" -c tcc.c

    before: 8270 idents, 47221 lines, 1527730 bytes, 0.152 s, 309800 lines/s, 10.0 MB/s
    after:  8271 idents, 47221 lines, 1527733 bytes, 0.152 s, 310107 lines/s, 10.0 MB/s

But note, that `tcc -b -run tcc` is still broken - for example it crashes
on
    $ cat x.c
    double get100 () { return 100.0; }

    $ ./tcc -B. -b -DTCC_TARGET_I386 -DCONFIG_MULTIARCHDIR=\"i386-linux-gnu\"  -run   \
        -DONE_SOURCE ./tcc.c -B. -c x.c
    Runtime error: dereferencing invalid pointer
    ./tccpp.c:1953: at 0xa7beebdf parse_number() (included from ./libtcc.c, ./tcc.c)
    ./tccpp.c:3003: by 0xa7bf0708 next() (included from ./libtcc.c, ./tcc.c)
    ./tccgen.c:4465: by 0xa7bfe348 block() (included from ./libtcc.c, ./tcc.c)
    ./tccgen.c:4440: by 0xa7bfe212 block() (included from ./libtcc.c, ./tcc.c)
    ./tccgen.c:5529: by 0xa7c01929 gen_function() (included from ./libtcc.c, ./tcc.c)
    ./tccgen.c:5767: by 0xa7c02602 decl0() (included from ./libtcc.c, ./tcc.c)

that's because lib/bcheck.c runtime needs more fixes -- see next
patches.
2012-12-09 18:06:09 +04:00
Thomas Preud'homme c4a18f47a2 Detect ARM CPU version in configure
Instead of guessing the ARM CPU version to compile for from tcc.h, we
now detect it in configure and output the value in config.h
2012-12-04 11:17:51 +01:00
Thomas Preud'homme e2212738d4 Generate PLT thumb stub only when necessary
Generate PLT thumb stub for an ARM PLT entry only when at least one
Thumb instruction branches to that entry. This is a rewrite of the
previous patch.
2012-11-17 10:01:11 +01:00
Thomas Preud'homme 1af3bca4ea Revert "Generate PLT thumb stub only when necessary"
Revert commit 891dfcdf3f since it assumes
*all* architectures supported by tcc have GOT offsets aligned on 2. A
rework of this commit is being done since without it all PLT entries
grow by 4 bytes.
2012-11-12 23:14:21 +01:00
Thomas Preud'homme 891dfcdf3f Generate PLT thumb stub only when necessary
Generate PLT thumb stub for an ARM PLT entry only when at least one
Thumb instruction branches to that entry.

Warning: To save space, this commit reuses the bit 0 of entries of
got_offsets array. The GOT offset is thus saved in a 31 bit value.
Make sure to divide by 2 (right shift by 1) an offset before storing it
there and conversely to multiply the value by 2 (left shift by 1) before
using it.
2012-11-07 20:51:33 +01:00
Thomas Preud'homme 9966fd4eae Only use blx if available
Introduce ARM version for the target architecture in order to determine
if blx instruction can be used or not. Availability of blx instruction
allows for more scenarii supported in R_ARM_CALL relocation. It should
also be useful when introducing support for the R_ARM_THM_CALL
relocation.
2012-10-16 00:31:56 +02:00
Thomas Preud'homme 7f6095bfec Add support for arm hardfloat calling convention
See Procedure Call Standard for the ARM Architecture (AAPCS) for more
details.
2012-06-05 23:09:55 +02:00
Thomas Preud'homme bfb00494eb Fix removal of vnrott
Make vrotb ST_FUNC so that arm-gen.c can use vrotb.
2012-06-05 23:09:55 +02:00
Thomas Preud'homme b56edc7b90 Several multiarch/biarch fixes
* Add multiarch directories for arm and i386
* Fix detection of biarch: /lib64/ld-linux-x86-64.so.2 is mandated by
  ABI and is thus always present, even if there is no biarch
* Define CONFIG_LDDIR directly with the right value in case of multiarch
  instead of defining it to /lib and then redifining it.
2012-05-23 00:14:15 +02:00
Thomas Preud'homme a2c71af1ea Fix CONFIG_LDDIR usage
This patch fix 2 bugs in CONFIG_LDDIR usage:

* CONFIG_LDDIR used for 2 purposes

  there is confusion between the directory to find libraries, crt* files
  and headers and the directory in which the program interpreter is.
  These two directories are not related. The latter is specified by the
  ABI and should not be configurable while the former depends on the
  system (single arch, biarch, multiarch). This end a longstanding issue
  with amd64 program interpreter later propagated to other architecture
  interpreters.

* If multiarch is in effect, then the library directory should be /lib.
  /lib64 denotes biarch architecture, everything which is here would be
  in /lib/x86_64-linux-gnu instead.
2012-05-22 23:44:03 +02:00
Michael Matz 718fd591fa Make sizeof() be of type size_t
This matters when sizeof is directly used in arithmetic,
ala "uintptr_t t; t &= -sizeof(long)" (for alignment).  When sizeof
isn't size_t (as it's specified to be) this masking will truncate
the high bits of the uintptr_t object (if uintptr_t is larger than
uint).
2012-04-18 20:57:14 +02:00
grischka f98c2306a0 libtcc: tcc_get_symbol uses the TCCState parameter
This allows using tcc_get_symbol on some other than the
current TCCState. (Suggested by David Mertens)
2012-04-18 18:48:26 +02:00
grischka 32a411914b support "x86_64-linux-gnu" subdirs with lib & include
suggested for newer ubuntu by Damian Gryski
2012-04-18 18:44:39 +02:00
grischka 3c59f84240 tcc.h: unify multiple #ifdef CONFIG_TCC_BACKTRACE 2012-04-18 18:43:29 +02:00
grischka ab936aeb8c cleanup some partially broken patches
- tests/Makefile:
  fix commit de54586d5b
  This hunk it unrelated to the other changes (which are about MacOSX).
  It is not useful and partially wrong.  Optional tests are meant to
  stay optional, btest would work only for i386

- tcc.h:
  fix commit c52d79605a by unknown
  The message says it's for MINTW but the patch has obviously
  no effect for MINGW (which defines __GNUC__).  However the patch
  seems useful for MSC which however needs _strto(u)i64 with underscore.

- Makefile:
  fix commit 5280293d6b
  Do not build tcc.o with -DONE_SOURCE because we finally build tcc
  from tcc.o and libtcc.a/so
2012-04-18 18:43:09 +02:00
grischka 4274c44de7 tcc.c: fix previous commit "Use CString to concat linker options"
- remove redunant else branch
- zero-terminate linker_arg
- declare cstr_xxx as PUB_FUNC
  (which are functions used in tcc.c but not in the libtcc API.
   Useful for a tcc(.exe) that uses the libtcc.(so/dll))
- while at it, export PUB_FUNCs from dll
2012-04-18 18:32:37 +02:00
unknown c52d79605a fix mingw compliation 2012-03-16 08:54:29 +08:00
Thomas Preud'homme 53c5715cca Remove vnrott (duplicate vrotb) 2012-03-14 15:39:16 +01:00
grischka ae191c3a61 x86_64: fix loading of LLOCAL floats
See also commit 9527c4949f

On x86_64 we need to extend the reg_classes array because load()
is called for (at least) R11 too, which was not part of reg_classes
previously.
2012-03-05 20:19:28 +01:00
grischka a35b3059bb tcc.h: define TCC_IS_NATIVE
- disable tccrun feature for non-native (cross-) compilers
- define uplong for target adress size
- fix using -Wl,-Ttext=... for Win64 (tccpe: ADDR3264 imagebase)
2012-03-05 20:15:56 +01:00
Andrew Mulbrook a0db7162af Fix assumption of 32bit long on portions of Elf
Modify tcc to accept convert full 64bits of specified text section
when converting on Win64. Write high bytes to the elf section address
as well. This allows creation of elf binaries located in offsets using
full 64 bit addresses.

Signed-off-by: Andrew Mulbrook <andrew262@gmail.com>
2012-03-03 11:10:15 -06:00
Andrew Mulbrook 5775911dad Revert "Multiple fixes for 64 bit sections"
This reverts commit d7a7c3769d.
2012-03-03 10:12:06 -06:00
mob d7a7c3769d Multiple fixes for 64 bit sections
This changeset attempts to fix a few problems when giving using
the high 32bits of a 64bit section offset. There are likely more
issues (or perhaps regressions) lurking in the muck here. In general,
this moves a few data type declarations to use uplong.  Also, add
support for 64bit mingw32 building under cygwin.  Because native
types are used for 64 bit offsets, this won't fix challenges with
cross compiling from 32bit -> 64bit.

Tested under cygwin, against binary compiled with
-Wl,-Ttext=0xffffff8000000000

Signed-off-by: Andrew Mulbrook <andrew262@gmail.com>
2012-02-26 19:02:51 -06:00
Thomas Preud'homme 2dd3fb103e Don't define strtold and strtof on *BSD + uClibc
Don't define strtold and strtof on *BSD and uClibc as they are already
defined there since:

* 2001 (FreeBSD 4.4)
* 2009 (OpenBSD 4.5)
* 2009 (DragonFlyBSD)
* 2002 (uClibc)

See
http://lists.nongnu.org/archive/html/tinycc-devel/2011-07/msg00025.html
for a bit more details.
2011-08-12 18:43:37 +02:00
grischka bf374a5f23 rename error/warning -> tcc_(error/warning) 2011-08-11 17:07:56 +02:00
grischka 74a24d77fd libtcc: minor adjustments
- use {B} to substitute tcc_lih_path (instead of \b)

- expand CONFIG_TCC_CRTPREFIX in CONFIG_TCC_LIBPATHS
  which fixes duplicate CONFIG_SYSROOT.

- put default CONFIG_SYSROOT ("") into tcc.h

- remove hack from commit db6fcce78f
  because $(tccdir)/include is already in sysincludes

- configure: error out for unrecognized options.

- win32/build-tcc.bat: put libtcc into base dir where it will
  find lib/include automatically, and build libtcc_test example.
2011-08-11 16:55:30 +02:00
grischka e844fb11c2 libtcc: support more than one crtprefix
Looks like gcc has that.  Oh Deer!
2011-08-06 16:49:30 +02:00
grischka e6f3bf7f08 libtcc: cleanup the 'gen_makedeps' stuff 2011-08-06 16:11:58 +02:00
grischka 39a07cca58 tcc: fix -m32/64 & simplify
This cleans up the mess from commit
   8f98573658
and preceeding.

- make tcc -m64 work on windows
- execvp on windows returns 0 always, replace by spawnvp
- remove bizarre support for i386-win32-tcc -m64
2011-08-06 16:11:58 +02:00
grischka f115c12346 x86-64: fix flags and zero-pad long doubles
This fixes a bug introduced in commit
    8d107d9ffd
that produced wrong code because of interference between
0x10 bits VT_CONST and x86_64-gen.c:TREG_MEM

Also fully zero-pad long doubles on x86-64 to avoid random
bytes in output files which disturb file comparison.
2011-08-06 16:11:56 +02:00
grischka 81cd0cf6fd configure: add switches to set search paths
--sysincludepaths=.. specify system include paths, colon separated"
     Sets CONFIG_TCC_SYSINCLUDEPATHS

   --libpaths=...       specify system library paths, colon separated"
     Sets CONFIG_TCC_LIBPATHS

   --crtprefix=...      specify location of crt?.o"
     Sets CONFIG_TCC_CRTPREFIX

   --elfinterp=...      specify elf interpreter"
     Sets CONFIG_TCC_ELFINTERP

Also the CONFIG_TCC_XXX were renamed to make them look
more consistent.

Also move the elf_interp definitions to tcc.h.
2011-08-06 16:11:12 +02:00
Thomas Preud'homme 0b6652003c Revert "Add a --multiarch-triplet switch to configure"
This reverts commit 76adc5770f.
2011-08-03 22:26:39 +02:00
Thomas Preud'homme 76adc5770f Add a --multiarch-triplet switch to configure
Add a --multiarch-triplet switch to configure. The switch will allow
files to be search for each default path in path/<triplet> and then
path.
Default paths handled that way:
- CONFIG_TCC_SYSINCLUDE_PATHS
- CONFIG_TCC_LIBPATH
- path to crt*.o
- path to libgcc_s.so.1

Path missing: elf interpreter path (will be handled in another commit)
2011-08-02 00:31:17 +02:00
Thomas Preud'homme 5e954fef32 Set CONFIG_TCC_CRT_PREFIX relative to CONFIG_SYSROOT
Set CONFIG_TCC_CRT_PREFIX relative to CONFIG_SYSROOT for consistency
with CONFIG_TCC_LDDIR.
2011-08-01 15:39:38 +02:00
grischka df9cce24a8 Accept colon separated paths with -L and -I
This allows passing colon separated paths to
  tcc_add_library_path
  tcc_add_sysinclude_path
  tcc_add_include_path

Also there are new configure variables
  CONFIG_TCC_LIBPATH
  CONFIG_TCC_SYSINCLUDE_PATHS
which define the lib/sysinclude paths all in one and can
be overridden from configure/make

For TCC_TARGET_PE semicolons (;) are used as separators

Also, \b in the path string is replaced by s->tcc_lib_path
(CONFIG_TCCDIR rsp. -B option)
2011-08-01 01:10:36 +02:00
grischka 8d107d9ffd win64: va_arg with structures 2011-07-14 19:24:53 +02:00
grischka aa80e5b1ff tccpe: cleanup ELFW() macros etc. 2011-07-14 19:23:04 +02:00
grischka df4c0892f3 tccrun: win64: add unwind function table for dynamic code
This works only when tcc.exe is compiled using MSC.  MinGW does
something in the startup code that defeats it.
2011-07-14 19:09:49 +02:00
grischka 5280293d6b make: create native tcc from separate objects
This was already possible using
    make NOTALLINONE=1
and is now the default.

To build as previously from one big source, use
    make ONE_SOURCE=1

Cross compilers are still build from one source because using
separate objects requires separate build directories one per
platform which currently is not (yet) supported by the makefile.

We could probably use gnu-makeish target variables like
    $(I386_CROSS): OUTDIR=build/i386
    $(X64_CROSS): OUTDIR=build/x86-64
and so on ...

Also NEED_FLOAT_TYPES for arm-gen is removed.  It was about
variables that are referenced from outside (libtcc, tccgen).
We could declare them in tcc.h (as with reg_classes) or have
them twice in arm-gen.c.  I chose option 2.
2011-07-14 18:45:37 +02:00
grischka 45184e01d8 win32: add -Wl,--stack=xxx switch
For example:

    $ tcc -Wl,--stack=4194309

which means 4 MB.  Default is 1 MB.
2011-07-11 18:47:16 +02:00
Thomas Preud'homme 4d6a4a26e0 Add configuration of include subdirectories
Add the possibility to search headers in several subdirectories of
/usr/local/include and /usr/include. A possible use case would be for
tcc to search for headers in /usr/local/include/x86_64-linux-gnu,
/usr/local/include, /usr/include/x86_64-linux-gnu and /usr/include in
turn.
2011-07-07 12:10:57 +02:00
Thomas Preud'homme 31ca000d72 Add multiarch dirs to linker search path
By default, tcc search libraries in /lib and /usr/local/lib while crt*.o
files are searched in /usr/lib and ld.so is searched in /lib.
Unfortunetely the path are hardcoded in source code. This patch allow
tcc to look in an other directory and also to look in extra directories.
It's then possible to make tcc search libraries in /lib/x86_64-linux-gnu
and /usr/local/lib/x86_64-linux-gnu while crt*.o files are searched in
/usr/lib/x86_64-linux-gnu and ld.so is searched in
/lib/x86_64-linux-gnu.
2011-07-05 11:16:12 +02:00
Joe Soroka 1446b543ae VLA fix [3/3]: store VLA sizeofs in anonymous runtime stack vars 2011-04-09 22:52:25 -07:00
Joe Soroka ace0f7f259 re-apply VLA by Thomas Preud'homme 2011-04-06 09:17:03 -07:00
Joe Soroka 06a7c415a9 revert complicated & broken flexible array member handling 2011-03-18 17:47:35 -07:00
Joe Soroka 7fc2eee55c partially revert e23194a
see http://lists.nongnu.org/archive/html/tinycc-devel/2011-03/msg00002.html
2011-03-08 13:22:48 -08:00
Joe Soroka e23194a1fa support c99 for-loop init decls 2011-03-07 11:28:31 -08:00
Joe Soroka c93eca4fe4 tccgen: handle __attribute((alias("target"))) 2011-03-03 01:58:45 -08:00
Jaroslav Kysela ab73c9bc4e fix another static struct init issue (arrays with unknown size at end) 2011-02-22 12:15:45 +01:00
Thomas Preud'homme 32a682b88f Fix fct asm label: only valid for declaration
- Fix function assembly label mechanism introduced in commit
  9b09fc376e to only accept alternative
  name for function declaration.
- merge the code with the one introduced in commit
  264a103610.
- Don't memorize token for asm label but directly the asm label.
2011-02-09 00:12:57 +01:00
Joe Soroka 3b4b3b75a6 revert "update VT_STRUCT_SHIFT for new VT_VLA" 2011-02-04 17:54:08 -08:00
Thomas Preud'homme db560e9439 Revert "Implement C99 Variable Length Arrays"
This reverts commit a5a50eaafe.
2011-02-05 02:33:46 +01:00
Thomas Preud'homme 38f6467c06 Revert "Reorder increasingly VT_* constants in tcc.h"
This reverts commit 7f00523e2e.
2011-02-05 02:33:46 +01:00
Joe Soroka b0c50fbd4d update VT_STRUCT_SHIFT for new VT_VLA 2011-02-04 14:33:38 -08:00
Thomas Preud'homme 7f00523e2e Reorder increasingly VT_* constants in tcc.h 2011-02-04 02:22:25 +01:00
Thomas Preud'homme a5a50eaafe Implement C99 Variable Length Arrays
Implement C99 Variable Length Arrays in tinycc:
- Support VLA with multiple level (nested vla)
- Update documentation with regards to VT_VLA
- Add a testsuite in tcctest.c
2011-02-04 02:22:25 +01:00
Joe Soroka 75c6695932 tccpp: fix bug in handling of recursive macros 2011-02-01 13:23:40 -08:00
Joe Soroka c59d3426b8 tccasm: support .weak labels 2011-02-01 08:43:54 -08:00
Joe Soroka 4d5105c8f1 support weak attribute on variables 2011-02-01 00:37:53 -08:00
Henry Kroll III bb7bb37fe2 tcc: add -m32 option to x86_64 cross compilers 2010-12-06 16:17:20 -08:00
grischka e97bf88bad libtcc: new function tcc_open_bf to create BufferedFile
Use it in:
- tcc_open
- tcc_compile_string
- tcc_define_symbol
- tcc_assemble_inline
2010-11-25 13:29:15 +01:00
Henry Kroll III f1c9f649da x86_64: fix --with-libgcc and simplify biarch paths 2010-11-25 02:57:19 -08:00
Thomas Preud'homme b8adf0090e Move asm label functions from tccasm.c to tccgen.c
* Move functions parse_asm_str and asm_label_instr from tccasm.c to
  tccgen.c
* Remove CONFIG_TCC_ASM_LABEL macro as asm label are available on all
  archs.
See:
http://lists.nongnu.org/archive/html/tinycc-devel/2010-09/msg00026.html
for the rationale.
2010-09-14 23:21:15 +02:00
Thomas Preud'homme 776364f395 Add support for __FreeBSD_kernel__ kernel
Add support for kfreebsd-i386 and kfreebsd-amd64 Debian arch with
thanks to Pierre Chifflier <chifflier@cpe.fr>.
2010-09-10 21:09:07 +02:00
Thomas Preud'homme 2887f40f76 Add support for GNU/Hurd
+ Add i686-AT386 to the list of x86 platform
+ Define SA_SIGINFO is not defined
2010-09-10 20:55:54 +02:00
Thomas Preud'homme 9b09fc376e Add support of asm label for functions.
Add support for asm labels for functions, that is the ability to rename
a function at assembly level with __asm__ ("newname") appended in
function declaration.
2010-09-10 20:15:03 +02:00
Kirill Smelkov 0c928da96d tcc: Draft suppoprt for -MD/-MF options
In build systems, this is used to automatically collect target
dependencies, e.g.

    ---- 8< (hello.c) ----
    #include "hello.h"
    #include <stdio.h>

    int main()
    {
        printf("Hello World!\n");
        return 0;
    }

$ tcc -MD -c hello.c    # -> hello.o, hello.d
$ cat hello.d
hello.o : \
        hello.c \
        hello.h \
        /usr/include/stdio.h \
        /usr/include/features.h \
        /usr/include/bits/predefs.h \
        /usr/include/sys/cdefs.h \
        /usr/include/bits/wordsize.h \
        /usr/include/gnu/stubs.h \
        /usr/include/bits/wordsize.h \
        /usr/include/gnu/stubs-32.h \
        /home/kirr/local/tcc/lib/tcc/include/stddef.h \
        /usr/include/bits/types.h \
        /usr/include/bits/wordsize.h \
        /usr/include/bits/typesizes.h \
        /usr/include/libio.h \
        /usr/include/_G_config.h \
        /usr/include/wchar.h \
        /home/kirr/local/tcc/lib/tcc/include/stdarg.h \
        /usr/include/bits/stdio_lim.h \
        /usr/include/bits/sys_errlist.h \

NOTE: gcc supports -MD only for .c -> .o, but in tcc, we generate
dependencies for whatever action is being taken. E.g. for .c -> exe, the
result will be:

$ tcc -MD -o hello hello.c  # -> hello, hello.d
hello: \
        /usr/lib/crt1.o \
        /usr/lib/crti.o \
        hello.c \
        hello.h \
        /usr/include/stdio.h \
        /usr/include/features.h \
        /usr/include/bits/predefs.h \
        /usr/include/sys/cdefs.h \
        /usr/include/bits/wordsize.h \
        /usr/include/gnu/stubs.h \
        /usr/include/bits/wordsize.h \
        /usr/include/gnu/stubs-32.h \
        /home/kirr/local/tcc/lib/tcc/include/stddef.h \
        /usr/include/bits/types.h \
        /usr/include/bits/wordsize.h \
        /usr/include/bits/typesizes.h \
        /usr/include/libio.h \
        /usr/include/_G_config.h \
        /usr/include/wchar.h \
        /home/kirr/local/tcc/lib/tcc/include/stdarg.h \
        /usr/include/bits/stdio_lim.h \
        /usr/include/bits/sys_errlist.h \
        /usr/lib/libc.so \
        /lib/libc.so.6 \
        /usr/lib/ld-linux.so.2 \
        /lib/ld-linux.so.2 \
        /usr/lib/libc_nonshared.a \
        /lib/libc.so.6 \
        /usr/lib/libc_nonshared.a \
        /home/kirr/local/tcc/lib/tcc/libtcc1.a \
        /usr/lib/crtn.o \

So tcc dependency generator is a bit more clever than one used in gcc :)

Also, I've updated TODO and Changelog (in not-yet-released section).

v2:

(Taking inputs from grischka and me myself)

- put code to generate deps file into a function.
- used tcc_fileextension() instead of open-coding
- generate deps only when compilation/preprocessing was successful

v3:

- use pstrcpy instead of snprintf(buf, sizeof(buf), "%s", ...)
2010-06-21 20:49:02 +04:00
Kirill Smelkov a919a373da Add input files/libs and reloc_output switch to TCCState
files[0], and reloc_outpu will be needed for (upcoming in the next
patch) "compute default outfile name" refactored into libtcc function.

Also, since for symmetry and from libification point of view, it makes
some sense to also put all information about what was given as input to
compilation into TCCState, let's not only put files[0], but all
files and all libraries given explicitely by user.

One point: I've used bitfield for reloc_output & trimmed down
output_type to 8 bits so that TCCState stays the same in size, and also
access to output_type is (hopefully) is not slower.

By the way -- as of today, sizeof(TCCState) on i686-pc-linux-gnu is 2884
bytes...
2010-06-20 20:30:01 +04:00
Daniel Glöckner 741841d863 ARM: allow jumps > 32MB on -run
This is needed to reach tinycc's PLT from the compiled program.
2010-05-14 13:07:59 +02:00
Daniel Glöckner 3de023b6c6 ARM: use uint32_t for opcodes
fixes cross compiling on x86_64
2010-05-13 22:17:09 +02:00
Henry Kroll III 2ab42855cb make --with-selinux work with libtcc, too 2010-04-24 03:28:54 -07:00
Thomas Preud'homme 3ad3168125 Clean changes introduced by 47abdbd
* Replace the save/load_buffer_state by a dynarray approach:
  - Filename and libname are added to a dynarray when first encountered
  - Load repeatedly the files in the dynarray until no new undefined
    symbol are encountered
* Replace snprintf by sprintf in libname_to_filename
* Use tcc_fileextension in filename_to_libname
* Introduce a tcc_strcpy_part fonction to copy only a subset of a
  string
* Move new_undef_syms declaration from tcc.h to tccelf.c
2010-04-20 16:02:42 +02:00
Sergei Trofimovich 83b0bd3095 libtcc.c: fix compilation failure (inconsistent tcc_add_file_internal)
gcc -o libtcc1.o -c lib/libtcc1.c -O2 -Wall
libtcc.c: At top level:
libtcc.c:1063: error: static declaration of 'tcc_add_file_internal' follows non-static declaration
tccelf.c:2915: note: previous implicit declaration of 'tcc_add_file_internal' was here

Signed-off-by: Sergei Trofimovich <st@anti-virus.by>
2010-04-19 11:46:36 +03:00
Thomas Preud'homme 47abdbd3d5 Better handle ld scripts
* search file from INPUT and GROUP commands in the library path in
  addition to the current directory
* handle libraries specified by -lfoo options
* Search lib in GROUP command repeatedly
2010-04-15 19:30:00 +02:00
Detlef Riekenberg 34dabe496f libtcc: Detect (but ignore) -init and -fini for -Wl
--
By by ... Detlef
2010-04-05 22:56:33 +02:00
Manuel Simoni 95b9a477b6 weak function symbols 2010-02-27 17:37:59 +01:00
Ali Gholami Rudi d63ec6f20d fill got table for static linking 2010-02-05 08:25:48 +03:30
Nikos Mavrogiannopoulos 253bad7993 Added patch to detect and use the paths for 64bit libraries as
used by CentOS (affects X86_64 only).
2010-01-28 08:27:38 +01:00
Detlef Riekenberg a975008ae7 Add support for the __mode__ attribute
--
By by ... Detlef
2010-01-26 22:56:22 +01:00
Detlef Riekenberg 2650584ac4 Recognize -Wl,-Bsymbolic
Without -Bsymbolic, a symbol/function in a *.so can be overridden
by a symbol/function in the main module.
That is the default search order, but not supported by tcc.

With -Bsymbolic, the linker tries to resolve a symbol/function in
the current module first.
The loader in tcc implements this search order.

We do not distinguish -Bsymbolic and -Bsymbolic-function

--
By by ... Detlef
2010-01-26 22:55:14 +01:00
grischka 4e5170d4a5 tccpp: convert TOK_GET macro into function 2010-01-14 20:59:44 +01:00
grischka 5299142286 x86-64: use uplong for symbol values 2010-01-14 20:59:42 +01:00
grischka 2341ee5142 tccpe: improve dllimport/export and use for tcc_add_symbol 2010-01-14 20:59:42 +01:00
grischka 0de95730ad build from multiple objects: fix other targets 2009-12-20 20:33:41 +01:00
grischka 4a01eb09d8 use vpushv in some places 2009-12-20 01:54:38 +01:00
grischka 50b040ef83 win64: add tiny unwind data for setjmp/longjmp
This enables native unwind semantics with longjmp on
win64 by putting an entry into the .pdata section for
each compiled fuction.

Also, the function now use a fixed stack and store arguments
into X(%rsp) rather than using push.
2009-12-20 01:54:37 +01:00
grischka 88a3ccab9f allow tcc be build from separate objects
If you want that, run: make NOTALLINONE=1
2009-12-20 01:53:49 +01:00
grischka 7fa712e00c win32: enable bounds checker & exception handler
exception handler borrowed from k1w1. Thanks.
2009-12-19 22:22:43 +01:00
grischka 8bbde91f62 tcc_relocate: revert to 0.9.24 behavior 2009-12-19 22:16:23 +01:00
grischka 94bf4d2c22 tccpe: improve dllimport 2009-12-19 22:16:21 +01:00
grischka 1308e8ebcf integrate x86_64-asm.c into i386-asm.c
Also, disable 16bit support for now as it causes bugs
in 32bit mode.  #define I386_ASM_16 if you want it.
2009-12-19 22:16:20 +01:00
grischka e81569bc70 tcc: add "-Wl,-rpath=path" option (library search path) 2009-12-19 22:16:20 +01:00
grischka 56d6abdb3d tccgen: propagate alignment from typedef
Store (part of) the AttributeDef structure in the (int)sym-r
field of the typedef symbol (kludgy).
2009-12-06 17:37:33 +01:00
Frederic Feret 2f73e42d87 various fixes and new options for PE format 2009-11-13 18:09:00 +01:00
Frederic Feret 526c464504 first support of x86_64 assembly 2009-11-13 18:08:59 +01:00
Frederic Feret 0d768b9713 added 16-bit x86 assembly support 2009-11-13 18:08:58 +01:00
grischka 5b113f3ee3 win32: handle __declspec(dllimport) 2009-11-13 18:04:56 +01:00
grischka 94ae3984b0 tccpe: set tcc_lib_path from DLL 2009-07-18 22:07:33 +02:00
grischka 1df662c1b0 tccpe: load dll on the fly 2009-07-18 22:07:25 +02:00
grischka 09ac9faf59 win64: align jmp_buf 2009-07-18 22:06:07 +02:00
grischka 035918ef2f win64: fix pointer <-> unsigned long typecast issues 2009-07-18 22:05:58 +02:00
grischka 3ea4acb9b9 pe32+ target: add in various #define's 2009-07-18 22:05:27 +02:00
grischka 370cdeb628 tccpe: build IAT vector with with -run too
This prepares for x86_64 where we need the vector
for far jumps.  Also, resolve DLL symbols in place
2009-07-18 21:55:15 +02:00
grischka bed17847bd cleanup: stop abuse of sym->c for #define tokenstreams 2009-07-18 21:55:10 +02:00
grischka d0b432ab38 cleanup: stop abuse of sym->r for inline functions 2009-07-18 21:55:06 +02:00
grischka ca4b4a52ad fix build with msvc 2009-05-11 18:53:52 +02:00
grischka 67aebdd5b7 enable making tcc using libtcc 2009-05-11 18:46:02 +02:00
grischka 0a35f9d66e move static prototypes to libtcc.c 2009-05-11 18:45:56 +02:00
grischka f9181416f6 move some global variables into TCCState 2009-05-11 18:45:44 +02:00
grischka b8f6e1ae30 move minor things from libtcc.c to other files 2009-05-05 20:30:39 +02:00
grischka 92204e8818 move global variables to libtcc.c 2009-05-05 20:30:13 +02:00
grischka ae37bd5abc move declarations to tcc.h 2009-05-05 20:17:26 +02:00
grischka a93bcdffae new files: tcc.h libtcc.c tccpp.c tccgen.c 2009-05-05 20:17:11 +02:00