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. 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.
      
      Modifications:
      
      Makefile:
        add arm-asm.c to arm64_FILES
        add riscv64-asm.c (new file) to riscv64_FILES
      
      lib/Makefile:
        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
      
      tcc.h:
        Enable CONFIG_TCC_BCHECK for arm32/arm64/riscv64
        Add arm-asm.c, riscv64-asm.c
      
      tcctok.h:
        for arm use memmove4 instead of memcpy4
        for arm use memmove8 instead of memcpy8
      
      tccgen.c:
        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
      
      tccrun.c:
        Add riscv64 support
        fix rt_getcontext/rt_get_caller_pc for arm
      
      tccelf.c:
        tcc_load_dll: Print filename for bad architecture
      
      libtcc.c:
        add arm-asm.c/riscv64-asm.c
      
      tcc-doc.texi:
        Add arm, arm64, riscv64 support for bound checking
      
      lib/bcheck.c:
        add __bound___aeabi_memcpy/__bound___aeabi_memmove
            __bound___aeabi_memmove4/__bound___aeabi_memmove8
            __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
      
      arm-gen.c:
        add bound checking code like i386/x86_64
        assign_regs: only malloc if nb_args != 0
        gen_opi/gen_opf: Fix reload problems
      
      arm-link.c:
        relocate_plt: Fix address calculating
      
      arm64-gen.c:
        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
      
      arm64-link.c:
        code_reloc/gotplt_entry_type/relocate: add R_AARCH64_LDST64_ABS_LO12_NC
        relocate: Use addXXle instead of writeXXle
      
      riscv64-gen.c:
        add bound checking code like i386/x86_64
        add NB_ASM_REGS/CONFIG_TCC_ASM
      
      riscv64-link.c:
        relocate: Use addXXle instead of writeXXle
      
      i386-gen.c/x86_64-gen.c
        gen_bounds_epilog: Fix code (unrelated)
      
      tests/Makefile:
        add $(BTESTS) for arm/arm64/riscv64
      
      tests/tests2/Makefile:
        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)
      
      tests/boundtest.c:
        Only use alloca for i386/x86_64
      0b8ee736
  2. 05 Jun, 2020 1 commit
    • Michael Matz's avatar
      Fix type compatiblity of enums and ints · 9eef3399
      Michael Matz authored
      an enum must be compatible with one or more integer type,
      so adjust the test accordingly.  That means the following
      redeclarations should work:
      
        enum e6 { E1 = -1, E0 };
        void f3(enum e6);
        void f3(int);        // should work as int and e6 are compatible
      
      while the following should not:
      
        void f4(enum e6 e);
        void f4(unsigned e); // should error as unsigned and e6 are incompatible
      9eef3399
  3. 04 Jun, 2020 1 commit
    • Michael Matz's avatar
      pp: Move errors about stray backslashes · 068d5b3d
      Michael Matz authored
      they were emitted too early, in particular also in macro
      substitution which might turn out to not be stray in case it's
      further stringified.  Check in next() instead.  Add two testcases
      that an error is still emitted for obvious top-level baskslashes,
      and that stringifying such a thing works.
      068d5b3d
  4. 02 Jun, 2020 1 commit
  5. 01 Jun, 2020 2 commits
  6. 27 May, 2020 1 commit
  7. 25 May, 2020 1 commit
    • herman ten brugge's avatar
      Add sigsetjmp/siglongjmp bound checking support · 3b617fdc
      herman ten brugge authored
      tcctok.h:
      - Add sigsetjmp/__sigsetjmp/siglongjmp
      
      tccgen.c:
      - redirect sigsetjmp/siglongjmp to bcheck.c code
      
      i386-gen.c/x86_64-gen.c
      - gcall_or_jmp: Set func_bound_add_epilog also when sigsetjmp is called
      - gen_bounds_epilog: Only call __bound_local_new when needed (unrelated)
      
      bcheck.c:
      - Add __bound_siglongjmp
      - __bound_setjmp/__bound_long_jump: Check no_checking
      - Optimize __bound_local_delete (unrelated)
      
      Modify testcase:
      - 114_bound_signal
      3b617fdc
  8. 24 May, 2020 2 commits
    • herman ten brugge's avatar
      Fix gcc10 warnings · 045632de
      herman ten brugge authored
      i386-gen.c:
      - load/gen_opf: set v1.sym to NULL
      
      lib/Makefile:
      - Add -gstabs -fno-omit-frame-pointer -Wno-unused-function -Wno-unused-variable
      
      lib/bt-log.c:
      - tcc_backtrace: Prevent __builtin_frame_address warning
      
      tccgen.c:
      - struct_layout: Set t.t to VT_BYTE
      - default_debug: Use octal instead of -1 to make size_t work
      
      tccpp.c:
      - tal_realloc_impl: Only memcpy when p set
      
      x86_64-gen.c:
      - gen_bounds_epilog: Do not save/restore rcx (not caller/callee saved)
                           This also made stack not aligned to 16 bytes.
      045632de
    • herman ten brugge's avatar
      Add setjmp/longjmp bound checking support · b5b92c7d
      herman ten brugge authored
      tcctok.h:
      - Add __bound_setjmp/setjmp/_setjmp/longjmp
      
      tccgen.c:
      - redirect setjmp/longjmp to bcheck.c code
      
      i386-gen.c/x86_64-gen.c
      - Change func_bound_alloca_used into func_bound_add_epilog
      - Set func_bound_add_epilog also when setjmp is called
      
      bcheck.c:
      - Add __bound_setjmp/__bound_longjmp
      - __bound_local_delete: remove setjmp if used in function
      - __bound_exit: clear setjmp list and print statistic
      - make malloc_redir more readable (unrelated)
      
      New testcases:
      - 115_bound_setjmp
      - 116_bound_setjmp2
      b5b92c7d
  9. 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).
      4429cef9
    • 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
      7bb5454e
  10. 11 May, 2020 4 commits
  11. 05 May, 2020 2 commits
  12. 04 May, 2020 1 commit
  13. 03 May, 2020 1 commit
    • herman ten brugge's avatar
      Add symbolic debug support · 3e731e3a
      herman ten brugge authored
      This allows debugging with variables/structs/unions/enums/bitfields.
      
      Add new functions:
      - tcc_debug_stabs: store stabs debug info
      - tcc_debug_stabn: store stabn debug info
      - tcc_get_debug_info: generate stabs debug info
      - tcc_debug_finish: store debug info in debug section
      - tcc_add_debug_info: Add function debug info
      
      Update functions:
      - tcc_debug_end: free debug hash
      - tcc_debug_funcstart: Generate correct function debug info
      - tcc_debug_funcend: Finish debug info
      - put_extern_sym2: Generate debug info for symbols
      - pop_local_syms: Add debug info
      - prev_scope: Add local symbols
      3e731e3a
  14. 16 Apr, 2020 3 commits
    • Michael Matz's avatar
      riscv64: fcvt.d.s doesn't need a rounding mode · fb1fb821
      Michael Matz authored
      it doesn't round so the RM field can be zero.  According to some
      sourcs it should be set to zero by software in these cases, and
      the binutils disassembler doesn't like us setting it to 7.
      
      This shouldn't matter in practice, but who knows.
      fb1fb821
    • Michael Matz's avatar
      musl: disable boundcheck tests · 2f943902
      Michael Matz authored
      for now that doesn't work with musl libc.
      2f943902
    • Michael Matz's avatar
      stdarg: always have the __builtin_va_* available · 245f6a0d
      Michael Matz authored
      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.
      245f6a0d
  15. 15 Apr, 2020 6 commits
    • Michael Matz's avatar
      Fix stdarg on x86-64 · 8c6143d8
      Michael Matz authored
      this partly reverts 1803762e 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.
      8c6143d8
    • Robert Hoelzl's avatar
      Make tcclib1.a compile on macOS again · 1803762e
      Robert Hoelzl authored
      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.
      1803762e
    • Michael Matz's avatar
      Factor out common type combination · 38ab621b
      Michael Matz authored
      as there's overlap between handling types for binary and ternay
      operations.  Factor this into a single routine (combine_types).
      This uses the structure that gen_op was following, and expr_cond
      was using as well in the past, which I find easier to reconvene
      with the standard language.  But it reuses the new functions for
      diagnostics to improve (a little) on what GCC or clang produce :)
      38ab621b
    • Michael Matz's avatar
      Expect c99 support in tcctest.c · c085645f
      Michael Matz authored
      the support for the macro GCC_MAJOR is gone since 2017, and it's
      fairly doubtful that anyone serious is using gcc 2.95.
      
      Also adds a test for the ternary ops typing rules: 'x?bool:bool' has
      to promote to int.
      c085645f
    • Michael Matz's avatar
      Move type_incompatibility_error earlier · 00fbf655
      Michael Matz authored
      also move type_incompatibility_warning and type_to_str.
      00fbf655
    • Michael Matz's avatar
      Fix interaction of (local) labels and stmt exprs · 096c93c0
      Michael Matz authored
      as per testcase.  We must not reset token.sym_label twice with
      kept symbols.  This is no problem for non-label symbols because those
      aren't generated on demand when mentioning them.
      096c93c0
  16. 12 Apr, 2020 2 commits
    • grischka's avatar
      win32: long double as distinct C-type · 6696da2f
      grischka authored
      On windows. there is no long double really IOW it is the
      same as double.  However setting the VT_LONG flag in
      combination with VT_DOUBLE allows to keep track of the
      original type for the purpose of '_Generic() or more
      accurate type warnings.
      6696da2f
    • grischka's avatar
      win32/include/math.h: rint/trunc: pop fp stack · d0195863
      grischka authored
      ... in order to avoid fp stack overflow (see test below).
      
      #include <math.h>
      #include <stdio.h>
      int main()
      {
         printf("%f %f %f %f\n", trunc(1.2), rint(1.2), trunc(1.2), rint(1.2));
         printf("%f %f %f %f\n", trunc(1.2), rint(1.2), trunc(1.2), rint(1.2));
         printf("%f %f %f %f\n", trunc(1.2), rint(1.2), trunc(1.2), rintl(1.2));
      }
      
      Also in rintl:
      - 'long double' is not a ten-byte float on windows.
      d0195863
  17. 11 Apr, 2020 1 commit
    • Tyge's avatar
      Finalizing math.h fixes: · 024214af
      Tyge authored
      - Updated msvcrt.def with symbols from 64bit version of dll - it contains the float math functions missing in the 32bit dll.
      - Made sure this patch only apply to to WIN32 and WIN64. For WIN32 float functions calls the double variants, on 64bit they are called natively.
      024214af
  18. 08 Apr, 2020 1 commit
    • Tyge's avatar
      Minimum changes to make all float variants of math.h functions work, · df67d861
      Tyge authored
      by calling the double functions and removing unsupported __asm implementations using "=t".
      This patch also enables the double version of logb(double).
      
      Note: None of the 'long double' variants works though - could easily be fixed
      by aliasing the double equvalents for completeness/compability.
      df67d861
  19. 22 Mar, 2020 3 commits
  20. 21 Mar, 2020 1 commit
  21. 14 Mar, 2020 1 commit
  22. 04 Mar, 2020 2 commits