Timeline

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

50 most recent check-ins

2020-01-22
20:57
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 Leaf check-in: 933bda17b8 user: grischka tags: origin/mob
2020-01-20
04:48
Rework expr_landor so that it also is called from the precedence parser. This is complicated by the fact that something needs to be done before the second operand is parsed in a single pass compiler, so it doesn't quite fit into expr_infix itself. It turns out the smallest code changes result when expr_landor remains separate. But it can be tidied a bit. check-in: eead33bc88 user: matz@suse.de tags: origin/mob
04:48
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. check-in: 4f3ac0dbd4 user: matz@suse.de tags: origin/mob
04:31
Fix symbol versions with shared libs ELF files that refer to shared libs containing sym-versions, but don't refer to any dynamic symbols with symbol versions (should happen only with very simple shared libs) would generate an empty .gnu.version_r section. Some dynamic linker contain bugs in that they don't check the section size or DT_VERNEEDNUM (which are both zero for such files we generate) before accessing the first entry, and then bail out with a message like ./a.exe: error while loading shared libraries: ./a1.so: unsupported version 25960 of Verneed record (where the "version number" actually comes from neighboring bytes from different sections). So, there's not much choice, we simply must not generate such section. check-in: e4b96a0ab8 user: matz@suse.de tags: origin/mob
2020-01-19
10:46
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 == '-') ... check-in: f9c1ad1d29 user: grischka tags: origin/mob
2020-01-18
02:06
Make 112_backtrace/bcheck_123 more robust the strcat checker first checks dest for overlap, then src. If the padding byte between b[] and the pad[] arrays happens to be zero the dest check would have succeeded and the src test failed. If that padding byte would be zero the dest check would trigger first. As we can't influence the padding byte (only the b[] and pad[] arrays) it was random if the dest or src checks triggered. This makes it reliably trigger the dest check first. check-in: ca92966a68 user: matz@suse.de tags: origin/mob
00:22
fixes for previous commit check-in: 6bebba5e9a user: grischka tags: origin/mob
2020-01-17
21:58
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 check-in: 0df6f19772 user: gr@gr-laptop.(none) tags: origin/mob
2020-01-16
08:40
Exclude ellipsis functions from bounds checking. This fails on i386. check-in: 5f8d8cbe00 user: hermantenbrugge@home.nl tags: origin/mob
08:00
Merge branch 'mob' of git://repo.or.cz/tinycc into mypatch check-in: 591f383604 user: jullien@eligis.com tags: origin/mob
07:58
Add _ISOCxx_SOURCE glibc compatible macros. check-in: c1627ffd23 user: jullien@eligis.com tags: origin/mob
07:24
Call pop_local_syms before gfunc_epilog check-in: 8a3fcd936d user: hermantenbrugge@home.nl tags: origin/mob
00:19
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. check-in: 82fd852444 user: matz@suse.de tags: origin/mob
2020-01-15
22:32
Fix handling of unevaluated subexpression of const 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. check-in: ee25e35c65 user: matz@suse.de tags: origin/mob
07:53
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. check-in: 5b9f27965f user: hermantenbrugge@home.nl tags: origin/mob
2020-01-14
06:41
C11, section 7.2: The macro static_assert expands to _Static_assert. This macro was missing on Windows check-in: ce68c274a2 user: jullien@eligis.com tags: origin/mob
2019-12-23
19:23
Fix sellinux pointer code in tccrun. Free all memory on exit in __bound_exit. check-in: 64cddddaf4 user: hermantenbrugge@home.nl tags: origin/mob
2019-12-17
16:54
Fix the get_asm_string fail on i386 in another way the problem is that new debian GCC enabled -fPIC or -fPIE by default, causing the mentioned compile error. check-in: 296cc24133 user: matz@suse.de tags: origin/mob
11:36
tcctest: explain why i386 is not tested check-in: 36e14cf2cb user: gio@debian.org tags: origin/mob
03:56
Use explicit signed char in char_short_test as 'char' is unsigned on some architectures, so the tests weren't testing what they were supposed to. check-in: 19353657ae user: matz@suse.de tags: origin/mob
00:46
Adjust return value promotion for some archs 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. check-in: 711bfceb61 user: matz@suse.de tags: origin/mob
2019-12-16
23:48
riscv64: adjust for cast changes gfunc_call plays with types and needs to retain the unsignedness now (this was a latent problem before commit 35475b5). check-in: 1bab4fd13d user: matz@suse.de tags: origin/mob
21:48
#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 check-in: e5ffb275bc user: grischka tags: origin/mob
20:58
tccgen.c: generic char/short promotion for function return values check-in: 3d4d08a7a2 user: grischka tags: origin/mob
20:37
update gen_cast check-in: 29f407ba19 user: grischka tags: origin/mob
19:59
remove VT_LVAL_BYTE etc. For some reason there was no point for that anymore. check-in: 04c3656d88 user: grischka tags: origin/mob
19:44
tccgen.c: cleanup reg classes wrap some copy&paste code into functions check-in: bb30c60436 user: grischka tags: origin/mob
19:17
-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) check-in: ca6dfb51df user: grischka tags: origin/mob
06:00
Readd lost error on local static function decls see testcase: block scope decls for functions can't use static (allowed is only extern or none). This got lost in commit 85690480. check-in: 032aeb0faa user: matz@suse.de tags: origin/mob
2019-12-14
23:05
arm64: fix some casts in the new common backtrace/context code. check-in: 17aa1b5d19 user: matz@suse.de tags: origin/mob
22:58
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). check-in: 98c2967413 user: matz@suse.de tags: origin/mob
16:48
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. check-in: 003f5248e9 user: grischka tags: origin/mob
12:26
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. check-in: e249fc4576 user: grischka tags: origin/mob
2019-12-13
14:07
Fix debug info check-in: 500ab52283 user: hermantenbrugge@home.nl tags: origin/mob
12:45
Add linenumber filename support for bounds checking. check-in: 2b14ec77ff user: hermantenbrugge@home.nl tags: origin/mob
09:02
Fix bounds checking new functions. 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. check-in: efcfc3a28d user: hermantenbrugge@home.nl tags: origin/mob
2019-12-12
19:49
Add new bounds checking functions. 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. check-in: 31b3b43278 user: hermantenbrugge@home.nl tags: origin/mob
13:21
Fix typo with -ba option check-in: a510a4424f user: hermantenbrugge@home.nl tags: origin/mob
12:29
Add -ba option for bounds_checking check-in: f0b3e56eb9 user: hermantenbrugge@home.nl tags: origin/mob
11:56
Update bounds checking. 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. check-in: d109137a1b user: hermantenbrugge@home.nl tags: origin/mob
02:31
Include some headers in new multi-thread test for usleep and gettimeofday. check-in: 2e2984fdd0 user: matz@suse.de tags: origin/mob
01:00
Fix parallel make targets 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. check-in: 060b926f67 user: matz@suse.de tags: origin/mob
00:52
Disable thumb code generation on tcctest.gcc this breaks getting the alignment of functions via bit masking which we assume to work in one test. check-in: 7aa652aa78 user: matz@suse.de tags: origin/mob
00:39
Also parse -Dfoo in libtcc_test_mt otherwise the -DTCC_ARM_VFP doesn't get through. check-in: ae6f9a9f05 user: matz@suse.de tags: origin/mob
2019-12-11
16:57
Fix libtcc_test_mt with lib64 we need to pass NATIVE_DEFINES, and we need to actually parse and pass them into the state. check-in: c41c911a79 user: matz@suse.de tags: origin/mob
13:26
Fix3 alloca on x86_64 windows check-in: 9faf1d0f8e user: hermantenbrugge@home.nl tags: origin/mob
13:22
Fix2 alloca on x86_64 windows check-in: 476f4cd99c user: hermantenbrugge@home.nl tags: origin/mob
13:06
Fix alloca on x86_64 windows check-in: 40170cff23 user: hermantenbrugge@home.nl tags: origin/mob
11:07
Fix bounds checking after concurrently commit check-in: e898c4e989 user: hermantenbrugge@home.nl tags: origin/mob
01:36
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. check-in: cdf431d037 user: grischka tags: origin/mob