History log of /tinycc/libtcc.c (Results 1 - 25 of 343)
Revision Date Author Comments
# 8de7c092 10-May-2020 Michael Matz <matz@suse.de>

Support --version cmdline arg

for simplicity handles like -v (verbose), but enables the usual idiom
of configure scripts to use '$CC --version' to find out the compiler
variant and v

Support --version cmdline arg

for simplicity handles like -v (verbose), but enables the usual idiom
of configure scripts to use '$CC --version' to find out the compiler
variant and version.

show more ...


# 245f6a0d 25-Dec-2017 Michael Matz <matz@suse.de>

stdarg: always have the __builtin_va_* available

This makes available the __builtin_va_list type and __builtin variants
of va_start, va_arg, va_copy and va_end. We do this via a header

stdarg: always have the __builtin_va_* available

This makes available the __builtin_va_list type and __builtin variants
of va_start, va_arg, va_copy and va_end. We do this via a header file
that's prepended to all compilations always (except if merely
preprocessing): tcc_predefs.h. That header could also be used
for predefining other builtins in the future.

We don't need the define hacks for musl anymore with this.

Also fix x86_64 gfunc_prologue to reserve enoug space for the
full va_list structure, not just 16 bytes.

show more ...


# 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 ...


# 1803762e 11-Apr-2020 Robert Hoelzl <robert.hoelzl@posteo.de>

Make tcclib1.a compile on macOS again

When compiling on macOS (at least in version 10.12) the TCC compiler failed
to compile libtcc1.a. Three problems were solved:
- The predefined

Make tcclib1.a compile on macOS again

When compiling on macOS (at least in version 10.12) the TCC compiler failed
to compile libtcc1.a. Three problems were solved:
- The predefined macro "__APPLE__" is now available, as it is tested in the
libc darwin header files
- the libtcc1 Makefile defined _ANSI_SOURCE, although it used signals
- stdargs.h defined va_list differently from the darwin libc.
If the darwin standard library was included BEFORE stdargs this caused
problems.
- the darwin libc generated a warning if GCC < 4 was used
- additional defines are predefined now to make darwin libc headers compile.

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 ...


# 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 ...


# c7e3d5d7 16-Jan-2020 Christian Jullien <jullien@eligis.com>

Add _ISOCxx_SOURCE glibc compatible macros.


# d30d68d7 16-Dec-2019 grischka <grischka>

#pragma comment(option, "file.c")

This allows adding files or libraries from
#pragma comment(option, ...)

Also, {f}/file.c will be expanded with the directory of
the curr

#pragma comment(option, "file.c")

This allows adding files or libraries from
#pragma comment(option, ...)

Also, {f}/file.c will be expanded with the directory of
the current source, that is the file that has the #pragma

show more ...


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

update gen_cast


# 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)


# 2fb79a63 14-Dec-2019 Michael Matz <matz@suse.de>

Fix some races

protect some more accesses to global data with the semaphore.
(And for the testcase: don't just write into global data, use local
copies; it's not important for speed

Fix some races

protect some more accesses to global data with the semaphore.
(And for the testcase: don't just write into global data, use local
copies; it's not important for speed here).

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


# 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 ...


# 474f95dd 05-Dec-2019 Michael Matz <matz@suse.de>

Fix setting of options

now that the type of boolean options is uchar set_flag() needs
an accompanying change.


# 14fc6b6d 01-Dec-2019 Sergey Sushilin <sushilinsergey@gmail.com>

use size_t instead of int when work with strings


# 491773ac 14-Oct-2019 Luc Everse <luc@wukl.net>

Add error_func and error_opaque getters to libtcc


# b0329ac0 15-Jul-2019 Michael Matz <matz@suse.de>

riscv: predefine more macros

RISC-V uses some more control macros for features (e.g. used
int <setjmp.h> to declare the jumpbuf contents).


# 16edda58 23-Jun-2019 Michael Matz <matz@suse.de>

riscv: Add more ops and fixes

* implement compares, gtst and gsym/gjmp and add
* implement stores (simple cases)
* fix arg passing with more than one register arg, fix
loads to

riscv: Add more ops and fixes

* implement compares, gtst and gsym/gjmp and add
* implement stores (simple cases)
* fix arg passing with more than one register arg, fix
loads to not always use 8byte loads
* add some predefined macros: __riscv, __riscv_xlen,
__SIZEOF_POINTER__ (needed by glibc header)

The first 5 tests of tests2 run now.

show more ...


# 0676d5bc 21-Jun-2019 Michael Matz <matz@suse.de>

riscv64: Add skeleton target


# ce1ef5b8 08-Jun-2018 grischka <grischka>

some smaller fixes

- libtcc.c/tccpp.c: fix -U option for multiple input files
- libtcc: remove decl of tcc_add_crt() for PE
- tcc.h: define __i386__ and __x86_64__ for msvc
- tcc

some smaller fixes

- libtcc.c/tccpp.c: fix -U option for multiple input files
- libtcc: remove decl of tcc_add_crt() for PE
- tcc.h: define __i386__ and __x86_64__ for msvc
- tcc.h: undef __attribute__ for __TINYC__ on gnu/linux platforms
- tccelf.c: disable prepare_dynamic_rel unless x86/x64
- tccpe.c: construct rather than predefine PE section flags
- tccpp.c: (alt.) fix access of dead stack variable after error/longjmp
- x86_64-gen.c: fix func_alloca chain for nocode_wanted
- tccpp.c/tccgen.c: improve file:line info for inline functions
- winapi/winnt.h: correct position for DECLSPEC_ALIGN attribute
- win32/lib/crt: simplify top exception handler (needed for signal)
- arm64-gen.c: remove dprintf left from VT_CMP commit
- tccgen.c: limit binary scan with gcase to > 8 (= smaller code)
- tccgen.c: call save_regs(4) in gen_opl for cmp-ops (see test in tcctest.c)

show more ...


# f2fd56a2 11-Jun-2019 Petr Skocik <pskocik@gmail.com>

turn -fdollars-in-identifiers on by default

gcc and clang do it too


# 60ceab14 11-Jun-2019 Petr Skocik <pskocik@gmail.com>

in c11 mode, skip __STDC_ISO_10646__

The macro conflicts (=> redef warnings in a simple hello world)
with a definition introduced by glibc headers and
it's probably not "necessary" a

in c11 mode, skip __STDC_ISO_10646__

The macro conflicts (=> redef warnings in a simple hello world)
with a definition introduced by glibc headers and
it's probably not "necessary" anyway since clang doesn't use it.

show more ...


# d44d8cdf 12-Jan-2019 Christian Jullien <Christian Jullien>

Add more STDC_ C11 compatible constants


12345678910>>...14