OpenBSD: arm fix

Disable warning softfloat. OpenBSD works fine.
save/restore s0-s15 during memcpy call for structs
update configure script. Works now on raspberry pi/All BSD
Add eabi_mem.. functions in armeabi.c for OpenBSD
Fix fp register in tccrun.c for OpenBSD
This commit is contained in:
herman ten brugge 2021-01-17 20:43:15 +01:00
parent debe8d013d
commit 6b614c4deb
4 changed files with 46 additions and 4 deletions

View file

@ -198,7 +198,8 @@ ST_FUNC void arm_init(struct TCCState *s)
float_abi = s->float_abi;
#ifndef TCC_ARM_HARDFLOAT
# warning "soft float ABI currently not supported: default to softfp"
// XXX: Works on OpenBSD
// # warning "soft float ABI currently not supported: default to softfp"
#endif
}
#else
@ -1203,7 +1204,10 @@ again:
o(0xE28D0000|(intr(r)<<12)|padding); /* add r, sp, padding */
vset(&vtop->type, r | VT_LVAL, 0);
vswap();
/* XXX: optimize. Save all register because memcpy can use them */
o(0xED2D0A00|(0&1)<<22|(0>>1)<<12|16); /* vpush {s0-s15} */
vstore(); /* memcpy to current sp + potential padding */
o(0xECBD0A00|(0&1)<<22|(0>>1)<<12|16); /* vpop {s0-s15} */
/* Homogeneous float aggregate are loaded to VFP registers
immediately since there is no way of loading data in multiple

6
configure vendored
View file

@ -360,9 +360,11 @@ if test -z "$cross_prefix" ; then
if test "${triplet%eabihf}" != "$triplet" ; then
confvars="$confvars arm_eabihf arm_vfp"
elif test "${triplet%eabi}" != "$triplet" ; then
confvars="$confvars arm_eabi"
elif test "$targetos" = "NetBSD"; then
confvars="$confvars arm_eabi arm_vfp"
elif test "${_triplet%eabihf}" != "$_triplet" ; then
confvars="$confvars arm_eabihf arm_vfp"
elif test "${_triplet%eabi}" != "$_triplet" ; then
confvars="$confvars arm_eabi arm_vfp"
fi
if grep -s -q "^Features.* \(vfp\|iwmmxt\) " /proc/cpuinfo ; then
confvars="$confvars arm_vfp"

View file

@ -499,3 +499,39 @@ void __aeabi_uidivmod(unsigned num, unsigned den)
{
uidiv_t_return(aeabi_uidivmod(num, den));
}
/* Some targets do not have all eabi calls (OpenBSD) */
typedef __SIZE_TYPE__ size_t;
extern void *memcpy(void *dest, const void *src, size_t n);
extern void *memmove(void *dest, const void *src, size_t n);
extern void *memset(void *s, int c, size_t n);
void *
__aeabi_memcpy (void *dest, const void *src, size_t n)
{
return memcpy (dest, src, n);
}
void *
__aeabi_memmove (void *dest, const void *src, size_t n)
{
return memmove (dest, src, n);
}
void *
__aeabi_memmove4 (void *dest, const void *src, size_t n)
{
return memmove (dest, src, n);
}
void *
__aeabi_memmove8 (void *dest, const void *src, size_t n)
{
return memmove (dest, src, n);
}
void *
__aeabi_memset (void *s, size_t n, int c)
{
return memset (s, c, n);
}

View file

@ -665,7 +665,7 @@ static void rt_getcontext(ucontext_t *uc, rt_context *rc)
rc->fp = uc->uc_mcontext.__gregs[_REG_FP];
#elif defined(__arm__) && defined(__OpenBSD__)
rc->ip = uc->sc_pc;
rc->fp = uc->sc_fpreg[29];
rc->fp = uc->sc_r11;
#elif defined(__arm__) && defined(__FreeBSD__)
rc->ip = uc->uc_mcontext.__gregs[_REG_PC];
rc->fp = uc->uc_mcontext.__gregs[_REG_FP];