History log of /tinycc/tcc.h (Results 1 - 25 of 405)
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 5bc17207 05-May-2020 grischka <grischka>

tccgen.c: move 'alloca_used' complication to *-gen files

related to commit 8370bc03a1c9d8b93e476420039ff8200229e5b3

# 29ba50da 05-May-2020 herman ten brugge <hermantenbrugge@home.nl>

Fix some printf like functions

# 8370bc03 05-May-2020 herman ten brugge <hermantenbrugge@home.nl>

Allow signal handlers when bound checking

Disable generating bound_local_new/bound_local_delete when not needed.
Add new testcase 114_bound_signal.

# 8c6143d8 14-Apr-2020 Michael Matz <matz@suse.de>

Fix stdarg on x86-64

this partly reverts 1803762e3 to fix stdarg on x86-64 again. I've tried
to retain the apple specific changes from that commit.
Also include stdarg.h first in tc

Fix stdarg on x86-64

this partly reverts 1803762e3 to fix stdarg on x86-64 again. I've tried
to retain the apple specific changes from that commit.
Also include stdarg.h first in tcc.h, maybe that helps as well.

show more ...

# 096c93c0 14-Apr-2020 Michael Matz <matz@suse.de>

Fix interaction of (local) labels and stmt exprs

as per testcase. We must not reset token.sym_label twice with
kept symbols. This is no problem for non-label symbols because those

Fix interaction of (local) labels and stmt exprs

as per testcase. We must not reset token.sym_label twice with
kept symbols. This is no problem for non-label symbols because those
aren't generated on demand when mentioning them.

show more ...

# 7e901299 21-Jan-2020 grischka <grischka>

Rework expr_infix

- revert const-folding in gvtst() and put it back into
expr_landor(). Although it did make sense, one reason
not to do it is __builtin_constant_p() which may r

Rework expr_infix

- revert const-folding in gvtst() and put it back into
expr_landor(). Although it did make sense, one reason
not to do it is __builtin_constant_p() which may return
true when it shouldn't because of nocode_wanted, see test.

- tccgen_init() can do init_prec(), also for tcc -E.

- for nostalgic reasons, keep the original expression parser
functions in the source.

- Makefile: remove stale stuff

show more ...

# 23a8bac7 16-Jan-2017 Michael Matz <matz@suse.de>

Use precedence parser for expressions

This is smaller and uses less stack depth per expression (eight function
calls from expr_or to get down to a unary). It's a tiny bit faster
dep

Use precedence parser for expressions

This is smaller and uses less stack depth per expression (eight function
calls from expr_or to get down to a unary). It's a tiny bit faster
depending on how good the branch predictor is, on my machine a wash.

show more ...

# d79e1dee 19-Jan-2020 grischka <grischka>

backtrace: test with DLLs

- tests2/113_btdll.c: test handling multiple stabs infos
Also:
- libtcc.c: remove _ISOC99_SOURCE pre-defines. It is causing
strange warnings such as

backtrace: test with DLLs

- tests2/113_btdll.c: test handling multiple stabs infos
Also:
- libtcc.c: remove _ISOC99_SOURCE pre-defines. It is causing
strange warnings such as 'strdup not declared'

- i386/x86_64-gen.c cleanup bounds_pro/epilog. This discards
the extra code for main's argv. If needed, __argv might be
processed instead.

- tccgen.c:block(): reduce stackspace usage. For example with
code like "if (..) ... else if (..) ... else if (..)... "
considerable numbers of nested block() calls may occur.

Before that most stack space used when compiling itself was
for libtcc.c:tcc_set_linker().

Now it's rather this construct at tccpp.c:2765: in next_nomacro1():

if (!((isidnum_table[c - CH_EOF] & (IS_ID|IS_NUM))
|| c == '.'
|| ((c == '+' || c == '-')
...

show more ...

# 2b7cffac 17-Jan-2020 grischka <grischka>

fixes for previous commit

# ef42295f 17-Jan-2020 gr <gr@gr-laptop.(none)>

tccrun.c: standalone backtraces with -bt[N] or -b

This makes it possible to get backtraces with executables
(including DLLs/SOs) like we had it already with -g -run.

Option -b i

tccrun.c: standalone backtraces with -bt[N] or -b

This makes it possible to get backtraces with executables
(including DLLs/SOs) like we had it already with -g -run.

Option -b includes -bt, and -bt includes -g.

- new file lib/bt-exe.c: used to link rt_printline and the
exception handler from tccrun.c into executables/DLLs.

- new file lib/bt-log.c: provides a function that may be
called from user code to print out a backtrace with a
message (currently for i386/x86_64 only):

int (*tcc_backtrace)(const char *fmt, ...);

As an extra hack, if 'fmt' is prefixed like "^file.c^..."
then the backtrace will skip calls from within 'file.c'.

- new file lib/bt-dll.c: used on win32 to link the backtrace
and bcheck functions with the main module at runtime

- bcheck.c: now uses the tcc_backtrace function from above

- tccgen.c: minor cleanups

- tccelf.c: stab sections get SHF_ALLOC for easy access.
Also in relocate_section(): 64bit relocations for stabs
in DLLs cannot work. To find DLL addresses, the DLL base
is added manually in tccrun.c via rc.prog_base instead.

- tccpe.c: there are some changes to allow merging sections,
used to merge .finit_array into .data in the first place.

- tccpp.c: tcc -run now #defines __TCC_RUN__
also: refactor a line in tal_realloc that was incompatible
with bcheck

- tcctest.c: fixed a problem with r12 which tcc cannot preserve
as well as gcc does.

- tests2/112_backtrace.c: test the feature and the bcheck test18
that previously was in boundtest.c

show more ...

# 65f2fe39 15-Jan-2020 Michael Matz <matz@suse.de>

Cleanup new bound checking code

remove quadratic loops by not using side tables; address-taken
can simply be a flag per local sym, and the lbounds section can
be filled after symbols

Cleanup new bound checking code

remove quadratic loops by not using side tables; address-taken
can simply be a flag per local sym, and the lbounds section can
be filled after symbols go out of scope at which point we know
if the address was taken, so that there's no need to compress it
again after the funcion is done.

show more ...

# 38776187 15-Jan-2020 herman ten brugge <hermantenbrugge@home.nl>

Update bound checking code.

Add __attribute__((constructor)) to __bounds_init.
- remove tcc_add_bcheck from i386-link.c and x86_64-link.c
- add simplified tcc_add_bcheck to tccelf.c

Update bound checking code.

Add __attribute__((constructor)) to __bounds_init.
- remove tcc_add_bcheck from i386-link.c and x86_64-link.c
- add simplified tcc_add_bcheck to tccelf.c
- Update tccrun.c to call constructor/destructor.
Set dynsym sh_info to number of local symbols in tccelf.c
Reduce stack size when bounds checking is enabled.
Added variable TCC_LIBBCHECK for windows support.
Add signal stack to detect stack overflow.
Add all & parameters in lbound_section and remove them if not used.
Close fd in tcc_relocate in tccrun.c
Fix section type constructor/destructor in tccelf.c
Add check code in tests/boundtest.c for mem/str functions.
Remove -ba from documentation.
Add bounds check signal info in documentation.

bcheck.c:
- Fix initial_pool alignment.
. Fix printf statements.
. Add prototypes for all external interface functions.
- Add TCC_BOUNDS_WARN_POINTER_ADD environment variable.
. Add ctype and errno data.
- Fix alloca when multithreading is used.
- Add lock for __bound_checking and __bound_never_fatal.
- Catch pthread_create and use locks when called.
- Detect in loaded in shared lib and use locks when found
- Use spin locks instead of semaphore locks.
- Make spin locked code as small as possible.
- Fix mem/str functions checking.
- Fix overlap checking mem/str functions.

show more ...

# 89372dc4 16-Dec-2019 grischka <grischka>

update gen_cast

# 35475b54 16-Dec-2019 grischka <grischka>

remove VT_LVAL_BYTE etc.

For some reason there was no point for that anymore.

# 5914f4d5 16-Dec-2019 grischka <grischka>

tccgen.c: cleanup reg classes

wrap some copy&paste code into functions

# ff3b5ee9 14-Dec-2019 grischka <grischka>

-bench fix

Put total_lines etc. into TCCState. Also, initialize
the predefined compiler types for the preprocessor too.
tccpe.c: fix BaseOfCode if .init section present (with tcc -b)

# 65f74a4d 14-Dec-2019 grischka <grischka>

tccrun.c: better stab debug support

* a major revision of the rt_printline() feature in
tccrun.c to report file:linenumber more correctly.

* minor changes to the stab info pro

tccrun.c: better stab debug support

* a major revision of the rt_printline() feature in
tccrun.c to report file:linenumber more correctly.

* minor changes to the stab info produced by the
compiler in tccgen.c

However stab addresses are limited to 32 bits. I added
a work around:

if (sizeof pc == 8)
pc |= wanted_pc & 0xffffffff00000000ULL;

However GDB has problems with that too.

show more ...

# 56db092a 12-Dec-2019 grischka <grischka>

bcheck cleanup

- revert Makefiles to state before last bcheck additions
Instead, just load bcheck.o explicitly if that is
what is wanted.

- move tcc_add_bcheck() to the

bcheck cleanup

- revert Makefiles to state before last bcheck additions
Instead, just load bcheck.o explicitly if that is
what is wanted.

- move tcc_add_bcheck() to the <target>-link.c files and
remove revently added arguments. This function is to
support tccelf.c with linking, not for tccgen.c to
support compilation.

- remove -ba option: It said:
"-ba Enable better address checking with bounds checker"
Okay, if it is better then to have it is not an option.

- remove va_copy. It is C99 and we try to stay C89 in tinycc
when possible. For example, MS compilers do not have va_copy.

- win64: revert any 'fixes' to alloca
It was correct as it was before, except for bound_checking
where it was not implemented. This should now work too.

- remove parasitic filename:linenum features
Such feature is already present with rt_printline in
tccrun.c. If it doesn't work it can be fixed.

- revert changes to gen_bounded_ptr_add()
gen_bounded_ptr_add() was working as it should before
(mostly). For the sake of simplicity I switched it to
CDECL. Anyway, FASTCALL means SLOWCALL with tinycc.

In exchange you get one addition which is required for
bounds_cnecking function arguments. The important thing
is to check them *BEFORE* they are loaded into registers.
New function gbound_args() does that.

In any case, code instrumentation with the bounds-check
functions as such now seems to work flawlessly again,
which means when they are inserted as NOPs, any code that
tcc can compile, seems to behave just the same as without
them.

What these functions then do when fully enabled, is a
differnt story. I did not touch this.

show more ...

# 35512be1 12-Dec-2019 herman ten brugge <hermantenbrugge@home.nl>

Fix typo with -ba option

# 75145ddc 12-Dec-2019 herman ten brugge <hermantenbrugge@home.nl>

Add -ba option for bounds_checking

# a0bc149b 11-Dec-2019 herman ten brugge <hermantenbrugge@home.nl>

Fix bounds checking after concurrently commit

# 72729d8e 10-Dec-2019 grischka <grischka>

allow libtcc states to be used concurrently

This allows creation of TCCStates and operation with API
calls independently from each other, even from threads.

Frontend (option par

allow libtcc states to be used concurrently

This allows creation of TCCStates and operation with API
calls independently from each other, even from threads.

Frontend (option parsing/libtcc.c) and backend (linker/tccelf.c)
now depend only on the TCCState (s1) argument.

Compilation per se (tccpp.c, tccgen.c) is still using
globals for convenience. There is only one entry point
to this section which is tcc_compile() which is protected
by a semaphore.

There are some hacks involved to avoid too many changes,
as well as some changes in order to avoid too many hacks ;)

The test libtcc_test_mt.c shows the feature. Except this
new file the patch adds 87 lines overall.

show more ...

# df349ddc 09-Dec-2019 grischka <grischka>

versym cleanup

get rid of some globals, in the first place. Also, for the
PE target, ifdef out ELF executable creation.

# 353db307 10-Dec-2019 Michael Matz <matz@suse.de>

Fix compile warning with cross compilers

'make i386-tcc' on a x86-64 host gave a warning about the
unconditionally declared static tcc_add_bcheck function.

# 4461f38a 10-Dec-2019 herman ten brugge <hermantenbrugge@home.nl>

Fix bounds checking for linux/windows

12345678910>>...17