This project is mirrored from https://repo.or.cz/tinycc.git.
Pull mirroring failed .
Repository mirroring has been paused due to too many failed attempts. It can be resumed by a project maintainer or owner.
Last successful update .
Repository mirroring has been paused due to too many failed attempts. It can be resumed by a project maintainer or owner.
Last successful update .
- 18 Jan, 2020 1 commit
-
-
gr authored
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
-
- 16 Jan, 2020 6 commits
-
-
herman ten brugge authored
This fails on i386.
-
git://repo.or.cz/tinyccChristian Jullien authored
-
Christian Jullien authored
-
herman ten brugge authored
-
Michael Matz authored
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.
-
Michael Matz authored
we were emitting error messages for something like 'static int i = 2 || 1/0', even though the exception would be in the unevaluated part. This doesn't destroy const-ness, so we must accept it. This requires splitting the nocode_wanted values a bit more, so that nocode_wanted due to const_wanted can be differentiated from nocode_wanted due to non-evaluation.
-
- 15 Jan, 2020 1 commit
-
-
herman ten brugge authored
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.
-
- 14 Jan, 2020 1 commit
-
-
Christian Jullien authored
C11, section 7.2: The macro static_assert expands to _Static_assert. This macro was missing on Windows
-
- 24 Dec, 2019 1 commit
-
-
herman ten brugge authored
Free all memory on exit in __bound_exit.
-
- 18 Dec, 2019 1 commit
-
-
Michael Matz authored
the problem is that new debian GCC enabled -fPIC or -fPIE by default, causing the mentioned compile error.
-
- 17 Dec, 2019 10 commits
-
-
Giovanni Mascellani authored
-
Michael Matz authored
as 'char' is unsigned on some architectures, so the tests weren't testing what they were supposed to.
-
Michael Matz authored
this is a bit complicated: for i386 and x86-64 we really need to extend return values ourself, as the common code now does. For arm64 this at least preserves old behaviour. For riscv64 we don't have to extend ourself but can expect things to be extended up to int (this matters for var-args tests, when the sign-extension to int64 needs to happen explicitely). As the extensions are useless, don't do them. And for arm32 we actually can't express GCC behaviour: the callee side expects the return value to be correctly extended to int32, but remembers the original type. In case the ultimate target type for the call result is only int, no further extension is done. But in case the target type is e.g. int64 an extension happens, but not from int32 but from the original type. We don't know the ultimate target type, so we have to choose a type to put into vtop: * original type (plus VT_MUSTCAST) - this looses when the ultimate target is int (GCC: no cast, TCC: a cast) * int (without MUSTCAST) - this looses when the ultimate target is int64 (GCC: cast from original type, TCC: cast from int) This difference can only be seen with undefined sources, like the testcases, so it doesn't seem worthwhile to try an make it work, just disable the test on arm and choose the second variant as that generates less code.
-
Michael Matz authored
gfunc_call plays with types and needs to retain the unsignedness now (this was a latent problem before commit 35475b54).
-
grischka authored
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
-
grischka authored
-
grischka authored
-
grischka authored
For some reason there was no point for that anymore.
-
grischka authored
wrap some copy&paste code into functions
-
grischka authored
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)
-
- 16 Dec, 2019 1 commit
-
-
Michael Matz authored
see testcase: block scope decls for functions can't use static (allowed is only extern or none). This got lost in commit 85690480.
-
- 15 Dec, 2019 3 commits
-
-
Michael Matz authored
in the new common backtrace/context code.
-
Michael Matz authored
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).
-
grischka authored
* 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.
-
- 14 Dec, 2019 1 commit
-
-
grischka authored
- 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.
-
- 13 Dec, 2019 4 commits
-
-
herman ten brugge authored
-
herman ten brugge authored
-
herman ten brugge authored
There was a problem with strncpy and strncmp. Made bound_ptr_add and bound_ptr_indir a little bit faster. Fix statistic counter types. Change long into long long.
-
herman ten brugge authored
The following functions are now also bounds checked: memcmp, strncpy, strcmp, strncmp, strcat, strchr, strdup. Add statistics code for bounds checking functions. The statistics can be printed by settings environment variable "TCC_BOUNDS_PRINT_STATISTIC". Enabled more tests in test/Makefile.
-
- 12 Dec, 2019 8 commits
-
-
herman ten brugge authored
-
herman ten brugge authored
-
herman ten brugge authored
The bounds checking code has now enabled gen_bounded_ptr_add tests. This makes the code slower but finds more errors. I had to correct some things in tcc to make it work. - Fixed off by one in lib/bcheck.c - Corrected tccelf.c sym_versions. - Disabled USE_TAL when using bounds checking. - Fixed cstr_printf va_start. - Fixed tests/tests2/46_grep.c off by one error. - Updated gen_bounded_ptr_add in x86_64-gen.c - Fixed x86_64-link.c pointer diff. For gen_vla_alloc now always use alloca call when bounds checking. Added line/filename in %rax before bound calls to find location of error.
-
Michael Matz authored
for usleep and gettimeofday.
-
Michael Matz authored
my last patch here fixed a missing dependency, but in the wrong way. It would build some object files twice, which could race. The lib/all target already builds both libtcc{,b}1.a libs, so a simple dependency is enough.
-
Michael Matz authored
this breaks getting the alignment of functions via bit masking which we assume to work in one test.
-
Michael Matz authored
otherwise the -DTCC_ARM_VFP doesn't get through.
-
Michael Matz authored
we need to pass NATIVE_DEFINES, and we need to actually parse and pass them into the state.
-
- 11 Dec, 2019 2 commits
-
-
herman ten brugge authored
-
herman ten brugge authored
-