History

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

herman ten brugge committed 5 years ago

Commit 6b614c41 parent debe8d04 files · +46 −4Browse files

Unified · Split

4 files
  1. arm-gen.c +5 −1
  2. configure +4 −2
  3. lib/armeabi.c +36 −0
  4. tccrun.c +1 −1
arm-gen.c+5−1
@@ -198,7 +198,8 @@ ST_FUNC void arm_init(struct TCCState *s) · 197 unmodified lines
198 198
199 float_abi = s->float_abi;199 float_abi = s->float_abi;
200#ifndef TCC_ARM_HARDFLOAT200#ifndef TCC_ARM_HARDFLOAT
201# warning "soft float ABI currently not supported: default to softfp"201// XXX: Works on OpenBSD
202// # warning "soft float ABI currently not supported: default to softfp"
202#endif203#endif
203}204}
204#else205#else
@@ -1203,7 +1204,10 @@ again: · 998 unmodified lines
1203 o(0xE28D0000|(intr(r)<<12)|padding); /* add r, sp, padding */1204 o(0xE28D0000|(intr(r)<<12)|padding); /* add r, sp, padding */
1204 vset(&vtop->type, r | VT_LVAL, 0);1205 vset(&vtop->type, r | VT_LVAL, 0);
1205 vswap();1206 vswap();
1207 /* XXX: optimize. Save all register because memcpy can use them */
1208 o(0xED2D0A00|(0&1)<<22|(0>>1)<<12|16); /* vpush {s0-s15} */
1206 vstore(); /* memcpy to current sp + potential padding */1209 vstore(); /* memcpy to current sp + potential padding */
1210 o(0xECBD0A00|(0&1)<<22|(0>>1)<<12|16); /* vpop {s0-s15} */
1207 1211
1208 /* Homogeneous float aggregate are loaded to VFP registers1212 /* Homogeneous float aggregate are loaded to VFP registers
1209 immediately since there is no way of loading data in multiple1213 immediately since there is no way of loading data in multiple
configure+4−2
@@ -360,9 +360,11 @@ if test -z "$cross_prefix" ; then · 359 unmodified lines
360 if test "${triplet%eabihf}" != "$triplet" ; then360 if test "${triplet%eabihf}" != "$triplet" ; then
361 confvars="$confvars arm_eabihf arm_vfp"361 confvars="$confvars arm_eabihf arm_vfp"
362 elif test "${triplet%eabi}" != "$triplet" ; then362 elif test "${triplet%eabi}" != "$triplet" ; then
363 confvars="$confvars arm_eabi"363 confvars="$confvars arm_eabi arm_vfp"
364 elif test "$targetos" = "NetBSD"; then364 elif test "${_triplet%eabihf}" != "$_triplet" ; then
365 confvars="$confvars arm_eabihf arm_vfp"365 confvars="$confvars arm_eabihf arm_vfp"
366 elif test "${_triplet%eabi}" != "$_triplet" ; then
367 confvars="$confvars arm_eabi arm_vfp"
366 fi368 fi
367 if grep -s -q "^Features.* \(vfp\|iwmmxt\) " /proc/cpuinfo ; then369 if grep -s -q "^Features.* \(vfp\|iwmmxt\) " /proc/cpuinfo ; then
368 confvars="$confvars arm_vfp"370 confvars="$confvars arm_vfp"
lib/armeabi.c+36−0
@@ -499,3 +499,39 @@ void __aeabi_uidivmod(unsigned num, unsigned den) · 498 unmodified lines
499{499{
500 uidiv_t_return(aeabi_uidivmod(num, den));500 uidiv_t_return(aeabi_uidivmod(num, den));
501}501}
502
503/* Some targets do not have all eabi calls (OpenBSD) */
504typedef __SIZE_TYPE__ size_t;
505extern void *memcpy(void *dest, const void *src, size_t n);
506extern void *memmove(void *dest, const void *src, size_t n);
507extern void *memset(void *s, int c, size_t n);
508
509void *
510__aeabi_memcpy (void *dest, const void *src, size_t n)
511{
512 return memcpy (dest, src, n);
513}
514
515void *
516__aeabi_memmove (void *dest, const void *src, size_t n)
517{
518 return memmove (dest, src, n);
519}
520
521void *
522__aeabi_memmove4 (void *dest, const void *src, size_t n)
523{
524 return memmove (dest, src, n);
525}
526
527void *
528__aeabi_memmove8 (void *dest, const void *src, size_t n)
529{
530 return memmove (dest, src, n);
531}
532
533void *
534__aeabi_memset (void *s, size_t n, int c)
535{
536 return memset (s, c, n);
537}
tccrun.c+1−1
@@ -665,7 +665,7 @@ static void rt_getcontext(ucontext_t *uc, rt_context *rc) · 664 unmodified lines
665 rc->fp = uc->uc_mcontext.__gregs[_REG_FP];665 rc->fp = uc->uc_mcontext.__gregs[_REG_FP];
666#elif defined(__arm__) && defined(__OpenBSD__)666#elif defined(__arm__) && defined(__OpenBSD__)
667 rc->ip = uc->sc_pc;667 rc->ip = uc->sc_pc;
668 rc->fp = uc->sc_fpreg[29];668 rc->fp = uc->sc_r11;
669#elif defined(__arm__) && defined(__FreeBSD__)669#elif defined(__arm__) && defined(__FreeBSD__)
670 rc->ip = uc->uc_mcontext.__gregs[_REG_PC];670 rc->ip = uc->uc_mcontext.__gregs[_REG_PC];
671 rc->fp = uc->uc_mcontext.__gregs[_REG_FP];671 rc->fp = uc->uc_mcontext.__gregs[_REG_FP];

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t