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 .
  1. 18 Jan, 2020 1 commit
    • gr's avatar
      tccrun.c: standalone backtraces with -bt[N] or -b · ef42295f
      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
      ef42295f
  2. 16 Jan, 2020 6 commits
  3. 15 Jan, 2020 1 commit
    • herman ten brugge's avatar
      Update bound checking code. · 38776187
      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.
      38776187
  4. 14 Jan, 2020 1 commit
  5. 24 Dec, 2019 1 commit
  6. 18 Dec, 2019 1 commit
  7. 17 Dec, 2019 10 commits
    • Giovanni Mascellani's avatar
      43fb5a72
    • Michael Matz's avatar
      Use explicit signed char in char_short_test · 1d4d74d6
      Michael Matz authored
      as 'char' is unsigned on some architectures, so the tests weren't
      testing what they were supposed to.
      1d4d74d6
    • Michael Matz's avatar
      Adjust return value promotion for some archs · c8ca64d2
      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.
      c8ca64d2
    • Michael Matz's avatar
      riscv64: adjust for cast changes · 2d17e5a6
      Michael Matz authored
      gfunc_call plays with types and needs to retain the unsignedness
      now (this was a latent problem before commit 35475b54).
      2d17e5a6
    • grischka's avatar
      #pragma comment(option, "file.c") · d30d68d7
      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
      d30d68d7
    • grischka's avatar
    • grischka's avatar
      update gen_cast · 89372dc4
      grischka authored
      89372dc4
    • grischka's avatar
      remove VT_LVAL_BYTE etc. · 35475b54
      grischka authored
      For some reason there was no point for that anymore.
      35475b54
    • grischka's avatar
      tccgen.c: cleanup reg classes · 5914f4d5
      grischka authored
      wrap some copy&paste code into functions
      5914f4d5
    • grischka's avatar
      -bench fix · ff3b5ee9
      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)
      ff3b5ee9
  8. 16 Dec, 2019 1 commit
  9. 15 Dec, 2019 3 commits
    • Michael Matz's avatar
      arm64: fix some casts · 6cb68c3a
      Michael Matz authored
      in the new common backtrace/context code.
      6cb68c3a
    • Michael Matz's avatar
      Fix some races · 2fb79a63
      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).
      2fb79a63
    • grischka's avatar
      tccrun.c: better stab debug support · 65f74a4d
      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.
      65f74a4d
  10. 14 Dec, 2019 1 commit
    • grischka's avatar
      bcheck cleanup · 56db092a
      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.
      56db092a
  11. 13 Dec, 2019 4 commits
  12. 12 Dec, 2019 8 commits
  13. 11 Dec, 2019 2 commits