This project is mirrored from 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. 16 Jun, 2020 1 commit
    • herman ten brugge's avatar
      Add bound checking to arm, arm64 and riscv64 · 0b8ee736
      herman ten brugge authored
      Checked on:
      - i386/x86_64 (linux/windows)
      - arm/arm64 (rapberry pi)
      - riscv64 (simulator)
      Not tested for arm softfloat because raspberry pi does not support it.
        add arm-asm.c to arm64_FILES
        add riscv64-asm.c (new file) to riscv64_FILES
        add fetch_and_add_arm.o(new file) to ARM_O
        add fetch_and_add_arm64.o(new file) to ARM64_O
        add fetch_and_add_riscv64.o(new file) to RISCV64_O
        add $(BCHECK_O) to OBJ-arm/OBJ-arm64/OBJ-riscv64
        Enable CONFIG_TCC_BCHECK for arm32/arm64/riscv64
        Add arm-asm.c, riscv64-asm.c
        for arm use memmove4 instead of memcpy4
        for arm use memmove8 instead of memcpy8
        put_extern_sym2: for arm check memcpy/memmove/memset/memmove4/memmove8
                         only use alloca for i386/x86_64
        for arm use memmove4 instead of memcpy4
        for arm use memmove8 instead of memcpy8
        fix builtin_frame_address/builtin_return_address for arm/riscv64
        Add riscv64 support
        fix rt_getcontext/rt_get_caller_pc for arm
        tcc_load_dll: Print filename for bad architecture
        add arm-asm.c/riscv64-asm.c
        Add arm, arm64, riscv64 support for bound checking
        add __bound___aeabi_memcpy/__bound___aeabi_memmove
            __bound___aeabi_memset for arm
        call fetch_and_add_arm/fetch_and_add_arm64/fetch_and_add_riscv64
        __bound_init: Fix type for start/end/ad
        __bound_malloc/__bound_memalign/__bound_realloc/__bound_calloc: Use size + 1
        add bound checking code like i386/x86_64
        assign_regs: only malloc if nb_args != 0
        gen_opi/gen_opf: Fix reload problems
        relocate_plt: Fix address calculating
        add bound checking code like i386/x86_64
        load/store: remove VT_BOUNDED from sv->r
        arm64_hfa_aux/arm64_hfa_aux: Fix array code
        gfunc_prolog: only malloc if n != 0
        code_reloc/gotplt_entry_type/relocate: add R_AARCH64_LDST64_ABS_LO12_NC
        relocate: Use addXXle instead of writeXXle
        add bound checking code like i386/x86_64
        relocate: Use addXXle instead of writeXXle
        gen_bounds_epilog: Fix code (unrelated)
        add $(BTESTS) for arm/arm64/riscv64
        Use 85 only on i386/x86_64 because of asm code
        Use 113 only on i386/x86_64 because of DLL code
        Add 112/114/115/116 for arm/arm64/riscv64
        Fix FILTER (failed on riscv64)
        Only use alloca for i386/x86_64
  2. 13 May, 2020 2 commits
    • grischka's avatar
      tccgen.c: merge more function attributes · 4429cef9
      grischka authored
      Merge function attributes with those given given for the
      prototype, also handle post-decl appearance such as
          void func() __attribute__((noreturn))
      Also, some test fixes (unrelated).
    • grischka's avatar
      make SILENT=yes · 7bb5454e
      grischka authored
      This allows to run make more silently.
      Also, turns off debug info for binaries by default,
      but adds a switch to get it back easily
          ./configure --debug
  3. 16 Apr, 2020 1 commit
  4. 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
  5. 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.
      - 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.
  6. 18 Dec, 2019 1 commit
  7. 17 Dec, 2019 1 commit
  8. 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
      What these functions then do when fully enabled, is a
      differnt story.  I did not touch this.
  9. 13 Dec, 2019 1 commit
    • herman ten brugge's avatar
      Add new bounds checking functions. · 39c0ff31
      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
      Enabled more tests in test/Makefile.
  10. 12 Dec, 2019 2 commits
  11. 11 Dec, 2019 2 commits
    • herman ten brugge's avatar
    • grischka's avatar
      allow libtcc states to be used concurrently · 72729d8e
      grischka authored
      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.
  12. 10 Dec, 2019 1 commit
  13. 14 Mar, 2019 1 commit
  14. 10 Mar, 2018 1 commit
  15. 13 Dec, 2017 1 commit
    • grischka's avatar
      final update for 0.9.27 · d348a9a5
      grischka authored
      - fix ldouble asm hack
      - fix a VLA problem on Win64 (also x86_64-gen.c)
      - patch_type(): make sure that no symbol ever changes
        from global to static
      - tcc -vv: print libtcc1.a path also on win32
      tccpe.c, tcctools.c:
      - use unix LF mode to for .def output files (that is for
        creating reproducible output trees)
      - suppress some warnings when makeinfo is missing
      - call 'which install' only on win32
      - change PATH only on WINNT systems (i.e. not if cross-compiling
        on linux for win32)
      - asm-c-connect.test: slim output and do diff
      tccrun.c tccpe.c *-link.c:
      - integrate former 'pe_relocate_rva()' into normal relocation
        This also fixes linkage of the unwind data on WIN64 for -run
        (reported by Janus Lynggaard Thorborg)
      tccasm.c, tests/tcctest.c:
      - fix dot (sym_index of -1 crashed in put_elf_reloc)
      - massage .set a bit (see test)
      - #define SECTION_ABS removed
      - ST_DATA Section *strtab_section: removed
      - put_extern_sym2(): take int section number
  16. 04 Dec, 2017 1 commit
  17. 23 Nov, 2017 1 commit
    • Michael Matz's avatar
      tccasm: synch C and asm symtab tighter · e7c71e24
      Michael Matz authored
      See testcase.  The C and asm symtab are still separate,
      but integrated tighter: the asm labels are only synched at file
      end, not after each asm snippet (this fixes references from one
      to another asm block), the C and asm syms are synched both ways,
      so defining things in asm and refering from C, or the other way
      around works.  In effect this model reflects what happens with
      GCC better.
      For this the asm labels aren't using the C label namespace anymore,
      but their own, which increases the size of each TokenSym by a pointer.
  18. 12 Oct, 2017 1 commit
    • grischka's avatar
      various stuff · da8c62f7
      grischka authored
      win32/Makefile ("for cygwin") removed
      - On cygwin, the normal ./configure && make can be used with either
        cygwin's "GCC for Win32 Toolchain"
            ./configure --cross-prefix=i686-w64-mingw32-
        or with an existing tcc:
            ./configure --cc=<old-tccdir>/tcc.exe
      - exclude test_high_clobbers() on _WIN64 (does not work)
      - use 'signed char' for ARM (where default 'char' is unsigned)
      - remove -I "expr" diff option to allow tests with
      libtcc.c, tcc.c:
      - removed -iwithprefix option.  It is supposed to be
        combined with -iprefix which we don't have either.
      - fix assignments and return of 'void', as in
           void f() {
               void *p, *q;
               *p = *q:
               return *p;
        This appears to be allowed but should do nothing.
      tcc.h, libtcc.c, tccpp.c:
      - Revert "Introduce VIP sysinclude paths which are always searched first"
        This reverts commit 1d5e386b.
        The patch was giving tcc's system includes priority over -I which
        is not how it should be.
      - add DT_TEXTREL tag only if text relocations are actually
        used (which is likely not the case on x86_64)
      - prepare_dynamic_rel(): avoid relocation of unresolved
        (weak) symbols
      - for HAVE_SELINUX, use two mappings to the same (real) file.
        (it was so once except the RX mapping wasn't used at all).
      - fix relocation constant used for x86_64 (by Andrei E. Warentin)
      - #ifndef _WIN32 do "chmod 755 ..." to get runnable exes on cygwin.
      - keep forward asm labels static, otherwise they will endup
        in dynsym eventually.
      configure, Makefile:
      - mingw32: respect ./configure options --bindir --docdir --libdir
      - allow overriding tcc when building libtcc1.a and libtcc.def with
            make XTCC=<tcc program to use>
      - use $(wildcard ...) for install to allow installing just
        a cross compiler for example
            make cross-arm
            make install
      - use name <target>-libtcc1.a
      - add  options: -clean, -b bindir
  19. 24 Jul, 2017 1 commit
    • grischka's avatar
      tccgen: nodata_wanted fix, default ONE_SOURCE, etc... · 4b3c6e74
      grischka authored
        doubles need to be aligned, on ARM.  The section_reserve()
        in init_putv does not do that.
      -D ONE_SOURCE: is now the default and not longer needed. Also,
        tcc.h now sets the default native target.  These both make
        compiling tcc simple as "gcc tcc.c -o tcc -ldl" again.
        enable pseudo asm also for inline asm
        disable bitfield tests except on windows and x86_64
        and don't generate-always
        fix a loop with -dt on errors
        print compiler version (as recognized)
        actually define symbols for tcc -dt
        clear static variables (needed for -dt or libtcc usage)
        use __label__ instead of asm
        use native symbols (__i386__ etc.) instead of TCC_TARGET_...
  20. 13 May, 2017 1 commit
    • grischka's avatar
      configure: --config-musl/-uClibc switch & misc cleanups · 28435ec5
      grischka authored
      - configure:
        - add --config-uClibc,-musl switch and suggest to use
          it if uClibc/musl is detected
        - make warning options magic clang compatible
        - simplify (use $confvars instead of individual options)
      - Revert "Remove some unused-parameter lint"
        rather use -Wno-unused-parameter (or just not -Wextra)
      - #ifdef functions that are unused on some targets
      - tccgen.c: use PTR_SIZE==8 instead of (X86_64 || ARM64)
      - tccpe.c: fix some warnings
      - integrate dummy arm-asm better
  21. 26 Apr, 2017 1 commit
    • grischka's avatar
      final adjustments for release · 7acf9aa8
      grischka authored
      - configure/Makefiles: minor adjustments
      - build-tcc.bat: add -static to gcc options
        (avoids libgcc_s*.dll dependency with some mingw versions)
      - tccpe.c/tcctools.c: eliminate MAX_PATH
        (not available for cross compilers)
      - tccasm.c: use uint64_t/strtoull in unary()
        (unsigned long sometimes is only uint32_t, as always on windows)
      - tccgen.c: Revert (f077d16c) "tccgen: gen_cast: cast FLOAT to DOUBLE"
        Was a rather experimental, tentative commit, not really necessary
        and somewhat ugly too.
      - cleanup recent osx support:
        - Makefile/libtcc.c: cleanup copy&paste code
        - tccpp.c: restore deleted function
  22. 26 Feb, 2017 1 commit
    • Avi Halachmi (:avih)'s avatar
      win: tests Makefile: fix global path · 2da36731
      Avi Halachmi (:avih) authored
      Commit bb93064d changed the path seperator from ':' to ';', which was
      likely accidental. While path seperator on Windows is generally ';', the
      Makefile clearly expects a posix-y shell, and in such environments the
      separator is ':'.
      This fixes the test run in MSYS2 and MSYS(1) environments, which got
      broken on bb93064d .
  23. 25 Feb, 2017 1 commit
    • grischka's avatar
      makefile: unify cross with native builds · bb93064d
      grischka authored
      supports building cross compilers on the fly without need
      for configure --enable-cross
         $ make cross          # all compilers
         $ make cross-TARGET   # only TARGET-compiler & its libtcc1.a
      with TARGET one from
         i386 x86_64 i386-win32 x86_64-win32 arm arm64 arm-wince c67
      Type 'make help' for more information
  24. 21 Feb, 2017 1 commit
    • grischka's avatar
      tcc: re-enable correct option -r support · 5f33d313
      grischka authored
      Forgot about it.  It allows to compile several
      sources (and other .o's) to one single .o file;
          tcc -r -o all.o f1.c f2.c f3.S o4.o ...
      - option -fold-struct-init-code removed, no effect anymore
      - (tcc_)set_environment() moved to tcc.c
      - win32/lib/(win)crt1 minor fix & add dependency
      - debug line output for asm (tcc -c -g xxx.S) enabled
      - configure/Makefiles: x86-64 -> x86_64 changes
      - README: cleanup
  25. 14 Feb, 2017 1 commit
    • grischka's avatar
      updates & cleanups (tcc-doc/Changelog/TODO ...) · 43d9a7de
      grischka authored
      - tcc-doc.texi: commandline option info update
      - Changelog/TODO: update
      - tests/ removed
      - tests/Makefile: weaktest fixed
      - tests/tests2: some files renamed and/or converted to unix LF
      - configure/Makefile: --enable-static option (no dll on win32)
      - win32/build-tcc.bat: msvc support
      - win32/tcc-win32.txt: build info update
      - win32/vs2015/: VS solution removed
      - win32/include/tcc/tcc_libm.h: #include statement fixed
      - tcc.c: -include <file> option help info
      - .gitignore: cleanup
  26. 21 Dec, 2016 1 commit
    • grischka's avatar
      tests: OOT build fixes etc. · 71c5ce5c
      grischka authored
      tests/Makefile: fix out-of-tree build issues
      - win64: align(16) MEM_DEBUG user memory
        on win64 the struct jmp_buf in the TCCState structure which we
        allocate by tcc_malloc needs alignment 16 because the msvcrt
        setjmp uses MMX instructions.
      - libtcc_test.c: win32/64 need __attribute__((dllimport)) for
        extern data objects
      - tcctest.c: exclude stuff that gcc does not compile
        except for relocation_test() the other issues are mostly ASM
        related.  We should probably check GCC versions but I have
        no idea which mingw/gcc versions support what and which don't.
      - lib/Makefile: use tcc to compile libtcc1.a (except on arm
        which needs arm-asm
  27. 19 Dec, 2016 1 commit
    • grischka's avatar
      tests: add memory leak test · a1c12b9f
      grischka authored
      Also ...
      - exclude stuff that gcc doesn't compile on windows.
      - use unsigned for memory sizes to avoid printf format warnings
      - use "file:line: message" to make IDE error parsers happy.
      tccgen.c: fix typo
  28. 16 Dec, 2016 1 commit
  29. 02 Oct, 2016 3 commits
    • grischka's avatar
      tccgen: fix long long -> char/short cast · c2ad11ac
      grischka authored
      This was causing assembler bugs in a tcc compiled by itself
      at i386-asm.c:352 when ExprValue.v was changed to uint64_t:
          if (op->e.v == (int8_t)op->e.v)
              op->type |= OP_IM8S;
      A general test case:
          #include <stdio.h>
          int main(int argc, char **argv)
              long long ll = 4000;
              int i = (char)ll;
              printf("%d\n", i);
              return 0;
      Output was "4000", now "-96".
      Also: add "asmtest2" as asmtest with tcc compiled by itself
    • grischka's avatar
      build: restore out-of-tree support · afdbc5b8
      grischka authored
    • grischka's avatar
      build: revert Makefiles to 0.9.26 state (mostly) · 0a624782
      grischka authored
      - that libtcc1.a is now installed in subdirs i386/ etc.
      - the support for arm and arm64
      - some of the "Darwin" fixes
      - tests are mosly unchanged
      - removed the "legacy links for cross compilers" (was total mess)
      - removed "out-of-tree" build support (was broken anyway)
  30. 12 May, 2016 1 commit
  31. 06 May, 2016 1 commit
  32. 17 Apr, 2016 1 commit
  33. 05 Apr, 2016 1 commit
    • seyko's avatar
      Identifiers can start and/or contain '.' in *.S · d3e85e80
      seyko authored
          modified version of the old one which don't allow '.'
          in #define Identifiers. This allow correctly preprocess
          the following code in *.S
              #define SRC(y...)               \
              9999: y;                        \
              .section __ex_table, "a";       \
              .long 9999b, 6001f      ;       \
              // .previous
              SRC(1: movw (%esi), %bx)
          A test included.
  34. 15 Mar, 2016 1 commit
  35. 31 Oct, 2015 1 commit