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.
Last successful update .
  1. 07 7月, 2021 1 次提交
  2. 16 1月, 2021 1 次提交
  3. 13 1月, 2021 2 次提交
  4. 12 1月, 2021 1 次提交
  5. 11 1月, 2021 1 次提交
  6. 06 1月, 2021 2 次提交
  7. 30 12月, 2020 1 次提交
    • herman ten brugge's avatar
      text relocation for netbsd · 0821940e
      herman ten brugge 创作于
      netbsd does not allow text relocations in text segment.
      
      tcc.h:
      - Add data_ro_section
      - Fix typo rela.plt
      
      tccelf.c:
      - Add data_ro_section
      - Make bounds_section/lbounds_section rw
      - Add GNU_RELRO section for data_ro_section/bounds_section/lbounds_section
      - Fix relocation for __dso_handle in atexit()
      
      tccgen.c:
      - Use data_ro_section
      
      x86_64-gen.c:
      - Use R_X86_64_PC32 instead of R_X86_64_64 for bounds checking
      
      tests/Makefile, tests/tests2/Makefile
      - Enable dll tests for netbsd
      0821940e
  8. 20 12月, 2020 1 次提交
    • herman ten brugge's avatar
      bsd update · 7f898abb
      herman ten brugge 创作于
      Fix crtbegin/crtend
      Use dlsym on all bsd targets
      Check .eh_frame on all bsd targets
      Disable test3 on FreeBSD and NetBSD and use test1 instead because dlsym not working (WIP)
      Disable dlltest and 113_btdll on NetBSD because text relocations are not allowed
      Disable 115_bound_setjmp on NetBSD because longjmp is renamed into __longjmp14
      7f898abb
  9. 18 12月, 2020 1 次提交
    • herman ten brugge's avatar
      lazy binding · 50b4f320
      herman ten brugge 创作于
      Currently tcc does not use lazy binding. It puts all relocations in the RELX
      section and solve them all at startup.
      This was not working on bsd.
      
      tcc.h:
      - New RELPLT_SECTION_FMT for plt relocations
      - New entry relocplt in struct Section
      
      tccelf.c:
      - put_elf_reloca: put R_JMP_SLOT in relocplt section
      - build_got_entries*: Use two passes because R_JMP_SLOT and R_GLOB_DAT
                            can not be intermixed on some targets (arm, arm64)
      - layout_sections: Calculate correct size relocplt section for DT_ values.
                         Make sure relocplt is last
      - fill_dynamic: Add DT_ values when got is filled
                      move DT_VERSYM because dynamic linker cannot handle it standone
      - Add note section for NetBSD
      
      arm-link.c/arm64-link.c/i386-link.c/riscv64-link.c/x86_64-link.c:
      - fill got table with pointer to plt section or symbol value in case
        of TCC_OUTPUT_MEMORY
      
      arm-link.c/arm64-link.c:
      - fix offset first plt entry
      
      i386-link.c/x86_64-link.c:
      - use correct reloc entry
      - use relofs - sizeof (ElfW_Rel) because the reloc is already done
      
      lib/bcheck.c:
      - no __libc_freeres on FreeBSD and NetBSD
      
      tests/Makefile:
      - Add -fno-stack-protector for OpenBSD
      
      tests/tests2/Makefile:
      - disable 106_pthread/114_bound_signal
      50b4f320
  10. 17 12月, 2020 1 次提交
    • grischka's avatar
      replace native platform macros in the compiler · e2e62fcb
      grischka 创作于
      - The compiler should not use these
      - However tccrun.c & libtcc1.a files should use these
      Also:
      - use s1->loaded_dlls for loaded dlls instead of dlopens
      - alpine musl: fully supported now and tested
      - ./configure ...
         --config-backtrace=no : disable backtraces
         --config-bcheck=no : disable bcheck
      - tests:dlltest: enable by default
      - tccrun.c : simplify mmaps
      - __builtin_alloca : always use asm-alias (instead of #define)
      - tccpe.c : use write32le
      e2e62fcb
  11. 09 12月, 2020 1 次提交
    • grischka's avatar
      tcc_enter/exit_state(): do not use! · 8ff70555
      grischka 创作于
      tcc_enter/exit_state() are meant exclusively to protect
      the tcc_compile() and its sub-functions in tccpp.c,
      tccgen.c, tccasm.c and xxx-gen.c.
      
      Other files that are part of libtcc simply must not use global
      variables.
      
      - riscv64/last_hi: move to TCCState
        from 72250bec
      
      - tccrun.c: Using a fixed address would not work anyway
        ("tcc -run tcc.c -run ..." for example)
        from baacb0f5
      
      - tests/Makefile: support for a platform doesn't make sense if
        it doesn't pass our basic tests.
        from 591feda1
      Also:
      - tccgen: cleanup "duplicate member" (only 2 passes,
        avoids additional TokenSym field)
        from 170be79a
      8ff70555
  12. 07 12月, 2020 1 次提交
  13. 09 7月, 2020 2 次提交
  14. 06 7月, 2020 1 次提交
    • grischka's avatar
      some cleanups related to recent commits · 72277967
      grischka 创作于
      - configure/Makefile : cleanup, really use CC_NAME
      - tccasm.c : remove C99 construct that MSVC doesn't compile
      - arm-gen.c, x86_64-gen.c, riscv64-gen.c, tccmacho.c : ditto
      - arm64-gen.c: commit 383acf8e wrote:
        "Instead of a cast, it would be better to pass the exact type."
        It is true that there are better solutions but it is not
        passing the exact type (I think).
      - tcctest.c: revert "fix cast test for clang" 03646ad4
        this obviously wants to test non-portable conversions
      - 114_bound_signal.test: clock_nanosleep is too new for older
        linuxes, just use sleep() instead
      72277967
  15. 21 6月, 2020 3 次提交
    • Michael Matz's avatar
      macos: Fix memtest · d174af08
      Michael Matz 创作于
      * free allocated memory
      * fix weak symbols related to -run
      * remove memtest from ignored tests for OSX
      d174af08
    • Michael Matz's avatar
      macos: Fix asm-c-connect-test · fbfe6209
      Michael Matz 创作于
      via some heavy-handed hackery in the ASM symbol handling in case
      C symbols get a leading underscore (but ASM symbols do not).
      But this is now like clang and GCC on Darwin work: asm symbols are
      undecorated, C symbols get a _ prepended, so to connect both some
      trickery is involved for the ASM symbols that don't have a _ prepended.
      They must be included in the C symbol table (because that's what we use
      to lookup also ASM labels), but they also must not disturb the normal
      C symbol (which don't have the _ prepended), so they need some mangling.
      
      A bit unsatisfying, but well.  So, add asm-c-connect-test to the working
      ones for Darwin as well.
      fbfe6209
    • Michael Matz's avatar
      macos: Enable all working tests · 3cf7bec1
      Michael Matz 创作于
      all except the below work now on MacOS, also as executable test,
      not just with -run:
      * dlltest - we don't support dylib generation (yet)
      * memtest - tccmacho.c contains some leaks
      * asm-c-connect-test - some confusion with underscores still
      3cf7bec1
  16. 17 6月, 2020 1 次提交
  17. 16 6月, 2020 1 次提交
    • herman ten brugge's avatar
      Add bound checking to arm, arm64 and riscv64 · 0b8ee736
      herman ten brugge 创作于
      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
  18. 13 5月, 2020 2 次提交
    • grischka's avatar
      tccgen.c: merge more function attributes · 4429cef9
      grischka 创作于
      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 创作于
      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
  19. 16 4月, 2020 1 次提交
  20. 18 1月, 2020 1 次提交
    • gr's avatar
      tccrun.c: standalone backtraces with -bt[N] or -b · ef42295f
      gr 创作于
      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
  21. 15 1月, 2020 1 次提交
    • herman ten brugge's avatar
      Update bound checking code. · 38776187
      herman ten brugge 创作于
      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
  22. 18 12月, 2019 1 次提交
  23. 17 12月, 2019 1 次提交
  24. 14 12月, 2019 1 次提交
    • grischka's avatar
      bcheck cleanup · 56db092a
      grischka 创作于
      - 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
  25. 13 12月, 2019 1 次提交
    • herman ten brugge's avatar
      Add new bounds checking functions. · 39c0ff31
      herman ten brugge 创作于
      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.
      39c0ff31
  26. 12 12月, 2019 2 次提交
  27. 11 12月, 2019 2 次提交
    • herman ten brugge's avatar
      Fix bounds checking after concurrently commit · a0bc149b
      herman ten brugge 创作于
      a0bc149b
    • grischka's avatar
      allow libtcc states to be used concurrently · 72729d8e
      grischka 创作于
      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.
      72729d8e
  28. 10 12月, 2019 1 次提交
  29. 14 3月, 2019 1 次提交
  30. 10 3月, 2018 1 次提交
  31. 13 12月, 2017 1 次提交
    • grischka's avatar
      final update for 0.9.27 · d348a9a5
      grischka 创作于
      tccgen.c:
      - 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.c:
      - 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)
      
      Makefile:
      - suppress some warnings when makeinfo is missing
      - call 'which install' only on win32
      
      tests/Makefile:
      - 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)
      
      other:
      - #define SECTION_ABS removed
      - ST_DATA Section *strtab_section: removed
      - put_extern_sym2(): take int section number
      
      Conflicts:
      	tccelf.c
      	tccpe.c
      
      Conflicts:
      	tccelf.c
      d348a9a5
  32. 04 12月, 2017 1 次提交
    • Michael Matz's avatar
      Fix another corner case with C/asm symtable · cc6cb7f0
      Michael Matz 创作于
      See testcase (from grischka).  If the asm has no .globl,
      but there's a (non-static) C definition the symbol should
      be exported, even if the first reference comes from asm.
      cc6cb7f0