Vendor tinycc and build the compositor in debug with it (just build/run)
CI / test (push) Successful in 38s
CI / test (push) Successful in 38s
moon adds -DMOONBIT_NATIVE_NO_SYS_HEADER whenever the C compiler is tcc, which compiles the system runtime out and breaks linking a standalone exe; the scripts/tcc/tcc wrapper drops that flag. just tcc-build builds third_party/tinycc into _build/tcc; build-release keeps the optimised system-cc build. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
49e91b4c01
commit
7a37039673
96 files changed
+83760
-4
No files matched your search
Vendored
+86
@@ -0,0 +1,86 @@
|
||||
/* ------------------------------------------------------------- */
|
||||
/* support for tcc_run() */
|
||||
|
||||
#ifdef __leading_underscore
|
||||
# define _(s) s
|
||||
#else
|
||||
# define _(s) _##s
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
extern void (*_(_init_array_start)[]) (int argc, char **argv, char **envp);
|
||||
extern void (*_(_init_array_end)[]) (int argc, char **argv, char **envp);
|
||||
static void run_ctors(int argc, char **argv, char **env)
|
||||
{
|
||||
int i = 0;
|
||||
while (&_(_init_array_start)[i] != _(_init_array_end))
|
||||
(*_(_init_array_start)[i++])(argc, argv, env);
|
||||
}
|
||||
#endif
|
||||
|
||||
extern void (*_(_fini_array_start)[]) (void);
|
||||
extern void (*_(_fini_array_end)[]) (void);
|
||||
static void run_dtors(void)
|
||||
{
|
||||
int i = 0;
|
||||
while (&_(_fini_array_end)[i] != _(_fini_array_start))
|
||||
(*_(_fini_array_end)[--i])();
|
||||
}
|
||||
|
||||
static void *rt_exitfunc[32];
|
||||
static void *rt_exitarg[32];
|
||||
static int __rt_nr_exit;
|
||||
|
||||
void __run_on_exit(int ret)
|
||||
{
|
||||
int n = __rt_nr_exit;
|
||||
while (n)
|
||||
--n, ((void(*)(int,void*))rt_exitfunc[n])(ret, rt_exitarg[n]);
|
||||
}
|
||||
|
||||
int on_exit(void *function, void *arg)
|
||||
{
|
||||
int n = __rt_nr_exit;
|
||||
if (n < 32) {
|
||||
rt_exitfunc[n] = function;
|
||||
rt_exitarg[n] = arg;
|
||||
__rt_nr_exit = n + 1;
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int atexit(void (*function)(void))
|
||||
{
|
||||
return on_exit(function, 0);
|
||||
}
|
||||
|
||||
typedef struct rt_frame {
|
||||
void *ip, *fp, *sp;
|
||||
} rt_frame;
|
||||
|
||||
__attribute__((noreturn)) void __rt_exit(rt_frame *, int);
|
||||
|
||||
void exit(int code)
|
||||
{
|
||||
rt_frame f;
|
||||
run_dtors();
|
||||
__run_on_exit(code);
|
||||
f.fp = 0;
|
||||
f.ip = exit;
|
||||
__rt_exit(&f, code);
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
int main(int, char**, char**);
|
||||
|
||||
int _runmain(int argc, char **argv, char **envp)
|
||||
{
|
||||
int ret;
|
||||
run_ctors(argc, argv, envp);
|
||||
ret = main(argc, argv, envp);
|
||||
run_dtors();
|
||||
__run_on_exit(ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
Reference in new issue
Block a user