diff options
author | pommicket <pommicket@gmail.com> | 2023-07-03 15:47:07 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-07-03 15:47:07 -0400 |
commit | 3384d6913338dcacd36468ea621668417cea1ed3 (patch) | |
tree | 9b0f7aa3d3229e1c0238057789834bdb0849bba7 | |
parent | fe7a0abd38d61a449c4beaa7a514c2be5df872cf (diff) |
fix compile errors
-rw-r--r-- | 05/tcc-0.9.27/elf.h | 2 | ||||
-rw-r--r-- | 05/tcc-0.9.27/tcc.c | 21 | ||||
-rw-r--r-- | 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 <inttypes.h> -#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) \ |