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
198198
199199 float_abi = s->float_abi;
200200 #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"
202203 #endif
203204 }
204205 #else
@@ -1203,7 +1204,10 @@ again: · 998 unmodified lines
12031204 o(0xE28D0000|(intr(r)<<12)|padding); /* add r, sp, padding */
12041205 vset(&vtop->type, r | VT_LVAL, 0);
12051206 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} */
12061209 vstore(); /* memcpy to current sp + potential padding */
1210+ o(0xECBD0A00|(0&1)<<22|(0>>1)<<12|16); /* vpop {s0-s15} */
12071211
12081212 /* Homogeneous float aggregate are loaded to VFP registers
12091213 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
360360 if test "${triplet%eabihf}" != "$triplet" ; then
361361 confvars="$confvars arm_eabihf arm_vfp"
362362 elif test "${triplet%eabi}" != "$triplet" ; then
363− confvars="$confvars arm_eabi"
364− elif test "$targetos" = "NetBSD"; then
363+ confvars="$confvars arm_eabi arm_vfp"
364+ elif test "${_triplet%eabihf}" != "$_triplet" ; then
365365 confvars="$confvars arm_eabihf arm_vfp"
366+ elif test "${_triplet%eabi}" != "$_triplet" ; then
367+ confvars="$confvars arm_eabi arm_vfp"
366368 fi
367369 if grep -s -q "^Features.* \(vfp\|iwmmxt\) " /proc/cpuinfo ; then
368370 confvars="$confvars arm_vfp"
lib/armeabi.c+36−0
@@ -499,3 +499,39 @@ void __aeabi_uidivmod(unsigned num, unsigned den) · 498 unmodified lines
499499 {
500500 uidiv_t_return(aeabi_uidivmod(num, den));
501501 }
502+
503+/* Some targets do not have all eabi calls (OpenBSD) */
504+typedef __SIZE_TYPE__ size_t;
505+extern void *memcpy(void *dest, const void *src, size_t n);
506+extern void *memmove(void *dest, const void *src, size_t n);
507+extern void *memset(void *s, int c, size_t n);
508+
509+void *
510+__aeabi_memcpy (void *dest, const void *src, size_t n)
511+{
512+ return memcpy (dest, src, n);
513+}
514+
515+void *
516+__aeabi_memmove (void *dest, const void *src, size_t n)
517+{
518+ return memmove (dest, src, n);
519+}
520+
521+void *
522+__aeabi_memmove4 (void *dest, const void *src, size_t n)
523+{
524+ return memmove (dest, src, n);
525+}
526+
527+void *
528+__aeabi_memmove8 (void *dest, const void *src, size_t n)
529+{
530+ return memmove (dest, src, n);
531+}
532+
533+void *
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
665665 rc->fp = uc->uc_mcontext.__gregs[_REG_FP];
666666 #elif defined(__arm__) && defined(__OpenBSD__)
667667 rc->ip = uc->sc_pc;
668− rc->fp = uc->sc_fpreg[29];
668+ rc->fp = uc->sc_r11;
669669 #elif defined(__arm__) && defined(__FreeBSD__)
670670 rc->ip = uc->uc_mcontext.__gregs[_REG_PC];
671671 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