From 3384d6913338dcacd36468ea621668417cea1ed3 Mon Sep 17 00:00:00 2001 From: pommicket Date: Mon, 3 Jul 2023 15:47:07 -0400 Subject: fix compile errors --- 05/tcc-0.9.27/elf.h | 2 -- 05/tcc-0.9.27/tcc.c | 21 +++++++++++++++++++++ 05/tcc-0.9.27/tcc.h | 3 +++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/05/tcc-0.9.27/elf.h b/05/tcc-0.9.27/elf.h index 6c2faed..6dd4505 100644 --- a/05/tcc-0.9.27/elf.h +++ b/05/tcc-0.9.27/elf.h @@ -20,9 +20,7 @@ #define _ELF_H 1 #ifndef _WIN32 -#ifdef __GNUC__ #include -#endif #else #ifndef __int8_t_defined #define __int8_t_defined diff --git a/05/tcc-0.9.27/tcc.c b/05/tcc-0.9.27/tcc.c index e824f98..bd3f959 100644 --- a/05/tcc-0.9.27/tcc.c +++ b/05/tcc-0.9.27/tcc.c @@ -371,3 +371,24 @@ redo: fclose(ppfp); return ret; } + + + +char **__environ; + +int __libc_start_main( + int (*main)(int, char **, char **), int argc, char **argv, + int (*init)(int, char **, char **), void (*fini)(void), + void (*ldso_fini)(void)) +{ + /* Save the environment if it may be used by libc/application */ + char **envp = argv+argc+1; + if (__environ != (void *)-1) __environ = envp; + + /* Execute constructors (static) linked into the application */ + if (init) init(argc, argv, envp); + + /* Pass control to to application */ + exit(main(argc, argv, envp)); + return 0; +} diff --git a/05/tcc-0.9.27/tcc.h b/05/tcc-0.9.27/tcc.h index 6c3c10c..1a168a4 100644 --- a/05/tcc-0.9.27/tcc.h +++ b/05/tcc-0.9.27/tcc.h @@ -170,6 +170,9 @@ extern long double strtold (const char *__nptr, char **__endptr); # endif #endif +// causes too many problems with musl +#undef TCC_IS_NATIVE + #if defined TCC_IS_NATIVE && !defined CONFIG_TCCBOOT # define CONFIG_TCC_BACKTRACE # if (defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64) \ -- cgit v1.2.3