From 8ea5b58393e20fab50788ef6ca79078681c3ea8d Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 30 Apr 2021 09:51:27 -0600 Subject: [PATCH] cs: add configuration for {Free,Open,Net}BSD on {ARMv6,AArch64,PowerPC} It's not clear how many of these combinations work right now, but they should be close, and the intent is that they're supported. I succcessfully built for FreeBSD on AArch64 and Chez Scheme for NetBSD on PowerPC32. --- racket/src/ChezScheme/README.md | 6 +- racket/src/ChezScheme/c/arm32le.c | 7 ++ racket/src/ChezScheme/c/version.h | 2 + racket/src/ChezScheme/configure | 95 +++++++++++----------------- racket/src/ChezScheme/s/cmacros.ss | 9 +++ racket/src/ChezScheme/s/ppc32nb.def | 5 ++ racket/src/ChezScheme/s/tppc32nb.def | 5 ++ racket/src/ChezScheme/workarea | 19 +++++- racket/src/cs/rumble/system.ss | 33 ++++++++-- 9 files changed, 112 insertions(+), 69 deletions(-) create mode 100644 racket/src/ChezScheme/s/ppc32nb.def create mode 100644 racket/src/ChezScheme/s/tppc32nb.def diff --git a/racket/src/ChezScheme/README.md b/racket/src/ChezScheme/README.md index fac65a93c4..fdcaf245f0 100644 --- a/racket/src/ChezScheme/README.md +++ b/racket/src/ChezScheme/README.md @@ -8,9 +8,9 @@ Supported platforms: * Windows: x86, x86_64 * Mac OS: x86, x86_64, AArch64, PowerPC32 * Linux: x86, x86_64, ARMv6, AArch64, PowerPC32 - * FreeBSD: x86, x86_64 - * OpenBSD: x86, x86_64 - * NetBSD: x86, x86_64 + * FreeBSD: x86, x86_64, ARMv6, AArch64, PowerPC32 + * OpenBSD: x86, x86_64, ARMv6, AArch64, PowerPC32 + * NetBSD: x86, x86_64, ARMv6, AArch64, PowerPC32 * Solaris: x86, x86_64 * Android: ARMv7, AArch64 * iOS: AArch64 diff --git a/racket/src/ChezScheme/c/arm32le.c b/racket/src/ChezScheme/c/arm32le.c index 5acc1efd1c..48023452ef 100644 --- a/racket/src/ChezScheme/c/arm32le.c +++ b/racket/src/ChezScheme/c/arm32le.c @@ -43,6 +43,13 @@ void S_doflush(uptr start, uptr end) { sys_icache_invalidate((void *)start, (char *)end-(char *)start); #else __clear_cache((char *)start, (char *)end); +# if defined(__clang__) && defined(__aarch64__) && !defined(__APPLE__) + /* Seem to need an extra combination of barriers here to make up for + something in Clang's __clear_cache() */ + asm volatile ("dsb ish\n\t" + "isb" + : : : "memory"); +# endif #endif } diff --git a/racket/src/ChezScheme/c/version.h b/racket/src/ChezScheme/c/version.h index 9a906af90b..bf2e7cc5fc 100644 --- a/racket/src/ChezScheme/c/version.h +++ b/racket/src/ChezScheme/c/version.h @@ -35,6 +35,8 @@ #if (machine_type == machine_type_pb) # undef FLUSHCACHE +#else +# undef PORTABLE_BYTECODE_BIGENDIAN #endif /*****************************************/ diff --git a/racket/src/ChezScheme/configure b/racket/src/ChezScheme/configure index c18fffe6ec..55207895fe 100755 --- a/racket/src/ChezScheme/configure +++ b/racket/src/ChezScheme/configure @@ -94,20 +94,7 @@ fi case "${CONFIG_UNAME}" in Linux) - if uname -a | egrep 'i386|i686|amd64|athlon|x86_64' > /dev/null 2>&1 ; then - m32=i3le - m64=a6le - tm32=ti3le - tm64=ta6le - elif uname -a | grep -i power > /dev/null 2>&1 ; then - m32=ppc32le - tm32=tppc32le - elif uname -a | egrep 'armv|aarch64' > /dev/null 2>&1 ; then - m32=arm32le - m64=arm64le - tm32=tarm32le - tm64=tarm64le - fi + unixsuffix=le installprefix=/usr installmansuffix=share/man ;; @@ -120,32 +107,17 @@ case "${CONFIG_UNAME}" in installmansuffix=man ;; FreeBSD) - if uname -a | egrep 'i386|i686|amd64|athlon|x86_64' > /dev/null 2>&1 ; then - m32=i3fb - m64=a6fb - tm32=ti3fb - tm64=ta6fb - fi + unixsuffix=fb installprefix=/usr/local installmansuffix=man ;; OpenBSD) - if uname -a | egrep 'i386|i686|amd64|athlon|x86_64' > /dev/null 2>&1 ; then - m32=i3ob - m64=a6ob - tm32=ti3ob - tm64=ta6ob - fi + unixsuffix=ob installprefix=/usr/local installmansuffix=man ;; NetBSD) - if uname -a | egrep 'i386|i686|amd64|athlon|x86_64' > /dev/null 2>&1 ; then - m32=i3nb - m64=a6nb - tm32=ti3nb - tm64=ta6nb - fi + unixsuffix=nb installprefix=/usr installmansuffix=share/man gzipmanpages=no @@ -190,6 +162,23 @@ case "${CONFIG_UNAME}" in ;; esac +if [ "$unixsuffix" != "" ] ; then + if uname -a | egrep 'i386|i686|amd64|athlon|x86_64' > /dev/null 2>&1 ; then + m32=i3${unixsuffix} + m64=a6${unixsuffix} + tm32=ti3${unixsuffix} + tm64=ta6${unixsuffix} + elif uname -a | egrep 'power|macppc' > /dev/null 2>&1 ; then + m32=ppc32${unixsuffix} + tm32=tppc32${unixsuffix} + elif uname -a | egrep 'armv|aarch64' > /dev/null 2>&1 ; then + m32=arm32${unixsuffix} + m64=arm64${unixsuffix} + tm32=tarm32${unixsuffix} + tm64=tarm64${unixsuffix} + fi +fi + threads="" bits="" @@ -510,36 +499,15 @@ if [ "$cflagsset" = "no" ] ; then a6le) CFLAGS="-m64 -msse2 ${optFlags}" ;; - a6fb|a6nb|a6ob) - CFLAGS="-m64 ${optFlags}" - ;; - a6s2) - CFLAGS="-m64 ${optFlags}" - ;; - a6osx) - CFLAGS="-m64 ${optFlags}" - ;; - arm64osx) - CFLAGS="-arch arm64 ${optFlags}" - ;; a6nt) CFLAGS="${optFlags}" ;; - arm32le|tarm32le|arm64le|tarm64le) - CFLAGS="${optFlags}" + a6*) + CFLAGS="-m64 ${optFlags}" ;; i3le) CFLAGS="-m32 -msse2 ${optFlags}" ;; - i3fb|i3nb|i3ob) - CFLAGS="-m32 ${optFlags}" - ;; - i3s2) - CFLAGS="-m32 ${optFlags}" - ;; - i3osx) - CFLAGS="-m32 ${optFlags}" - ;; i3nt) CFLAGS="${optFlags}" ;; @@ -547,12 +515,21 @@ if [ "$cflagsset" = "no" ] ; then CC=qcc CFLAGS="-m32 -N2048K ${optFlags}" ;; - ppc32le) + i3*) CFLAGS="-m32 ${optFlags}" ;; + arm32*) + CFLAGS="-m32 ${optFlags}" + ;; + arm64osx) + CFLAGS="-arch arm64 ${optFlags}" + ;; ppc32osx) CFLAGS="${optFlags}" ;; + ppc32*) + CFLAGS="-m32 ${optFlags}" + ;; esac fi @@ -699,13 +676,13 @@ case "${flagsmuni}" in i3le) mdldflags="-melf_i386" ;; - ppc32le|arm32le|arm64le) - ;; - a6fb|a6ob|a6nb|i3fb|i3ob) + *le) ;; i3nb) mdldflags="-m elf_i386" ;; + *fb|*ob|*nb) + ;; *osx) ;; a6s2) diff --git a/racket/src/ChezScheme/s/cmacros.ss b/racket/src/ChezScheme/s/cmacros.ss index a486029d6d..45c0409580 100644 --- a/racket/src/ChezScheme/s/cmacros.ss +++ b/racket/src/ChezScheme/s/cmacros.ss @@ -396,6 +396,15 @@ arm64le tarm64le arm64osx tarm64osx ppc32osx tppc32osx + arm32fb tarm32fb + ppc32fb tppc32fb + arm64fb tarm64fb + arm32ob tarm32ob + ppc32ob tppc32ob + arm64ob tarm64ob + arm32nb tarm32nb + ppc32nb tppc32nb + arm64nb tarm64nb ) (include "machine.def") diff --git a/racket/src/ChezScheme/s/ppc32nb.def b/racket/src/ChezScheme/s/ppc32nb.def new file mode 100644 index 0000000000..b0c24e3b6d --- /dev/null +++ b/racket/src/ChezScheme/s/ppc32nb.def @@ -0,0 +1,5 @@ +(define-constant machine-type (constant machine-type-ppc32nb)) +(features iconv expeditor) +(define-constant time-t-bits 64) +(include "ppc32.def") +(include "default.def") diff --git a/racket/src/ChezScheme/s/tppc32nb.def b/racket/src/ChezScheme/s/tppc32nb.def new file mode 100644 index 0000000000..04c3767ad7 --- /dev/null +++ b/racket/src/ChezScheme/s/tppc32nb.def @@ -0,0 +1,5 @@ +(define-constant machine-type (constant machine-type-tppc32nb)) +(features iconv expeditor pthreads) +(define-constant time-t-bits 64) +(include "ppc32.def") +(include "default.def") diff --git a/racket/src/ChezScheme/workarea b/racket/src/ChezScheme/workarea index 24f78e5208..13e21e1db7 100755 --- a/racket/src/ChezScheme/workarea +++ b/racket/src/ChezScheme/workarea @@ -54,7 +54,13 @@ case "$Mhost" in a6osx) ;; a6s2) ;; arm32le) ;; + arm32fb) ;; + arm32ob) ;; + arm32nb) ;; arm64le) ;; + arm64fb) ;; + arm64ob) ;; + arm64nb) ;; arm64osx) ;; i3fb) ;; i3le) ;; @@ -65,7 +71,9 @@ case "$Mhost" in i3qnx) ;; i3s2) ;; ppc32le) ;; - ppc32osx) ;; + ppc32fb) ;; + ppc32ob) ;; + ppc32nb) ;; ppc32osx) ;; arm64osx) ;; ta6fb) ;; @@ -76,7 +84,13 @@ case "$Mhost" in ta6osx) ;; ta6s2) ;; tarm32le) ;; + tarm32fb) ;; + tarm32ob) ;; + tarm32nb) ;; tarm64le) ;; + tarm64fb) ;; + tarm64ob) ;; + tarm64nb) ;; tarm64osx) ;; ti3fb) ;; ti3le) ;; @@ -86,6 +100,9 @@ case "$Mhost" in ti3osx) ;; ti3s2) ;; tppc32le) ;; + tppc32fb) ;; + tppc32ob) ;; + tppc32nb) ;; tppc32osx) ;; tarm64osx) ;; *) echo "Unrecognized machine name $Mhost"; exit 1 ;; diff --git a/racket/src/cs/rumble/system.ss b/racket/src/cs/rumble/system.ss index e614c62e19..6b68b10ee1 100644 --- a/racket/src/cs/rumble/system.ss +++ b/racket/src/cs/rumble/system.ss @@ -38,9 +38,18 @@ arm32le tarm32le arm64le tarm64le ppc32le tppc32le) 'linux] - [(a6ob ta6ob i3ob ti3ob) 'openbsd] - [(a6fb ta6fb i3fb ti3fb) 'freebsd] - [(a6nb ta6nb i3nb ti3nb) 'netbsd] + [(a6fb ta6fb i3fb ti3fb + arm32fb tarm32fb arm64fb tarm64fb + ppc32fb tppc32fb) + 'freebsd] + [(a6ob ta6ob i3ob ti3ob + arm32ob tarm32ob arm64ob tarm64ob + ppc32ob tppc32ob) + 'openbsd] + [(a6nb ta6nb i3nb ti3nb + arm32nb tarm32nb arm64nb tarm64nb + ppc32nb tppc32nb) + 'netbsd] [(a6s2 ta6s2 i3s2 ti3s2) 'solaris] [(i3qnx) 'qnx] [else (error 'system-type "internal error: unknown operating system")])) @@ -64,10 +73,22 @@ i3s2 ti3s2 i3qnx) 'i386] - [(arm32le tarm32le) 'arm] - [(arm64le tarm64le arm64osx tarm64osx) 'aarch64] + [(arm32le tarm32le + arm32fb tarm32fb + arm32ob tarm32ob + arm32nb tarm32nb) + 'arm] + [(arm64le tarm64le + arm64osx tarm64osx + arm64fb tarm64fb + arm64ob tarm64ob + arm64nb tarm64nb) + 'aarch64] [(ppc32le tppc32le - ppc32osx tppc32osx) + ppc32osx tppc32osx + ppc32fb tppc32fb + ppc32ob tppc32ob + ppc32nb tppc32nb) 'ppc] [else (error 'system-type "internal error: unknown architecture")]))