OpenBSD: improve partial support for x86_64 - WIP

This commit is contained in:
Christian Jullien 2020-11-27 11:24:19 +01:00
parent cf8d9cf072
commit 4e12c2a6dc
3 changed files with 8 additions and 0 deletions

2
tcc.c
View File

@ -171,6 +171,8 @@ static const char version[] =
" Darwin"
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
" FreeBSD"
#elif defined(__OpenBSD__)
" OpenBSD"
#else
" Linux"
#endif

3
tcc.h
View File

@ -45,6 +45,9 @@
/* XXX: need to define this to use them in non ISOC99 context */
extern float strtof (const char *__nptr, char **__endptr);
extern long double strtold (const char *__nptr, char **__endptr);
# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
extern char **environ;
# endif
#endif
#ifdef _WIN32

View File

@ -648,6 +648,9 @@ static void rt_getcontext(ucontext_t *uc, rt_context *rc)
# elif defined(__NetBSD__)
rc->ip = uc->uc_mcontext.__gregs[_REG_RIP];
rc->fp = uc->uc_mcontext.__gregs[_REG_RBP];
# elif defined(__OpenBSD__)
rc->ip = uc->sc_rip;
rc->fp = uc->sc_rbp;
# else
rc->ip = uc->uc_mcontext.gregs[REG_RIP];
rc->fp = uc->uc_mcontext.gregs[REG_RBP];