diff options
| author | seyko <seyko2@gmail.com> | 2015-04-10 07:37:31 +0300 |
|---|---|---|
| committer | seyko <seyko2@gmail.com> | 2015-04-10 07:37:31 +0300 |
| commit | 7e7e6148fdb4adbda936f80b5d4ac3d738908d95 (patch) | |
| tree | 37bb17e54d38fdb905b79ba8dfa996500f066abe /libtcc.c | |
| parent | 5cd4393a542ef4c64df7dcbb3fbe3a629666239d (diff) | |
| download | tinycc-7e7e6148fdb4adbda936f80b5d4ac3d738908d95.tar.gz tinycc-7e7e6148fdb4adbda936f80b5d4ac3d738908d95.tar.bz2 | |
fix installation amd bcheck for Windows
* define targetos=Windows when --enable-tcc32-mingw, --enable-cygwin, ...
* use TARGETOS insteed HOST_OS when selecting PROGS
* use "$(tccdir)" insteed $(tccdir) on install (spaces in path)
* install tcc.exe too
* produce bcheck.o when cross-compiling too (lib/Makefile)
* force bcheck.o linking by compiling inside tcc_set_output_type()
a dummy program with local array. Otherwise bcheck.o may be not linked.
* replace %xz format specifier with %p in bcheck (don't supported on
Windows)
* call a __bound_init when __bound_ptr_add, __bound_ptr_indir,
__bound_new_region, __bound_delete_region called.
This is because a __bound_init inside ".init" section is not called
on Windows for unknown reason.
* print on stderr a message when an illegal pointer is returned:
there is no segmentation violation on Windows for a program
compiled with "tcc -b"
* remove "C:" subdir on clean if $HOST_OS = "Linux"
* default CFLAGS="-Wall -g -O0" insteed CFLAGS="-Wall -g -O2"
to speed up compilation and more precise debugging.
Diffstat (limited to 'libtcc.c')
| -rw-r--r-- | libtcc.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -1390,6 +1390,17 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type) tcc_add_crt(s, "crti.o"); } #endif + +#ifdef CONFIG_TCC_BCHECK + if (s->do_bounds_check && (output_type == TCC_OUTPUT_EXE)) + { + /* XXX force a bcheck.o linking by compiling a function with a local array. + Otherwise bcheck.o may be not linked. */ + + if (tcc_compile_string(s, "static void __bound_check_dummy_func(){int v[1];}") == -1) + tcc_warning("compiling __bound_check_dummy_func failed"); + } +#endif return 0; } |
