fix compile errors

This commit is contained in:
pommicket 2023-07-03 15:47:07 -04:00
parent fe7a0abd38
commit 3384d69133
3 changed files with 24 additions and 2 deletions

View file

@ -20,9 +20,7 @@
#define _ELF_H 1 #define _ELF_H 1
#ifndef _WIN32 #ifndef _WIN32
#ifdef __GNUC__
#include <inttypes.h> #include <inttypes.h>
#endif
#else #else
#ifndef __int8_t_defined #ifndef __int8_t_defined
#define __int8_t_defined #define __int8_t_defined

View file

@ -371,3 +371,24 @@ redo:
fclose(ppfp); fclose(ppfp);
return ret; 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;
}

View file

@ -170,6 +170,9 @@ extern long double strtold (const char *__nptr, char **__endptr);
# endif # endif
#endif #endif
// causes too many problems with musl
#undef TCC_IS_NATIVE
#if defined TCC_IS_NATIVE && !defined CONFIG_TCCBOOT #if defined TCC_IS_NATIVE && !defined CONFIG_TCCBOOT
# define CONFIG_TCC_BACKTRACE # define CONFIG_TCC_BACKTRACE
# if (defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64) \ # if (defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64) \