1. 09 Mar, 2023 4 commits
    • Michael Matz's avatar
      Fix more jumpopts (in ternary op) · 2cf3a6eb
      Michael Matz authored
      the code in expr_cond save nocode_wanted around some parts of
      expression evaluation, but at the wrong spots.  If the evaluation
      of the condition itself (e.g. in the testcase the first whole ternary
      expression) resulted in CODE_OFF, then that was saved, and restored
      before return, even if in-between codegen would have CODE_ON'ed already.
      Thus the whole CODE_OFF state bled out to outside the expression
      evaluation and also disabled the whole if-block.  Found by yarpgen v1
      (seed 64).
      2cf3a6eb
    • herman ten brugge's avatar
      Fix test90 for 32 bits targets · ec81877f
      herman ten brugge authored
      Should have used 'long long' instead of 'long' for 32 bits targets.
      ec81877f
    • herman ten brugge's avatar
      Fix Makefile install target · 80909254
      herman ten brugge authored
      Update target all before installing
      80909254
    • herman ten brugge's avatar
      Fix init bitfield padding with size 32/64 · 3f0a1719
      herman ten brugge authored
      The init code did not work for padding bitfields with size 32 and 64.
      3f0a1719
  2. 07 Mar, 2023 1 commit
    • Michael Matz's avatar
      Fix code suppression during nocode_wanted · c771cb52
      Michael Matz authored
      we activate code (CODE_ON) only when the target labels are used,
      which doesn't happen during nocode_wanted regions.  So, we cannot
      just switch off code either during nocode_wanted regions, nothing
      would switch it on again (except in the happy coincidences when we
      outright save/restore nocode_wanted).  See the testcase for one
      example, reduced from code generated by yarpgen: in
        ext = (xxx || 1)           // #1
              || ((xxx && 1) || 1) // #2
      code is first suppressed in #1 normally, then (before this commit)
      was suppressed via CODE_OFF during #2 (via indirect gjmp),
      then the suppression from #1 was undone, but nothing undoes the
      suppression from #2 anymore as everything therein was generated
      while nocode_wanted was active.
      
      So, we would either need to save/restore nocode_wanted around
      some more expressions, activate CODE_ON also with unused labels (breaks
      some optimizations we want), or deactivate CODE_OFF only when not
      already in nocode_wanted state.  This does the latter.
      c771cb52
  3. 05 Mar, 2023 1 commit
  4. 23 Feb, 2023 1 commit
  5. 22 Feb, 2023 1 commit
    • Michael Matz's avatar
      Fix sym_scope of typedefs · 605538f4
      Michael Matz authored
      Sym.sym_scope and Sym.f (FuncAttr) share space, so blindly setting
      one clobbers the other.  Right now this only leads to missing errors
      on incompatible typedefs (see testcase), which this commit fixes.
      
      But it points to a larger problem:
      Generally we can only manipulate Sym.f for anonymous and field symbols,
      not for anything that has a top-level name (basically any proper decl),
      because the latter use sym_scope.  Luckily the functions type always
      contains an anonymous symbol (in sym->type.ref), so we can use that.
      But some of the functions attributes actually _do_ apply to the decl,
      not the type (e.g. always_inline), so we still have a problem possibly,
      when we update an pre-existing type that may already be shared with
      another decl.
      
      Would need untangling and perhaps using accessor functions that check
      that Sym.f and Sym.sym_scope aren't used for the same symbol.
      605538f4
  6. 03 Feb, 2023 2 commits
  7. 17 Jan, 2023 3 commits
  8. 16 Jan, 2023 3 commits
  9. 01 Jan, 2023 2 commits
  10. 28 Dec, 2022 2 commits
  11. 27 Dec, 2022 4 commits
  12. 26 Dec, 2022 1 commit
  13. 24 Dec, 2022 1 commit
  14. 23 Dec, 2022 2 commits
  15. 22 Dec, 2022 2 commits
  16. 20 Dec, 2022 2 commits
    • herman ten brugge's avatar
      Add tcc -ar x and t options · 909d58dd
      herman ten brugge authored
      On macos we cannot use the ar because is does not support elf files
      and then does not generate a symbol table.
      The solution is to use 'tcc -ar'. The problem now is that some
      pacages first built an archive with 'tcc -ar c' and later extracts
      the archive with 'tcc -ar x' and built with this a dylib file.
      The 'tcc -ar x' failed. So I implemented it. I also added the t
      option because it was simple to do,
      909d58dd
    • herman ten brugge's avatar
      Add macos clang/ld compiler options · d5f25d19
      herman ten brugge authored
      With these option I can now built several packages without problem.
      There are a lot of options we can add so I tried to implement the
      minumum.
      
      Add the following options:
      dynamiclib		same as -shared
      flat_namespace		default/ignored
      two_levelnamespace	ignored
      undefined		default/ignored
      install_name		name of dynmic lib
      compatibility_version	version dynamic lib
      current_version	version version dynamic lib
      
      -Wl options:
      all_load		same as whole-archive
      force_load		same as whole-archive with lib
      single_module		ignored
      d5f25d19
  17. 18 Dec, 2022 1 commit
    • herman ten brugge's avatar
      Fix dll support for macho · f6f3d646
      herman ten brugge authored
      Export now all global symbols in export trie instead of only text
      symbols.
      
      I wrote too much data into dylib file because I did not check
      for sk_unknown/sk_discard/sk_uw_info.
      
      Simplified code in tccrun.c
      f6f3d646
  18. 17 Dec, 2022 2 commits
    • herman ten brugge's avatar
      Allow building lib with gcc/clang · 04810db8
      herman ten brugge authored
      Needed when using ...libtcc1-usegcc=yes in lib/Makefile.
      
      lib/bcheck.c: Add __clang__ for pragma diagnostic
      lib/bt-log.c: Add pragma diagnostic as in lib/bcheck.c
      lib/builtin.c: Add a lot of alias code to allow building with gcc/clang
      lib/stdatomic.c: Same as lib/builtin.c
      lib/tcov.c: Avoid clang compiler warning
      04810db8
    • herman ten brugge's avatar
      Fix dll support macho for x86_64 · d66a62fa
      herman ten brugge authored
      Macho uses bind/rebase instead of dynsym so disable them for relocate_sections.
      d66a62fa
  19. 16 Dec, 2022 1 commit
    • herman ten brugge's avatar
      Add dll support for macho · 8d3930bd
      herman ten brugge authored
      Update configure and remove dll=no for Darwin.
      Also removed dwarf=$dwarf because this is not a config option.
      
      In tccelf.c only add __PAGEZERO if stabs and executable.
      
      In tccrun.c correct rt_printline_dwarf code for dll.
      
      In tests/Makefile disable dlltest with PIC for Darwin because object
      format of .o file is still in elf.
      
      In tccmacho.c add dll support and and rpath support.
      Corrected trie code. For some reason symbol 'xx' should be after 'xx1'.
      Corrected weak symbol support for old macho code.
      Used R_JMP_SLOT instead of R_DATA_PTR in check_relocs.
      8d3930bd
  20. 13 Dec, 2022 1 commit
  21. 11 Dec, 2022 2 commits
  22. 10 Dec, 2022 1 commit