Commit Graph

3098 Commits

Author SHA1 Message Date
grischka
eadcee6501 macos: yet another tbd adjustment
configure:
- re-enable apple M1-arm64
- however, with --cpu=x86_64,  set -arch in CFLAGS/LDFLAGS too
  (assume rosetta)

Makefile:
- re-enable osx cross-test (Please do not disable tests)

tcc.h
- set TCC_IS_NATIVE for TCC_TARGET_MACHO on __APPLE__
- apply TCC_USING_DOUBLE_FOR_LDOUBLE for x86_64-osx

libtcc.c:
- cleanup tcc_add_file_internal()
- new function char *tcc_load_text(int fd); and use it for tbd files
2021-07-25 20:55:05 +02:00
Sushant Pandurangi
ecb384ac0c Fix 'unused function' warning on non-macOS targets 2021-07-17 13:42:54 +02:00
Brian Callahan
46bf3f940c Add register definitions for OpenBSD/riscv64 2021-07-09 12:16:18 -04:00
Christian Jullien
ab13f1a25a On Big Sur M1, force a x86_64 native build and count on Rosetta to make job as arm64 is not yet supported. 2021-07-08 09:37:37 +02:00
herman ten brugge
6e76d894fe Fix macOS memcheck problems 2021-07-07 10:05:23 +02:00
Christian Jullien
91a956823e [macOS] Add VT_LDOUBLE special case for Rosetta to handle --cpu=x86_64. 2021-07-07 09:50:20 +02:00
Christian Jullien
592cf7fb25 Temporary remove osx cross build which is broken, at least on Windows. 2021-07-07 09:09:12 +02:00
Christian Jullien
b964fc6922 dlopen does not exist on Windows, recent macOS adds a dlopen call which is skipped on Windows. 2021-07-07 09:08:15 +02:00
Sushant Pandurangi
588d64c538 (merge) macOS11+ dynamic linker support 2021-07-06 22:54:28 +02:00
Sushant Pandurangi
cca4ece0a8 macOS: get active SDK path from xcode-select 2021-07-06 22:48:38 +02:00
Sushant Pandurangi
d5e4b258e1 Minor fixes for gnu90 compatibility 2021-07-06 15:59:12 +02:00
Tyge Løvset
c4a2c52411 Added __faststorefence() MSVC intrinsic (required e.g. by sqlite3). 2021-07-04 13:32:55 +02:00
Sushant Pandurangi
33fa3a4d41 macOS 11: tcc -run using dyld shared cache 2021-07-04 11:07:48 +02:00
Sushant Pandurangi
f6fb4d0cf1 macOS 11: link using dyld shared cache
Supports linking using .tbd definitions found in the default installed
command-line tools SDK or Xcode.app SDK. Only for creating executables
(not yet for `tcc -run`).
2021-07-04 11:06:55 +02:00
Christian Jullien
e3a0eb5089 Minor change, help message starts with lowercase as other help strings. 2021-07-02 07:01:13 +02:00
Arthur Williams
ee75521dd5 Support -M, -MM, and -MMD
Add support for some more options to generate dependency fragments.
-M is likes -MD but doesn't compile anything so the command won't fail
when just supplied a file without all the relevant libs.
-MM and -MMD are like their counterparts but skip system libs.

Note the behavior of -MD has changed to include system libs. Use -MMD
for the old behavior. This matches gcc's corresponding flags
2021-07-01 01:44:34 -05:00
Arthur Williams
64d29c942a Have '-MF -' write to stdout
If a dash ("-") is specified to -MF, write to stdout instead of a file
called "-"
2021-07-01 01:44:23 -05:00
Arthur Williams
24d35faed2 Use grep -q instead of grep --quiet to be more portable 2021-07-01 01:44:23 -05:00
Christian Jullien
39d586d7fc gcc compiles .h files as .c source code, tcc now does the same and no longer complains with "unrecognized file type". It is however adviced to use "-x c" option which exists for this purpose in gcc and was supported by tcc. 2021-06-28 13:07:29 +02:00
herman ten brugge
b5d4b908c4 Fix function call on arm64 and riscv
arm64-gen.c/riscv64-gen.c
- Copy code from x86_64-gen.c (fetch cpu flag before generating any code)

tests/tcctest.c:
- Add test code
2021-06-22 07:38:39 +02:00
herman ten brugge
0378168c13 Fix macro processing
The code:

printf("%d\n", CALL(CONST));

did not work because we did not check for TOK_PLCHLDR.
2021-05-04 11:22:11 +02:00
Tyge Løvset
3564c47e52 Relicensing TinyCC 2021-04-27 11:56:43 +02:00
Danny Milosavljevic
431a74a446 Relicensing TinyCC 2021-04-26 19:34:27 +02:00
Danny Milosavljevic
9b76a64f96 riscv64-asm: Implement asm_clobber 2021-04-23 20:23:45 +02:00
Danny Milosavljevic
468f338e23 riscv64-asm: Optimize gen_le32 2021-04-23 20:23:45 +02:00
Danny Milosavljevic
99189ea707 riscv64-asm: Implement asm_parse_regvar 2021-04-23 20:23:45 +02:00
Danny Milosavljevic
b28bf50d2b riscv64-asm: Add beq, bne, blt, bge, bltu, bgeu 2021-04-23 20:23:45 +02:00
Danny Milosavljevic
9c0760a4d4 riscv64-asm: Add lb, lh, lw, lbu, lhu, ld, lwu, sb, sh, sw, sd 2021-04-23 20:23:45 +02:00
Danny Milosavljevic
1e37ec4917 riscv64-asm: Add add, addi, sub, addw, addd, addiw, addid, subw, subd, xor, xori, or, ori, and, andi, slt, slti, sltu, sltiu 2021-04-23 20:23:45 +02:00
Danny Milosavljevic
8b1a89fbdf riscv64-asm: Add sll, slli, srl, srli, sra, srai, sllw, slld, slliw, sllid, srlw, srld, srliw, srlid, sraw, srad, sraiw, sraid 2021-04-23 20:23:45 +02:00
Danny Milosavljevic
0b1cc489e1 riscv64-asm: Add lui, auipc 2021-04-23 20:23:45 +02:00
Danny Milosavljevic
e5a898e510 riscv64-asm: Add rdcycle, rdcycleh, rdtime, rdtimeh, rdinstret, rdinstreth 2021-04-23 20:23:45 +02:00
Danny Milosavljevic
4891ab71a0 riscv64-asm: Add fence, fence.i, scall, sbreak, ecall, ebreak, wfi 2021-04-23 20:23:45 +02:00
Danny Milosavljevic
7f3114ebba riscv64-asm: Remove asm_error 2021-04-23 20:23:45 +02:00
herman ten brugge
1432574b2b Fix make lib/stdatomic.c gcc compatible 2021-04-14 12:22:18 +02:00
herman ten brugge
f8e50d23f5 Make lib/stdatomic.c gcc compatible 2021-04-14 11:59:57 +02:00
herman ten brugge
0f0f701212 Fix va_arg fox x86_64 2021-04-13 09:23:13 +02:00
herman ten brugge
d64923c7b4 Fix testcase 125 fox x86_64 2021-04-13 09:13:25 +02:00
Christian Jullien
035ae7d735 Fix Makefile as suggested by Urs Janßen 2021-04-09 14:21:36 +02:00
grischka
48df89e10e stdatomics: tidy & cleanup
- remove any error messages that were just for debugging the
  templates really
- don't use c99 in tcc (array designators etc.)
- remove memory model type (cannot be an own type really)
  and move memory model defines from built-in to stdatomics.h
- apply normal casts to non-pointer atomic_function arguments
- tidy the library support
- add some tests for errors/warnings

Also:
- Makefile: move GIT_HASH stuff from CFLAGS to DEFINES and into
  main section (away from what is included by tests for example)
- tccelf.c/tccgen.c: avoid some warnings with newer GCC
2021-04-09 10:47:35 +02:00
Dmitry Selyutin
4bb3b3cec7 stdatomic: simple counter test 2021-04-05 20:57:05 +03:00
herman ten brugge
aa7727964b plt-reloc fix for macos 2021-04-02 12:51:38 +02:00
Christian Jullien
affd736f19 Add 'modified' before hash when tcc is built from a patched mob version. 2021-04-02 08:00:31 +02:00
Christian Jullien
f68b39b922 Surround hash code with double quotes 2021-03-31 23:15:47 +02:00
Christian Jullien
65d00b13d5 tcc -v displays short hash to ease detection of source version used to compile tcc 2021-03-31 22:24:29 +02:00
Dmitry Selyutin
47da8e450e stdatomic: ld/st/xchg/cmpxchg on simple types
Some complex types can still be small and simple enough to fit into
register. Other compilers allow some operations on these types, and it
seems to be quite a reasonable choice. From now on, we should be able
to compile the following artificial example:

    struct combo {
        uint16_t lo;
        uint16_t hi;
    };

    struct combo load(const _Atomic(struct combo) *atom)
    {
        return atomic_load(atom);
    }

    void store(_Atomic(struct combo) *atom, struct combo value)
    {
        atomic_store(atom, value);
    }

    struct combo xchg(_Atomic(struct combo) *atom, struct combo value)
    {
        return atomic_exchange(atom, value);
    }

    bool cmpxchg(_Atomic(struct combo) *atom,
            struct combo *cmp, struct combo xchg)
    {
        return atomic_compare_exchange_strong(atom, cmp, xchg);
    }

This might be useful for some corner cases, though it is quite likely
that many programmers will prefer operating on a single 32-bit value
instead of using the structure consisting of 16-bit pair.

Things will work as long as the overall structure size happens to be
the same as for any integer type we support in atomics.
2021-03-25 22:45:58 +03:00
Michael Wilder
82b0af7450 Fix empty initializer compile error on win32 2021-03-18 18:45:28 -04:00
Dmitry Selyutin
9ed3de91a2 stdatomic: i386/x86_64 support 2021-03-17 00:33:59 +03:00
Dmitry Selyutin
806b3f987e stdatomic: fix warnings 2021-03-17 00:29:57 +03:00
Dmitry Selyutin
1ff8679e79 stdatomic: refactor parser and generator 2021-03-09 12:24:08 +03:00