@xnetx/tinyc-native-x86_64-apple-darwin 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/natives/x86_64-apple-darwin/toolchain/x86_64-apple-darwin/tinyc +0 -0
  2. package/package.json +15 -4
  3. package/packaging-manifest.json +67 -0
  4. package/sysroot/x86_64-apple-darwin/include/libtcc.h +116 -0
  5. package/sysroot/x86_64-apple-darwin/include/tinyc_io.h +123 -0
  6. package/sysroot/x86_64-apple-darwin/lib/tcc/bcheck.o +0 -0
  7. package/sysroot/x86_64-apple-darwin/lib/tcc/bcheck_run.o +0 -0
  8. package/sysroot/x86_64-apple-darwin/lib/tcc/bt-exe.o +0 -0
  9. package/sysroot/x86_64-apple-darwin/lib/tcc/bt-log.o +0 -0
  10. package/sysroot/x86_64-apple-darwin/lib/tcc/include/float.h +75 -0
  11. package/sysroot/x86_64-apple-darwin/lib/tcc/include/stdalign.h +16 -0
  12. package/sysroot/x86_64-apple-darwin/lib/tcc/include/stdarg.h +14 -0
  13. package/sysroot/x86_64-apple-darwin/lib/tcc/include/stdatomic.h +171 -0
  14. package/sysroot/x86_64-apple-darwin/lib/tcc/include/stdbool.h +11 -0
  15. package/sysroot/x86_64-apple-darwin/lib/tcc/include/stddef.h +39 -0
  16. package/sysroot/x86_64-apple-darwin/lib/tcc/include/stdnoreturn.h +7 -0
  17. package/sysroot/x86_64-apple-darwin/lib/tcc/include/tccdefs.h +338 -0
  18. package/sysroot/x86_64-apple-darwin/lib/tcc/include/tcclib.h +82 -0
  19. package/sysroot/x86_64-apple-darwin/lib/tcc/include/tgmath.h +89 -0
  20. package/sysroot/x86_64-apple-darwin/lib/tcc/include/varargs.h +12 -0
  21. package/sysroot/x86_64-apple-darwin/lib/tcc/libtcc1.a +0 -0
  22. package/sysroot/x86_64-apple-darwin/lib/tcc/runmain.o +0 -0
  23. package/sysroot/x86_64-apple-darwin/manifest.json +37 -0
  24. package/README.md +0 -3
package/package.json CHANGED
@@ -1,6 +1,17 @@
1
1
  {
2
2
  "name": "@xnetx/tinyc-native-x86_64-apple-darwin",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "TinyC native binaries for host x86_64-apple-darwin (dual-form TCC builds and target sysroots).",
5
+ "license": "LGPL-2.1-or-later",
6
+ "os": [
7
+ "darwin"
8
+ ],
9
+ "cpu": [
10
+ "x64"
11
+ ],
12
+ "files": [
13
+ "natives",
14
+ "sysroot",
15
+ "packaging-manifest.json"
16
+ ]
17
+ }
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "tinyc",
3
+ "layout": 1,
4
+ "kernelVersion": "0.9.28rc",
5
+ "combinations": [
6
+ {
7
+ "host": "x86_64-apple-darwin",
8
+ "target": "x86_64-apple-darwin",
9
+ "binary": "natives/x86_64-apple-darwin/toolchain/x86_64-apple-darwin/tinyc",
10
+ "sysroot": "sysroot/x86_64-apple-darwin",
11
+ "isa": {
12
+ "arch": "x86_64",
13
+ "bits": 64,
14
+ "endian": "little",
15
+ "simd": [
16
+ "sse",
17
+ "sse2",
18
+ "avx",
19
+ "avx2"
20
+ ]
21
+ },
22
+ "status": "included",
23
+ "libPath": "sysroot/x86_64-apple-darwin/lib/tcc",
24
+ "libtcc1": "sysroot/x86_64-apple-darwin/lib/tcc/libtcc1.a",
25
+ "outputs": {
26
+ "exe": {
27
+ "format": "Mach-O executable",
28
+ "ext": ""
29
+ },
30
+ "obj": {
31
+ "format": "Mach-O object",
32
+ "ext": ".o"
33
+ },
34
+ "shared": {
35
+ "format": "Mach-O dylib",
36
+ "ext": ".dylib"
37
+ },
38
+ "ar": {
39
+ "format": "ar archive",
40
+ "ext": ".a"
41
+ }
42
+ }
43
+ }
44
+ ],
45
+ "pending": [
46
+ {
47
+ "host": "x86_64-linux-gnu",
48
+ "target": "x86_64-linux-gnu",
49
+ "status": "pending"
50
+ },
51
+ {
52
+ "host": "aarch64-linux-gnu",
53
+ "target": "aarch64-linux-gnu",
54
+ "status": "pending"
55
+ },
56
+ {
57
+ "host": "x86_64-w64-mingw32",
58
+ "target": "x86_64-w64-mingw32",
59
+ "status": "pending"
60
+ },
61
+ {
62
+ "host": "arm64-apple-darwin",
63
+ "target": "arm64-apple-darwin",
64
+ "status": "pending"
65
+ }
66
+ ]
67
+ }
@@ -0,0 +1,116 @@
1
+ #ifndef LIBTCC_H
2
+ #define LIBTCC_H
3
+
4
+ #ifndef LIBTCCAPI
5
+ # define LIBTCCAPI
6
+ #endif
7
+
8
+ #ifdef __cplusplus
9
+ extern "C" {
10
+ #endif
11
+
12
+ /*****************************/
13
+ /* set custom allocator for all allocations (optional), NULL for default. */
14
+ typedef void *TCCReallocFunc(void *ptr, unsigned long size);
15
+ LIBTCCAPI void tcc_set_realloc(TCCReallocFunc *my_realloc);
16
+
17
+ /*****************************/
18
+ typedef struct TCCState TCCState;
19
+
20
+ /* create a new TCC compilation context */
21
+ LIBTCCAPI TCCState *tcc_new(void);
22
+
23
+ /* free a TCC compilation context */
24
+ LIBTCCAPI void tcc_delete(TCCState *s);
25
+
26
+ /* set CONFIG_TCCDIR at runtime */
27
+ LIBTCCAPI void tcc_set_lib_path(TCCState *s, const char *path);
28
+
29
+ /* set error/warning callback (optional) */
30
+ typedef void TCCErrorFunc(void *opaque, const char *msg);
31
+ LIBTCCAPI void tcc_set_error_func(TCCState *s, void *error_opaque, TCCErrorFunc *error_func);
32
+
33
+ /* set options as from command line (multiple supported) */
34
+ LIBTCCAPI int tcc_set_options(TCCState *s, const char *str);
35
+
36
+ /*****************************/
37
+ /* preprocessor */
38
+
39
+ /* add include path */
40
+ LIBTCCAPI int tcc_add_include_path(TCCState *s, const char *pathname);
41
+
42
+ /* add in system include path */
43
+ LIBTCCAPI int tcc_add_sysinclude_path(TCCState *s, const char *pathname);
44
+
45
+ /* define preprocessor symbol 'sym'. value can be NULL, sym can be "sym=val" */
46
+ LIBTCCAPI void tcc_define_symbol(TCCState *s, const char *sym, const char *value);
47
+
48
+ /* undefine preprocess symbol 'sym' */
49
+ LIBTCCAPI void tcc_undefine_symbol(TCCState *s, const char *sym);
50
+
51
+ /*****************************/
52
+ /* compiling */
53
+
54
+ /* add a file (C file, dll, object, library, ld script). Return -1 if error. */
55
+ LIBTCCAPI int tcc_add_file(TCCState *s, const char *filename);
56
+
57
+ /* compile a string containing a C source. Return -1 if error. */
58
+ LIBTCCAPI int tcc_compile_string(TCCState *s, const char *buf);
59
+
60
+ /* Tip: to have more specific errors/warnings from tcc_compile_string(),
61
+ you can prefix the string with "#line <num> \"<filename>\"\n" */
62
+
63
+ /*****************************/
64
+ /* linking commands */
65
+
66
+ /* set output type. MUST BE CALLED before any compilation */
67
+ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type);
68
+ #define TCC_OUTPUT_MEMORY 1 /* output will be run in memory */
69
+ #define TCC_OUTPUT_EXE 2 /* executable file */
70
+ #define TCC_OUTPUT_DLL 4 /* dynamic library */
71
+ #define TCC_OUTPUT_OBJ 3 /* object file */
72
+ #define TCC_OUTPUT_PREPROCESS 5 /* only preprocess */
73
+
74
+ /* equivalent to -Lpath option */
75
+ LIBTCCAPI int tcc_add_library_path(TCCState *s, const char *pathname);
76
+
77
+ /* the library name is the same as the argument of the '-l' option */
78
+ LIBTCCAPI int tcc_add_library(TCCState *s, const char *libraryname);
79
+
80
+ /* add a symbol to the compiled program */
81
+ LIBTCCAPI int tcc_add_symbol(TCCState *s, const char *name, const void *val);
82
+
83
+ /* output an executable, library or object file. DO NOT call
84
+ tcc_relocate() before. */
85
+ LIBTCCAPI int tcc_output_file(TCCState *s, const char *filename);
86
+
87
+ /* link and run main() function and return its value. DO NOT call
88
+ tcc_relocate() before. */
89
+ LIBTCCAPI int tcc_run(TCCState *s, int argc, char **argv);
90
+
91
+ /* do all relocations (needed before using tcc_get_symbol()) */
92
+ LIBTCCAPI int tcc_relocate(TCCState *s1);
93
+
94
+ /* return symbol value or NULL if not found */
95
+ LIBTCCAPI void *tcc_get_symbol(TCCState *s, const char *name);
96
+
97
+ /* list all (global) symbols and their values via 'symbol_cb()' */
98
+ LIBTCCAPI void tcc_list_symbols(TCCState *s, void *ctx,
99
+ void (*symbol_cb)(void *ctx, const char *name, const void *val));
100
+
101
+ /* experimental/advanced section (see libtcc_test_mt.c for an example) */
102
+
103
+ /* catch runtime exceptions (optionally limit backtraces at top_func),
104
+ when using tcc_set_options("-bt") and when not using tcc_run() */
105
+ LIBTCCAPI void *_tcc_setjmp(TCCState *s1, void *jmp_buf, void *top_func, void *longjmp);
106
+ #define tcc_setjmp(s1,jb,f) setjmp(_tcc_setjmp(s1, jb, f, longjmp))
107
+
108
+ /* custom error printer for runtime exceptions. Returning 0 stops backtrace */
109
+ typedef int TCCBtFunc(void *udata, void *pc, const char *file, int line, const char* func, const char *msg);
110
+ LIBTCCAPI void tcc_set_backtrace_func(TCCState *s1, void* userdata, TCCBtFunc*);
111
+
112
+ #ifdef __cplusplus
113
+ }
114
+ #endif
115
+
116
+ #endif
@@ -0,0 +1,123 @@
1
+ /* tinyc_io.h - IO abstraction for the TinyC dual-form kernel.
2
+ *
3
+ * All compiler-owned input/output goes through a TCCIO object.
4
+ * A NULL TCCIO everywhere in this API means the stdio implementation:
5
+ * output goes directly to the process's real stdout/stderr and input
6
+ * comes from the real stdin.
7
+ */
8
+ #ifndef TINYC_IO_H
9
+ #define TINYC_IO_H
10
+
11
+ #include <stddef.h>
12
+ #include <stdio.h>
13
+
14
+ #ifdef __cplusplus
15
+ extern "C" {
16
+ #endif
17
+
18
+ typedef struct TCCIO TCCIO;
19
+ struct TCCIO {
20
+ void *ctx;
21
+ /* Return the number of bytes consumed, or -1 on error. */
22
+ int (*write_out)(void *ctx, const char *buf, size_t len);
23
+ int (*write_err)(void *ctx, const char *buf, size_t len);
24
+ /* Return bytes read (0 = EOF), or -1 on error. */
25
+ int (*read_in)(void *ctx, char *buf, size_t cap);
26
+ void (*flush)(void *ctx);
27
+ /* Internal: release ctx. Set by constructors, used by tcc_io_free. */
28
+ void (*destroy_ctx)(void *ctx);
29
+ int is_singleton; /* stdio/null: tcc_io_free is a no-op */
30
+ };
31
+
32
+ /* ---- ready-made implementations ------------------------------------ */
33
+
34
+ /* The default: out -> stdout, err -> stderr, in <- stdin. Singleton. */
35
+ TCCIO *tcc_io_stdio(void);
36
+ /* Discards all output, input is always EOF. Singleton. */
37
+ TCCIO *tcc_io_null(void);
38
+ /* Accumulates out and err in two separate memory buffers. */
39
+ TCCIO *tcc_io_buffer(void);
40
+ /* Accumulates out and err in one shared buffer, in write order. */
41
+ TCCIO *tcc_io_buffer_merged(void);
42
+ /* Writes to files it opens itself (closed by tcc_io_free).
43
+ * err_path == NULL sends err to the same file as out. */
44
+ TCCIO *tcc_io_file(const char *out_path, const char *err_path);
45
+ /* Writes to borrowed file descriptors (never closed by tcc_io_free).
46
+ * A descriptor of -1 leaves that channel on stdio. */
47
+ TCCIO *tcc_io_fd(int out_fd, int err_fd, int in_fd);
48
+ /* Writes to borrowed FILE* streams (never closed by tcc_io_free).
49
+ * A NULL stream leaves that channel on stdio. */
50
+ TCCIO *tcc_io_FILE(FILE *out, FILE *err, FILE *in);
51
+ /* Fully custom callbacks. Any callback may be NULL (channel = stdio). */
52
+ TCCIO *tcc_io_callback(int (*write_out)(void *, const char *, size_t),
53
+ int (*write_err)(void *, const char *, size_t),
54
+ int (*read_in)(void *, char *, size_t),
55
+ void *ctx);
56
+ /* Sends every channel to both a and b. Takes ownership of neither. */
57
+ TCCIO *tcc_io_tee(TCCIO *a, TCCIO *b);
58
+
59
+ void tcc_io_free(TCCIO *io);
60
+
61
+ /* Buffer implementations only: channel 0 = out, 1 = err.
62
+ * For the merged buffer both channels return the same data. */
63
+ const char *tcc_io_buffer_data(TCCIO *io, int channel, size_t *len);
64
+ void tcc_io_buffer_clear(TCCIO *io);
65
+
66
+ /* ---- current IO (used by the compiler's own output paths) ---------- */
67
+
68
+ /* Install io as the current IO for subsequent compiler output.
69
+ * NULL restores the stdio default. */
70
+ void tinyc_set_io(TCCIO *io);
71
+ TCCIO *tinyc_get_io(void);
72
+
73
+ /* Write helpers honoring the current IO (stdio when none is set). */
74
+ int tinyc_io_write_out(const char *buf, size_t len);
75
+ int tinyc_io_write_err(const char *buf, size_t len);
76
+ void tinyc_io_out_str(const char *s);
77
+ void tinyc_io_err_str(const char *s);
78
+ void tinyc_io_out_fmt(const char *fmt, ...);
79
+ void tinyc_io_err_line(const char *s); /* writes s + "\n" to err */
80
+ void tinyc_io_flush_all(void);
81
+
82
+ /* On Linux: a FILE* whose writes forward to the current IO's out
83
+ * channel, or NULL when the current IO is the stdio default. */
84
+ FILE *tinyc_io_open_out_stream(void);
85
+
86
+ /* ---- -run stdio redirection ----------------------------------------- */
87
+
88
+ /* Called by tcc_run around the run program's entry point. When the
89
+ * current IO is a non-stdio TCCIO, the process's fd 0/1/2 are
90
+ * redirected through it for the duration of the run: fd 0 is fed the
91
+ * bytes read_in returns (then EOF), and what the program writes to
92
+ * fd 1/2 is delivered to write_out/write_err, per channel, when the
93
+ * run ends. The host's fds are restored by tinyc_run_redirect_end.
94
+ * With no IO installed, or the stdio IO, both functions are no-ops
95
+ * and the run program uses the process's real stdio.
96
+ * keep_stdin != 0 leaves fd 0 alone (tcc_run has already reopened
97
+ * stdin from a file for the program). Nested calls are counted:
98
+ * only the outermost pair redirects. */
99
+ void tinyc_run_redirect_begin(int keep_stdin);
100
+ void tinyc_run_redirect_end(void);
101
+
102
+ /* ---- run-path diagnostic markers ------------------------------------ */
103
+
104
+ /* Append one line to the platform diagnostic markers file
105
+ * (tinyc_init.markers on Windows). The run path calls these at its
106
+ * internal stage boundaries so that a crash inside tcc_run leaves
107
+ * the last completed stage on record. Only the Windows image has
108
+ * a markers file; everywhere else these are no-ops. */
109
+ void tinyc_diag_mark(const char *line);
110
+ void tinyc_diag_mark_ptr(const char *label, const void *p);
111
+
112
+ /* ---- dual-form entry points ----------------------------------------- */
113
+
114
+ /* The compiler's real main, exported from the dual-form file. */
115
+ int tinyc_main(int argc, char **argv);
116
+ /* tinyc_main with an IO installed for the duration of the call.
117
+ * The previous IO is restored before returning. */
118
+ int tinyc_main_io(int argc, char **argv, TCCIO *io);
119
+
120
+ #ifdef __cplusplus
121
+ }
122
+ #endif
123
+ #endif /* TINYC_IO_H */
@@ -0,0 +1,75 @@
1
+ #ifndef _FLOAT_H_
2
+ #define _FLOAT_H_
3
+
4
+ #define FLT_RADIX 2
5
+
6
+ /* IEEE float */
7
+ #define FLT_MANT_DIG 24
8
+ #define FLT_DIG 6
9
+ #define FLT_ROUNDS 1
10
+ #define FLT_EPSILON 1.19209290e-07F
11
+ #define FLT_MIN_EXP (-125)
12
+ #define FLT_MIN 1.17549435e-38F
13
+ #define FLT_MIN_10_EXP (-37)
14
+ #define FLT_MAX_EXP 128
15
+ #define FLT_MAX 3.40282347e+38F
16
+ #define FLT_MAX_10_EXP 38
17
+
18
+ /* IEEE double */
19
+ #define DBL_MANT_DIG 53
20
+ #define DBL_DIG 15
21
+ #define DBL_EPSILON 2.2204460492503131e-16
22
+ #define DBL_MIN_EXP (-1021)
23
+ #define DBL_MIN 2.2250738585072014e-308
24
+ #define DBL_MIN_10_EXP (-307)
25
+ #define DBL_MAX_EXP 1024
26
+ #define DBL_MAX 1.7976931348623157e+308
27
+ #define DBL_MAX_10_EXP 308
28
+
29
+ /* horrible intel long double */
30
+ #if defined __i386__ || defined __x86_64__
31
+
32
+ #define LDBL_MANT_DIG 64
33
+ #define LDBL_DIG 18
34
+ #define LDBL_EPSILON 1.08420217248550443401e-19L
35
+ #define LDBL_MIN_EXP (-16381)
36
+ #define LDBL_MIN 3.36210314311209350626e-4932L
37
+ #define LDBL_MIN_10_EXP (-4931)
38
+ #define LDBL_MAX_EXP 16384
39
+ #define LDBL_MAX 1.18973149535723176502e+4932L
40
+ #define LDBL_MAX_10_EXP 4932
41
+ #define DECIMAL_DIG 21
42
+
43
+ #elif defined __aarch64__ || defined __riscv
44
+ /*
45
+ * Use values from:
46
+ * gcc -dM -E -xc /dev/null | grep LDBL | sed -e "s/__//g"
47
+ */
48
+ #define LDBL_MANT_DIG 113
49
+ #define LDBL_DIG 33
50
+ #define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L
51
+ #define LDBL_MIN_EXP (-16381)
52
+ #define LDBL_MIN 3.36210314311209350626267781732175260e-4932L
53
+ #define LDBL_MIN_10_EXP (-4931)
54
+ #define LDBL_MAX_EXP 16384
55
+ #define LDBL_MAX 1.18973149535723176508575932662800702e+4932L
56
+ #define LDBL_MAX_10_EXP 4932
57
+ #define DECIMAL_DIG 36
58
+
59
+ #else
60
+
61
+ /* same as IEEE double */
62
+ #define LDBL_MANT_DIG 53
63
+ #define LDBL_DIG 15
64
+ #define LDBL_EPSILON 2.2204460492503131e-16L
65
+ #define LDBL_MIN_EXP (-1021)
66
+ #define LDBL_MIN 2.2250738585072014e-308L
67
+ #define LDBL_MIN_10_EXP (-307)
68
+ #define LDBL_MAX_EXP 1024
69
+ #define LDBL_MAX 1.7976931348623157e+308L
70
+ #define LDBL_MAX_10_EXP 308
71
+ #define DECIMAL_DIG 17
72
+
73
+ #endif
74
+
75
+ #endif /* _FLOAT_H_ */
@@ -0,0 +1,16 @@
1
+ #ifndef _STDALIGN_H
2
+ #define _STDALIGN_H
3
+
4
+ #if __STDC_VERSION__ < 201112L && (defined(__GNUC__) || defined(__TINYC__))
5
+ # define _Alignas(t) __attribute__((__aligned__(t)))
6
+ # define _Alignof(t) __alignof__(t)
7
+ #endif
8
+
9
+ #define alignas _Alignas
10
+ #define alignof _Alignof
11
+
12
+ #define __alignas_is_defined 1
13
+ #define __alignof_is_defined 1
14
+
15
+ #endif /* _STDALIGN_H */
16
+
@@ -0,0 +1,14 @@
1
+ #ifndef _STDARG_H
2
+ #define _STDARG_H
3
+
4
+ typedef __builtin_va_list va_list;
5
+ #define va_start __builtin_va_start
6
+ #define va_arg __builtin_va_arg
7
+ #define va_copy __builtin_va_copy
8
+ #define va_end __builtin_va_end
9
+
10
+ /* fix a buggy dependency on GCC in libio.h */
11
+ typedef va_list __gnuc_va_list;
12
+ #define _VA_LIST_DEFINED
13
+
14
+ #endif /* _STDARG_H */
@@ -0,0 +1,171 @@
1
+ /* This file is derived from clang's stdatomic.h */
2
+
3
+ /*===---- stdatomic.h - Standard header for atomic types and operations -----===
4
+ *
5
+ * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
6
+ * See https://llvm.org/LICENSE.txt for license information.
7
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8
+ *
9
+ *===-----------------------------------------------------------------------===
10
+ */
11
+
12
+ #ifndef _STDATOMIC_H
13
+ #define _STDATOMIC_H
14
+
15
+ #include <stddef.h>
16
+ #include <stdint.h>
17
+ #include <stdbool.h>
18
+
19
+ #define __ATOMIC_RELAXED 0
20
+ #define __ATOMIC_CONSUME 1
21
+ #define __ATOMIC_ACQUIRE 2
22
+ #define __ATOMIC_RELEASE 3
23
+ #define __ATOMIC_ACQ_REL 4
24
+ #define __ATOMIC_SEQ_CST 5
25
+
26
+ /* Memory ordering */
27
+ typedef enum {
28
+ memory_order_relaxed = __ATOMIC_RELAXED,
29
+ memory_order_consume = __ATOMIC_CONSUME,
30
+ memory_order_acquire = __ATOMIC_ACQUIRE,
31
+ memory_order_release = __ATOMIC_RELEASE,
32
+ memory_order_acq_rel = __ATOMIC_ACQ_REL,
33
+ memory_order_seq_cst = __ATOMIC_SEQ_CST,
34
+ } memory_order;
35
+
36
+ /* Atomic typedefs */
37
+ typedef _Atomic(_Bool) atomic_bool;
38
+ typedef _Atomic(char) atomic_char;
39
+ typedef _Atomic(signed char) atomic_schar;
40
+ typedef _Atomic(unsigned char) atomic_uchar;
41
+ typedef _Atomic(short) atomic_short;
42
+ typedef _Atomic(unsigned short) atomic_ushort;
43
+ typedef _Atomic(int) atomic_int;
44
+ typedef _Atomic(unsigned int) atomic_uint;
45
+ typedef _Atomic(long) atomic_long;
46
+ typedef _Atomic(unsigned long) atomic_ulong;
47
+ typedef _Atomic(long long) atomic_llong;
48
+ typedef _Atomic(unsigned long long) atomic_ullong;
49
+ typedef _Atomic(uint_least16_t) atomic_char16_t;
50
+ typedef _Atomic(uint_least32_t) atomic_char32_t;
51
+ typedef _Atomic(wchar_t) atomic_wchar_t;
52
+ typedef _Atomic(int_least8_t) atomic_int_least8_t;
53
+ typedef _Atomic(uint_least8_t) atomic_uint_least8_t;
54
+ typedef _Atomic(int_least16_t) atomic_int_least16_t;
55
+ typedef _Atomic(uint_least16_t) atomic_uint_least16_t;
56
+ typedef _Atomic(int_least32_t) atomic_int_least32_t;
57
+ typedef _Atomic(uint_least32_t) atomic_uint_least32_t;
58
+ typedef _Atomic(int_least64_t) atomic_int_least64_t;
59
+ typedef _Atomic(uint_least64_t) atomic_uint_least64_t;
60
+ typedef _Atomic(int_fast8_t) atomic_int_fast8_t;
61
+ typedef _Atomic(uint_fast8_t) atomic_uint_fast8_t;
62
+ typedef _Atomic(int_fast16_t) atomic_int_fast16_t;
63
+ typedef _Atomic(uint_fast16_t) atomic_uint_fast16_t;
64
+ typedef _Atomic(int_fast32_t) atomic_int_fast32_t;
65
+ typedef _Atomic(uint_fast32_t) atomic_uint_fast32_t;
66
+ typedef _Atomic(int_fast64_t) atomic_int_fast64_t;
67
+ typedef _Atomic(uint_fast64_t) atomic_uint_fast64_t;
68
+ typedef _Atomic(intptr_t) atomic_intptr_t;
69
+ typedef _Atomic(uintptr_t) atomic_uintptr_t;
70
+ typedef _Atomic(size_t) atomic_size_t;
71
+ typedef _Atomic(ptrdiff_t) atomic_ptrdiff_t;
72
+ typedef _Atomic(intmax_t) atomic_intmax_t;
73
+ typedef _Atomic(uintmax_t) atomic_uintmax_t;
74
+
75
+ /* Atomic flag */
76
+ typedef struct {
77
+ atomic_bool value;
78
+ } atomic_flag;
79
+
80
+ #define ATOMIC_FLAG_INIT {0}
81
+ #define ATOMIC_VAR_INIT(value) (value)
82
+
83
+ /* Generic routines */
84
+ #define atomic_init(object, desired) \
85
+ atomic_store_explicit(object, desired, __ATOMIC_RELAXED)
86
+
87
+ #define __atomic_store_n(ptr, val, order) \
88
+ ({ __typeof__ ((void)0, *(ptr)) __val = (val); \
89
+ __atomic_store((ptr), &__val, (order)); })
90
+ #define atomic_store_explicit(object, desired, order) \
91
+ ({ __typeof__ (object) ptr = (object); \
92
+ __typeof__ (*ptr) tmp = (desired); \
93
+ __atomic_store (ptr, &tmp, (order)); \
94
+ })
95
+ #define atomic_store(object, desired) \
96
+ atomic_store_explicit (object, desired, __ATOMIC_SEQ_CST)
97
+
98
+ #define __atomic_load_n(ptr, order) \
99
+ ({ typeof(*(ptr)) __val; \
100
+ __atomic_load((ptr), &__val, (order)); \
101
+ __val; })
102
+ #define atomic_load_explicit(object, order) \
103
+ ({ __typeof__ (object) ptr = (object); \
104
+ __typeof__ ((void)0,*ptr) tmp; \
105
+ __atomic_load (ptr, &tmp, (order)); \
106
+ tmp; \
107
+ })
108
+ #define atomic_load(object) atomic_load_explicit (object, __ATOMIC_SEQ_CST)
109
+
110
+ #define atomic_exchange_explicit(object, desired, order) \
111
+ ({ __typeof__ (object) ptr = (object); \
112
+ __typeof__ (*ptr) val = (desired); \
113
+ __typeof__ (*ptr) tmp; \
114
+ __atomic_exchange (ptr, &val, &tmp, (order)); \
115
+ tmp; \
116
+ })
117
+ #define atomic_exchange(object, desired) \
118
+ atomic_exchange_explicit (object, desired, __ATOMIC_SEQ_CST)
119
+ #define __atomic_compare_exchange_n(ptr, expected, desired, weak, success, failure) \
120
+ ({ typeof(*(ptr)) __desired = (desired); \
121
+ __atomic_compare_exchange((ptr), (expected), &__desired, \
122
+ (weak), (success), (failure)); })
123
+ #define atomic_compare_exchange_strong_explicit(object, expected, desired, success, failure) \
124
+ ({ __typeof__ (object) ptr = (object); \
125
+ __typeof__ (*ptr) tmp = desired; \
126
+ __atomic_compare_exchange(ptr, expected, &tmp, 0, success, failure); \
127
+ })
128
+ #define atomic_compare_exchange_strong(object, expected, desired) \
129
+ atomic_compare_exchange_strong_explicit (object, expected, desired, \
130
+ __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
131
+ #define atomic_compare_exchange_weak_explicit(object, expected, desired, success, failure) \
132
+ ({ __typeof__ (object) ptr = (object); \
133
+ __typeof__ (*ptr) tmp = desired; \
134
+ __atomic_compare_exchange(ptr, expected, &tmp, 1, success, failure); \
135
+ })
136
+ #define atomic_compare_exchange_weak(object, expected, desired) \
137
+ atomic_compare_exchange_weak_explicit (object, expected, desired, \
138
+ __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
139
+
140
+ #define atomic_fetch_add(object, operand) \
141
+ __atomic_fetch_add(object, operand, __ATOMIC_SEQ_CST)
142
+ #define atomic_fetch_add_explicit __atomic_fetch_add
143
+
144
+ #define atomic_fetch_sub(object, operand) \
145
+ __atomic_fetch_sub(object, operand, __ATOMIC_SEQ_CST)
146
+ #define atomic_fetch_sub_explicit __atomic_fetch_sub
147
+
148
+ #define atomic_fetch_or(object, operand) \
149
+ __atomic_fetch_or(object, operand, __ATOMIC_SEQ_CST)
150
+ #define atomic_fetch_or_explicit __atomic_fetch_or
151
+
152
+ #define atomic_fetch_xor(object, operand) \
153
+ __atomic_fetch_xor(object, operand, __ATOMIC_SEQ_CST)
154
+ #define atomic_fetch_xor_explicit __atomic_fetch_xor
155
+
156
+ #define atomic_fetch_and(object, operand) \
157
+ __atomic_fetch_and(object, operand, __ATOMIC_SEQ_CST)
158
+ #define atomic_fetch_and_explicit __atomic_fetch_and
159
+
160
+ extern void atomic_thread_fence (memory_order);
161
+ #define __atomic_thread_fence(order) atomic_thread_fence (order)
162
+ extern void atomic_signal_fence (memory_order);
163
+ #define __atomic_signal_fence(order) atomic_signal_fence(order)
164
+ extern bool __atomic_is_lock_free(size_t size, void *ptr);
165
+ #define atomic_is_lock_free(OBJ) __atomic_is_lock_free (sizeof (*(OBJ)), (OBJ))
166
+
167
+ extern bool atomic_flag_test_and_set(void *object);
168
+ extern bool atomic_flag_test_and_set_explicit(void *object, memory_order order);
169
+ extern void atomic_flag_clear(void *object);
170
+ extern void atomic_flag_clear_explicit(void *object, memory_order order);
171
+ #endif /* _STDATOMIC_H */
@@ -0,0 +1,11 @@
1
+ #ifndef _STDBOOL_H
2
+ #define _STDBOOL_H
3
+
4
+ /* ISOC99 boolean */
5
+
6
+ #define bool _Bool
7
+ #define true 1
8
+ #define false 0
9
+ #define __bool_true_false_are_defined 1
10
+
11
+ #endif /* _STDBOOL_H */
@@ -0,0 +1,39 @@
1
+ #ifndef _STDDEF_H
2
+ #define _STDDEF_H
3
+
4
+ typedef __SIZE_TYPE__ size_t;
5
+ typedef __PTRDIFF_TYPE__ ssize_t;
6
+ typedef __WCHAR_TYPE__ wchar_t;
7
+ typedef __PTRDIFF_TYPE__ ptrdiff_t;
8
+ typedef __PTRDIFF_TYPE__ intptr_t;
9
+ typedef __SIZE_TYPE__ uintptr_t;
10
+
11
+ #if __STDC_VERSION__ >= 201112L
12
+ typedef union { long long __ll; long double __ld; } max_align_t;
13
+ #endif
14
+
15
+ #ifndef NULL
16
+ #define NULL ((void*)0)
17
+ #endif
18
+
19
+ #undef offsetof
20
+ #define offsetof(type, field) __builtin_offsetof(type, field)
21
+
22
+ void *alloca(size_t size);
23
+
24
+ #endif
25
+
26
+ /* Older glibc require a wint_t from <stddef.h> (when requested
27
+ by __need_wint_t, as otherwise stddef.h isn't allowed to
28
+ define this type). Note that this must be outside the normal
29
+ _STDDEF_H guard, so that it works even when we've included the file
30
+ already (without requiring wint_t). Some other libs define _WINT_T
31
+ if they've already provided that type, so we can use that as guard.
32
+ TCC defines __WINT_TYPE__ for us. */
33
+ #if defined (__need_wint_t)
34
+ #ifndef _WINT_T
35
+ #define _WINT_T
36
+ typedef __WINT_TYPE__ wint_t;
37
+ #endif
38
+ #undef __need_wint_t
39
+ #endif
@@ -0,0 +1,7 @@
1
+ #ifndef _STDNORETURN_H
2
+ #define _STDNORETURN_H
3
+
4
+ /* ISOC11 noreturn */
5
+ #define noreturn _Noreturn
6
+
7
+ #endif /* _STDNORETURN_H */
@@ -0,0 +1,338 @@
1
+ /* tccdefs.h
2
+
3
+ Nothing is defined before this file except target machine, target os
4
+ and the few things related to option settings in tccpp.c:tcc_predefs().
5
+
6
+ This file is either included at runtime as is, or converted and
7
+ included as C-strings at compile-time (depending on CONFIG_TCC_PREDEFS).
8
+
9
+ Note that line indent matters:
10
+
11
+ - in lines starting at column 1, platform macros are replaced by
12
+ corresponding TCC target compile-time macros. See conftest.c for
13
+ the list of platform macros supported in lines starting at column 1.
14
+
15
+ - only lines indented >= 4 are actually included into the executable,
16
+ check tccdefs_.h.
17
+ */
18
+
19
+ #if __SIZEOF_POINTER__ == 4
20
+ /* 32bit systems. */
21
+ #if defined __OpenBSD__
22
+ #define __SIZE_TYPE__ unsigned long
23
+ #define __PTRDIFF_TYPE__ long
24
+ #else
25
+ #define __SIZE_TYPE__ unsigned int
26
+ #define __PTRDIFF_TYPE__ int
27
+ #endif
28
+ #define __ILP32__ 1
29
+ #define __INT64_TYPE__ long long
30
+ #elif __SIZEOF_LONG__ == 4
31
+ /* 64bit Windows. */
32
+ #define __SIZE_TYPE__ unsigned long long
33
+ #define __PTRDIFF_TYPE__ long long
34
+ #define __LLP64__ 1
35
+ #define __INT64_TYPE__ long long
36
+ #else
37
+ /* Other 64bit systems. */
38
+ #define __SIZE_TYPE__ unsigned long
39
+ #define __PTRDIFF_TYPE__ long
40
+ #define __LP64__ 1
41
+ # if defined __linux__
42
+ #define __INT64_TYPE__ long
43
+ # else /* APPLE, BSD */
44
+ #define __INT64_TYPE__ long long
45
+ # endif
46
+ #endif
47
+ #define __SIZEOF_INT__ 4
48
+ #define __INT_MAX__ 0x7fffffff
49
+ #if __SIZEOF_LONG__ == 4
50
+ #define __LONG_MAX__ 0x7fffffffL
51
+ #else
52
+ #define __LONG_MAX__ 0x7fffffffffffffffL
53
+ #endif
54
+ #define __SIZEOF_LONG_LONG__ 8
55
+ #define __LONG_LONG_MAX__ 0x7fffffffffffffffLL
56
+ #define __CHAR_BIT__ 8
57
+ #define __ORDER_LITTLE_ENDIAN__ 1234
58
+ #define __ORDER_BIG_ENDIAN__ 4321
59
+ #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
60
+ #if defined _WIN32
61
+ #define __WCHAR_TYPE__ unsigned short
62
+ #define __WINT_TYPE__ unsigned short
63
+ #elif defined __linux__
64
+ #define __WCHAR_TYPE__ int
65
+ #define __WINT_TYPE__ unsigned int
66
+ #else
67
+ #define __WCHAR_TYPE__ int
68
+ #define __WINT_TYPE__ int
69
+ #endif
70
+
71
+ #if __STDC_VERSION__ >= 201112L
72
+ # define __STDC_NO_ATOMICS__ 1
73
+ # define __STDC_NO_COMPLEX__ 1
74
+ # define __STDC_NO_THREADS__ 1
75
+ #if !defined _WIN32
76
+ # define __STDC_UTF_16__ 1
77
+ # define __STDC_UTF_32__ 1
78
+ #endif
79
+ #endif
80
+
81
+ #if defined _WIN32
82
+ #define __declspec(x) __attribute__((x))
83
+ #define __cdecl
84
+
85
+ #elif defined __FreeBSD__
86
+ #define __GNUC__ 9
87
+ #define __GNUC_MINOR__ 3
88
+ #define __GNUC_PATCHLEVEL__ 0
89
+ #define __GNUC_STDC_INLINE__ 1
90
+ #define __NO_TLS 1
91
+ #define __RUNETYPE_INTERNAL 1
92
+ # if __SIZEOF_POINTER__ == 8
93
+ #define __SIZEOF_SIZE_T__ 8
94
+ #define __SIZEOF_PTRDIFF_T__ 8
95
+ #else
96
+ #define __SIZEOF_SIZE_T__ 4
97
+ #define __SIZEOF_PTRDIFF_T__ 4
98
+ # endif
99
+
100
+ #elif defined __FreeBSD_kernel__
101
+
102
+ #elif defined __NetBSD__
103
+ #define __GNUC__ 4
104
+ #define __GNUC_MINOR__ 1
105
+ #define __GNUC_PATCHLEVEL__ 0
106
+ #define _Pragma(x)
107
+ #define __ELF__ 1
108
+ #if defined __aarch64__
109
+ #define _LOCORE /* avoids usage of __asm */
110
+ #endif
111
+
112
+ #elif defined __OpenBSD__
113
+ #define __GNUC__ 4
114
+ #define _ANSI_LIBRARY 1
115
+
116
+ #elif defined __APPLE__
117
+ /* emulate APPLE-GCC to make libc's headerfiles compile: */
118
+ #define __GNUC__ 4 /* darwin emits warning on GCC<4 */
119
+ #define __APPLE_CC__ 1 /* for <TargetConditionals.h> */
120
+ #define __LITTLE_ENDIAN__ 1
121
+ #define _DONT_USE_CTYPE_INLINE_ 1
122
+ /* avoids usage of GCC/clang specific builtins in libc-headerfiles: */
123
+ #define __FINITE_MATH_ONLY__ 1
124
+ #define _FORTIFY_SOURCE 0
125
+ //#define __has_builtin(x) 0
126
+ #define _Float16 short unsigned int /* fake type just for size & alignment (macOS Sequoia) */
127
+
128
+ #elif defined __ANDROID__
129
+ #define BIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD
130
+
131
+ #else
132
+ /* Linux */
133
+
134
+ #endif
135
+
136
+ /* Some derived integer types needed to get stdint.h to compile correctly on some platforms */
137
+ #ifndef __NetBSD__
138
+ #define __UINTPTR_TYPE__ unsigned __PTRDIFF_TYPE__
139
+ #define __INTPTR_TYPE__ __PTRDIFF_TYPE__
140
+ #endif
141
+ #define __INT32_TYPE__ int
142
+
143
+ #if !defined _WIN32
144
+ /* glibc defines. We do not support __USER_NAME_PREFIX__ */
145
+ #define __REDIRECT(name, proto, alias) name proto __asm__ (#alias)
146
+ #define __REDIRECT_NTH(name, proto, alias) name proto __asm__ (#alias) __THROW
147
+ #define __REDIRECT_NTHNL(name, proto, alias) name proto __asm__ (#alias) __THROWNL
148
+ #endif
149
+
150
+ /* not implemented */
151
+ #define __PRETTY_FUNCTION__ __FUNCTION__
152
+ #define __has_builtin(x) 0
153
+ #define __has_feature(x) 0
154
+ #define __has_attribute(x) 0
155
+ /* C23 Keywords */
156
+ #define _Nonnull
157
+ #define _Nullable
158
+ #define _Nullable_result
159
+ #define _Null_unspecified
160
+
161
+ /* skip __builtin... with -E */
162
+ #ifndef __TCC_PP__
163
+
164
+ #define __builtin_offsetof(type, field) ((__SIZE_TYPE__)&((type*)0)->field)
165
+ #define __builtin_extract_return_addr(x) x
166
+ #if !defined __linux__ && !defined _WIN32
167
+ /* used by math.h */
168
+ #define __builtin_huge_val() 1e500
169
+ #define __builtin_huge_valf() 1e50f
170
+ #define __builtin_huge_vall() 1e5000L
171
+ # if defined __APPLE__
172
+ #define __builtin_nanf(ignored_string) (0.0F/0.0F)
173
+ /* used by floats.h to implement FLT_ROUNDS C99 macro. 1 == to nearest */
174
+ #define __builtin_flt_rounds() 1
175
+ /* used by _fd_def.h */
176
+ #define __builtin_bzero(p, ignored_size) bzero(p, sizeof(*(p)))
177
+ # else
178
+ #define __builtin_nanf(ignored_string) (0.0F/0.0F)
179
+ # endif
180
+ #endif
181
+
182
+ /* GCC's __uint128_t appears in some Linux/OSX header files.
183
+ Just make it some type with same size and alignment. */
184
+ struct __uint128__ { char x[16]; } __attribute((__aligned__(16)));
185
+ #define __int128_t struct __uint128__
186
+ #define __uint128_t struct __uint128__
187
+
188
+ /* __builtin_va_list */
189
+ #if defined __x86_64__
190
+ #if !defined _WIN32
191
+ /* GCC compatible definition of va_list. */
192
+ /* This should be in sync with the declaration in our lib/va_list.c */
193
+ typedef struct {
194
+ unsigned gp_offset, fp_offset;
195
+ union {
196
+ unsigned overflow_offset;
197
+ char *overflow_arg_area;
198
+ };
199
+ char *reg_save_area;
200
+ } __builtin_va_list[1];
201
+
202
+ void *__va_arg(__builtin_va_list ap, int arg_type, int size, int align);
203
+ #define __builtin_va_start(ap, last) \
204
+ (*(ap) = *(__builtin_va_list)((char*)__builtin_frame_address(0) - 24))
205
+ #define __builtin_va_arg(ap, t) \
206
+ (*(t *)(__va_arg(ap, __builtin_va_arg_types(t), sizeof(t), __alignof__(t))))
207
+ #define __builtin_va_copy(dest, src) (*(dest) = *(src))
208
+
209
+ #else /* _WIN64 */
210
+ typedef char *__builtin_va_list;
211
+ #define __builtin_va_arg(ap, t) ((sizeof(t) > 8 || (sizeof(t) & (sizeof(t) - 1))) \
212
+ ? **(t **)((ap += 8) - 8) : *(t *)((ap += 8) - 8))
213
+ #endif
214
+
215
+ #elif defined __arm__
216
+ typedef char *__builtin_va_list;
217
+ #define _tcc_alignof(type) ((int)&((struct {char c;type x;} *)0)->x)
218
+ #define _tcc_align(addr,type) (((unsigned)addr + _tcc_alignof(type) - 1) \
219
+ & ~(_tcc_alignof(type) - 1))
220
+ #define __builtin_va_start(ap,last) (ap = ((char *)&(last)) + ((sizeof(last)+3)&~3))
221
+ #define __builtin_va_arg(ap,type) (ap = (void *) ((_tcc_align(ap,type)+sizeof(type)+3) \
222
+ &~3), *(type *)(ap - ((sizeof(type)+3)&~3)))
223
+
224
+ #elif defined __aarch64__
225
+ #if defined _WIN32
226
+ typedef char *__builtin_va_list;
227
+ #elif defined __APPLE__
228
+ typedef struct {
229
+ void *__stack;
230
+ } __builtin_va_list;
231
+
232
+ #else
233
+ typedef struct {
234
+ void *__stack, *__gr_top, *__vr_top;
235
+ int __gr_offs, __vr_offs;
236
+ } __builtin_va_list;
237
+
238
+ #endif
239
+ #elif defined __riscv
240
+ typedef char *__builtin_va_list;
241
+ #define __va_reg_size (__riscv_xlen >> 3)
242
+ #define _tcc_align(addr,type) (((unsigned long)addr + __alignof__(type) - 1) \
243
+ & -(__alignof__(type)))
244
+ #define __builtin_va_arg(ap,type) (*(sizeof(type) > (2*__va_reg_size) ? *(type **)((ap += __va_reg_size) - __va_reg_size) : (ap = (va_list)(_tcc_align(ap,type) + (sizeof(type)+__va_reg_size - 1)& -__va_reg_size), (type *)(ap - ((sizeof(type)+ __va_reg_size - 1)& -__va_reg_size)))))
245
+
246
+ #else /* __i386__ */
247
+ typedef char *__builtin_va_list;
248
+ #define __builtin_va_start(ap,last) (ap = ((char *)&(last)) + ((sizeof(last)+3)&~3))
249
+ #define __builtin_va_arg(ap,t) (*(t*)((ap+=(sizeof(t)+3)&~3)-((sizeof(t)+3)&~3)))
250
+
251
+ #endif
252
+ #define __builtin_va_end(ap) (void)(ap)
253
+ #ifndef __builtin_va_copy
254
+ # define __builtin_va_copy(dest, src) (dest) = (src)
255
+ #endif
256
+
257
+ /* TCC BBUILTIN AND BOUNDS ALIASES */
258
+ #ifdef __leading_underscore
259
+ # define __RENAME(X) __asm__("_"X)
260
+ #else
261
+ # define __RENAME(X) __asm__(X)
262
+ #endif
263
+
264
+ #ifdef __TCC_BCHECK__
265
+ # define __BUILTINBC(ret,name,params) ret __builtin_##name params __RENAME("__bound_"#name);
266
+ # define __BOUND(ret,name,params) ret name params __RENAME("__bound_"#name);
267
+ #else
268
+ # define __BUILTINBC(ret,name,params) ret __builtin_##name params __RENAME(#name);
269
+ # define __BOUND(ret,name,params)
270
+ #endif
271
+ #ifdef _WIN32
272
+ #define __BOTH __BOUND
273
+ #define __BUILTIN(ret,name,params)
274
+ #else
275
+ #define __BOTH(ret,name,params) __BUILTINBC(ret,name,params)__BOUND(ret,name,params)
276
+ #define __BUILTIN(ret,name,params) ret __builtin_##name params __RENAME(#name);
277
+ #endif
278
+
279
+ __BOTH(void*, memcpy, (void *, const void*, __SIZE_TYPE__))
280
+ __BOTH(void*, memmove, (void *, const void*, __SIZE_TYPE__))
281
+ __BOTH(void*, memset, (void *, int, __SIZE_TYPE__))
282
+ __BOTH(int, memcmp, (const void *, const void*, __SIZE_TYPE__))
283
+ __BOTH(__SIZE_TYPE__, strlen, (const char *))
284
+ __BOTH(char*, strcpy, (char *, const char *))
285
+ __BOTH(char*, strncpy, (char *, const char*, __SIZE_TYPE__))
286
+ __BOTH(int, strcmp, (const char*, const char*))
287
+ __BOTH(int, strncmp, (const char*, const char*, __SIZE_TYPE__))
288
+ __BOTH(char*, strcat, (char*, const char*))
289
+ __BOTH(char*, strncat, (char*, const char*, __SIZE_TYPE__))
290
+ __BOTH(char*, strchr, (const char*, int))
291
+ __BOTH(char*, strrchr, (const char*, int))
292
+ __BOTH(char*, strdup, (const char*))
293
+ #if defined __ARM_EABI__
294
+ __BOUND(void*,__aeabi_memcpy,(void*,const void*,__SIZE_TYPE__))
295
+ __BOUND(void*,__aeabi_memmove,(void*,const void*,__SIZE_TYPE__))
296
+ __BOUND(void*,__aeabi_memmove4,(void*,const void*,__SIZE_TYPE__))
297
+ __BOUND(void*,__aeabi_memmove8,(void*,const void*,__SIZE_TYPE__))
298
+ __BOUND(void*,__aeabi_memset,(void*,int,__SIZE_TYPE__))
299
+ #endif
300
+
301
+ #if defined __linux__ || defined __APPLE__ // HAVE MALLOC_REDIR
302
+ #define __MAYBE_REDIR __BUILTIN
303
+ #else
304
+ #define __MAYBE_REDIR __BOTH
305
+ #endif
306
+ __MAYBE_REDIR(void*, malloc, (__SIZE_TYPE__))
307
+ __MAYBE_REDIR(void*, realloc, (void *, __SIZE_TYPE__))
308
+ __MAYBE_REDIR(void*, calloc, (__SIZE_TYPE__, __SIZE_TYPE__))
309
+ __MAYBE_REDIR(void*, memalign, (__SIZE_TYPE__, __SIZE_TYPE__))
310
+ __MAYBE_REDIR(void, free, (void*))
311
+ __BOTH(void*, alloca, (__SIZE_TYPE__))
312
+ void *alloca(__SIZE_TYPE__);
313
+ __BUILTIN(void, abort, (void))
314
+ __BOUND(void, longjmp, ())
315
+ #if !defined _WIN32
316
+ __BOUND(void*, mmap, ())
317
+ __BOUND(int, munmap, ())
318
+ #endif
319
+ #undef __BUILTINBC
320
+ #undef __BUILTIN
321
+ #undef __BOUND
322
+ #undef __BOTH
323
+ #undef __MAYBE_REDIR
324
+ #undef __RENAME
325
+
326
+ #define __BUILTIN_EXTERN(name,u) \
327
+ int __builtin_##name(u int); \
328
+ int __builtin_##name##l(u long); \
329
+ int __builtin_##name##ll(u long long);
330
+ __BUILTIN_EXTERN(ffs,)
331
+ __BUILTIN_EXTERN(clz, unsigned)
332
+ __BUILTIN_EXTERN(ctz, unsigned)
333
+ __BUILTIN_EXTERN(clrsb,)
334
+ __BUILTIN_EXTERN(popcount, unsigned)
335
+ __BUILTIN_EXTERN(parity, unsigned)
336
+ #undef __BUILTIN_EXTERN
337
+
338
+ #endif /* ndef __TCC_PP__ */
@@ -0,0 +1,82 @@
1
+ /* Simple libc header for TCC
2
+ *
3
+ * Add any function you want from the libc there. This file is here
4
+ * only for your convenience so that you do not need to put the whole
5
+ * glibc include files on your floppy disk
6
+ */
7
+ #ifndef _TCCLIB_H
8
+ #define _TCCLIB_H
9
+
10
+ #include <stddef.h>
11
+ #include <stdarg.h>
12
+
13
+ /* stdlib.h */
14
+ void *calloc(size_t nmemb, size_t size);
15
+ void *malloc(size_t size);
16
+ void free(void *ptr);
17
+ void *realloc(void *ptr, size_t size);
18
+ int atoi(const char *nptr);
19
+ long int strtol(const char *nptr, char **endptr, int base);
20
+ unsigned long int strtoul(const char *nptr, char **endptr, int base);
21
+ void exit(int);
22
+ void *alloca(size_t);
23
+
24
+ /* stdio.h */
25
+ typedef struct __FILE FILE;
26
+ #define EOF (-1)
27
+ extern FILE *stdin;
28
+ extern FILE *stdout;
29
+ extern FILE *stderr;
30
+ FILE *fopen(const char *path, const char *mode);
31
+ FILE *fdopen(int fildes, const char *mode);
32
+ FILE *freopen(const char *path, const char *mode, FILE *stream);
33
+ int fclose(FILE *stream);
34
+ size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
35
+ size_t fwrite(void *ptr, size_t size, size_t nmemb, FILE *stream);
36
+ int fgetc(FILE *stream);
37
+ char *fgets(char *s, int size, FILE *stream);
38
+ int getc(FILE *stream);
39
+ int getchar(void);
40
+ char *gets(char *s);
41
+ int ungetc(int c, FILE *stream);
42
+ int fflush(FILE *stream);
43
+ int puts(const char *s);
44
+ int putchar (int c);
45
+
46
+ int printf(const char *format, ...);
47
+ int fprintf(FILE *stream, const char *format, ...);
48
+ int sprintf(char *str, const char *format, ...);
49
+ int snprintf(char *str, size_t size, const char *format, ...);
50
+ int asprintf(char **strp, const char *format, ...);
51
+ int dprintf(int fd, const char *format, ...);
52
+ int vprintf(const char *format, va_list ap);
53
+ int vfprintf(FILE *stream, const char *format, va_list ap);
54
+ int vsprintf(char *str, const char *format, va_list ap);
55
+ int vsnprintf(char *str, size_t size, const char *format, va_list ap);
56
+ int vasprintf(char **strp, const char *format, va_list ap);
57
+ int vdprintf(int fd, const char *format, va_list ap);
58
+
59
+ void perror(const char *s);
60
+
61
+ /* string.h */
62
+ char *strcat(char *dest, const char *src);
63
+ char *strchr(const char *s, int c);
64
+ char *strrchr(const char *s, int c);
65
+ char *strcpy(char *dest, const char *src);
66
+ void *memcpy(void *dest, const void *src, size_t n);
67
+ void *memmove(void *dest, const void *src, size_t n);
68
+ void *memset(void *s, int c, size_t n);
69
+ char *strdup(const char *s);
70
+ size_t strlen(const char *s);
71
+
72
+ /* dlfcn.h */
73
+ #define RTLD_LAZY 0x001
74
+ #define RTLD_NOW 0x002
75
+ #define RTLD_GLOBAL 0x100
76
+
77
+ void *dlopen(const char *filename, int flag);
78
+ const char *dlerror(void);
79
+ void *dlsym(void *handle, char *symbol);
80
+ int dlclose(void *handle);
81
+
82
+ #endif /* _TCCLIB_H */
@@ -0,0 +1,89 @@
1
+ /*
2
+ * ISO C Standard: 7.22 Type-generic math <tgmath.h>
3
+ */
4
+
5
+ #ifndef _TGMATH_H
6
+ #define _TGMATH_H
7
+
8
+ #include <math.h>
9
+
10
+ #ifndef __cplusplus
11
+ #define __tgmath_real(x, F) \
12
+ _Generic ((x), float: F##f, long double: F##l, default: F)(x)
13
+ #define __tgmath_real_2_1(x, y, F) \
14
+ _Generic ((x), float: F##f, long double: F##l, default: F)(x, y)
15
+ #define __tgmath_real_2(x, y, F) \
16
+ _Generic ((x)+(y), float: F##f, long double: F##l, default: F)(x, y)
17
+ #define __tgmath_real_3_2(x, y, z, F) \
18
+ _Generic ((x)+(y), float: F##f, long double: F##l, default: F)(x, y, z)
19
+ #define __tgmath_real_3(x, y, z, F) \
20
+ _Generic ((x)+(y)+(z), float: F##f, long double: F##l, default: F)(x, y, z)
21
+
22
+ /* Functions defined in both <math.h> and <complex.h> (7.22p4) */
23
+ #define acos(z) __tgmath_real(z, acos)
24
+ #define asin(z) __tgmath_real(z, asin)
25
+ #define atan(z) __tgmath_real(z, atan)
26
+ #define acosh(z) __tgmath_real(z, acosh)
27
+ #define asinh(z) __tgmath_real(z, asinh)
28
+ #define atanh(z) __tgmath_real(z, atanh)
29
+ #define cos(z) __tgmath_real(z, cos)
30
+ #define sin(z) __tgmath_real(z, sin)
31
+ #define tan(z) __tgmath_real(z, tan)
32
+ #define cosh(z) __tgmath_real(z, cosh)
33
+ #define sinh(z) __tgmath_real(z, sinh)
34
+ #define tanh(z) __tgmath_real(z, tanh)
35
+ #define exp(z) __tgmath_real(z, exp)
36
+ #define log(z) __tgmath_real(z, log)
37
+ #define pow(z1,z2) __tgmath_real_2(z1, z2, pow)
38
+ #define sqrt(z) __tgmath_real(z, sqrt)
39
+ #define fabs(z) __tgmath_real(z, fabs)
40
+
41
+ /* Functions defined in <math.h> only (7.22p5) */
42
+ #define atan2(x,y) __tgmath_real_2(x, y, atan2)
43
+ #define cbrt(x) __tgmath_real(x, cbrt)
44
+ #define ceil(x) __tgmath_real(x, ceil)
45
+ #define copysign(x,y) __tgmath_real_2(x, y, copysign)
46
+ #define erf(x) __tgmath_real(x, erf)
47
+ #define erfc(x) __tgmath_real(x, erfc)
48
+ #define exp2(x) __tgmath_real(x, exp2)
49
+ #define expm1(x) __tgmath_real(x, expm1)
50
+ #define fdim(x,y) __tgmath_real_2(x, y, fdim)
51
+ #define floor(x) __tgmath_real(x, floor)
52
+ #define fma(x,y,z) __tgmath_real_3(x, y, z, fma)
53
+ #define fmax(x,y) __tgmath_real_2(x, y, fmax)
54
+ #define fmin(x,y) __tgmath_real_2(x, y, fmin)
55
+ #define fmod(x,y) __tgmath_real_2(x, y, fmod)
56
+ #define frexp(x,y) __tgmath_real_2_1(x, y, frexp)
57
+ #define hypot(x,y) __tgmath_real_2(x, y, hypot)
58
+ #define ilogb(x) __tgmath_real(x, ilogb)
59
+ #define ldexp(x,y) __tgmath_real_2_1(x, y, ldexp)
60
+ #define lgamma(x) __tgmath_real(x, lgamma)
61
+ #define llrint(x) __tgmath_real(x, llrint)
62
+ #define llround(x) __tgmath_real(x, llround)
63
+ #define log10(x) __tgmath_real(x, log10)
64
+ #define log1p(x) __tgmath_real(x, log1p)
65
+ #define log2(x) __tgmath_real(x, log2)
66
+ #define logb(x) __tgmath_real(x, logb)
67
+ #define lrint(x) __tgmath_real(x, lrint)
68
+ #define lround(x) __tgmath_real(x, lround)
69
+ #define nearbyint(x) __tgmath_real(x, nearbyint)
70
+ #define nextafter(x,y) __tgmath_real_2(x, y, nextafter)
71
+ #define nexttoward(x,y) __tgmath_real_2(x, y, nexttoward)
72
+ #define remainder(x,y) __tgmath_real_2(x, y, remainder)
73
+ #define remquo(x,y,z) __tgmath_real_3_2(x, y, z, remquo)
74
+ #define rint(x) __tgmath_real(x, rint)
75
+ #define round(x) __tgmath_real(x, round)
76
+ #define scalbln(x,y) __tgmath_real_2_1(x, y, scalbln)
77
+ #define scalbn(x,y) __tgmath_real_2_1(x, y, scalbn)
78
+ #define tgamma(x) __tgmath_real(x, tgamma)
79
+ #define trunc(x) __tgmath_real(x, trunc)
80
+
81
+ /* Functions defined in <complex.h> only (7.22p6)
82
+ #define carg(z) __tgmath_cplx_only(z, carg)
83
+ #define cimag(z) __tgmath_cplx_only(z, cimag)
84
+ #define conj(z) __tgmath_cplx_only(z, conj)
85
+ #define cproj(z) __tgmath_cplx_only(z, cproj)
86
+ #define creal(z) __tgmath_cplx_only(z, creal)
87
+ */
88
+ #endif /* __cplusplus */
89
+ #endif /* _TGMATH_H */
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file has no copyright assigned and is placed in the Public Domain.
3
+ * This file is part of the w64 mingw-runtime package.
4
+ * No warranty is given; refer to the file DISCLAIMER within this package.
5
+ */
6
+ #ifndef _VARARGS_H
7
+ #define _VARARGS_H
8
+
9
+ #error "TinyCC no longer implements <varargs.h>."
10
+ #error "Revise your code to use <stdarg.h>."
11
+
12
+ #endif
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "tinyc",
3
+ "version": "0.9.28rc",
4
+ "target": "x86_64-apple-darwin",
5
+ "isa": {
6
+ "arch": "x86_64",
7
+ "bits": 64,
8
+ "endian": "little",
9
+ "simd": [
10
+ "sse",
11
+ "sse2",
12
+ "avx",
13
+ "avx2"
14
+ ]
15
+ },
16
+ "outputs": {
17
+ "exe": {
18
+ "format": "Mach-O executable",
19
+ "ext": ""
20
+ },
21
+ "obj": {
22
+ "format": "Mach-O object",
23
+ "ext": ".o"
24
+ },
25
+ "shared": {
26
+ "format": "Mach-O dylib",
27
+ "ext": ".dylib"
28
+ },
29
+ "ar": {
30
+ "format": "ar archive",
31
+ "ext": ".a"
32
+ }
33
+ },
34
+ "dual_file": "bin/tinyc",
35
+ "toolchain_include": "include",
36
+ "libtcc1": "lib/tcc/libtcc1.a"
37
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.