From: Alastair Bridgewater Date: Sun, 23 May 2010 18:23:59 +0000 (+0000) Subject: 1.0.38.10: Support for building on OpenBSD/PPC (patch by Josh Elsasser). X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=8694b0dfc9f55890eaff390453896b5f9c64e319;p=sbcl.git 1.0.38.10: Support for building on OpenBSD/PPC (patch by Josh Elsasser). * Dynamic space assignments. * New Config.* makefile fragment. * OpenBSD-specific support in ppc-arch.c and ppc-bsd-os.c * Fixed test suite issues relating to OpenBSD/PPC. This was that the foreign stack alignment needed setting and that OpenBSD, unlike other PowerPC targets, requires -fPIC in CFLAGS when building shared objects. * It turns out that os_context_sp_addr() in ppc-bsd-os.c is only used when ARCH_HAS_STACK_POINTER is set, which only occurs on x86oid systems at the present time. --- diff --git a/NEWS b/NEWS index 0133518..6a5344e 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,8 @@ changes relative to sbcl-1.9.38: this could lead to wrong results in mixed real/complex float arithmetic. * bug fix: Fix function/macro redefinition warnings when building with clisp. (lp#576787, thanks to Josh Elsasser) + * new platform: experimental support for ppc/openbsd (thanks to Josh + Elsasser). changes in sbcl-1.0.38 relative to sbcl-1.0.37: * incompatible change: Thread names are now restricted to SIMPLE-STRINGs diff --git a/src/compiler/ppc/parms.lisp b/src/compiler/ppc/parms.lisp index 1e443b4..f03c325 100644 --- a/src/compiler/ppc/parms.lisp +++ b/src/compiler/ppc/parms.lisp @@ -137,6 +137,26 @@ (def!constant dynamic-1-space-start #x67000000) (def!constant dynamic-1-space-end #x7efff000))) +;;; Text and data segments start at #x01800000. Range for randomized +;;; malloc() starts #x20000000 (MAXDSIZ) after end of data seg and +;;; extends 256 MB. Use 512 - 64 MB for dynamic space so we can run +;;; under default resource limits. +;;; FIXME: MAXDSIZ is a kernel parameter, and can vary as high as 1GB. +;;; These parameters should probably be tested under such a configuration, +;;; as rare as it might or might not be. +#!+openbsd +(progn + #!+gencgc + (progn + (def!constant dynamic-space-start #x4f000000) + (def!constant dynamic-space-end #x6afff000)) + #!-gencgc + (progn + (def!constant dynamic-0-space-start #x4f000000) + (def!constant dynamic-0-space-end #x5cfff000) + (def!constant dynamic-1-space-start #x5f000000) + (def!constant dynamic-1-space-end #x6cfff000))) + #!+darwin (progn #!+gencgc diff --git a/src/runtime/Config.ppc-openbsd b/src/runtime/Config.ppc-openbsd new file mode 100644 index 0000000..1f100f3 --- /dev/null +++ b/src/runtime/Config.ppc-openbsd @@ -0,0 +1,29 @@ +# -*- makefile -*- for the C-level run-time support for SBCL + +# This software is part of the SBCL system. See the README file for +# more information. +# +# This software is derived from the CMU CL system, which was +# written at Carnegie Mellon University and released into the +# public domain. The software is in the public domain and is +# provided with absolutely no warranty. See the COPYING and CREDITS +# files for more information. + +# XXX why do all the other Configs set LINKFLAGS instead of LDFLAGS? +# LINKFLAGS is only used in src/runtime/GNUmakefile, this causes the +# dladdr test in tools-for-build/ to fail. + +LINKFLAGS += -export-dynamic +LDFLAGS += -export-dynamic + +ASSEM_SRC = ppc-assem.S ldso-stubs.S +ARCH_SRC = ppc-arch.c + +OS_SRC = bsd-os.c ppc-bsd-os.c +OS_LIBS = -lutil + +GC_SRC = gencgc.c + +# Nothing to do for after-grovel-headers. +.PHONY: after-grovel-headers +after-grovel-headers: diff --git a/src/runtime/ppc-arch.c b/src/runtime/ppc-arch.c index 92516e5..7fb7b6c 100644 --- a/src/runtime/ppc-arch.c +++ b/src/runtime/ppc-arch.c @@ -59,7 +59,7 @@ arch_get_bad_addr(int sig, siginfo_t *code, os_context_t *context) { os_vm_address_t addr; -#if defined(LISP_FEATURE_NETBSD) +#if defined(LISP_FEATURE_NETBSD) || defined(LISP_FEATURE_OPENBSD) addr = (os_vm_address_t) (code->si_addr); #else addr = (os_vm_address_t) (*os_context_register_addr(context,PT_DAR)); diff --git a/src/runtime/ppc-bsd-os.c b/src/runtime/ppc-bsd-os.c index e77590c..a9f0ce5 100644 --- a/src/runtime/ppc-bsd-os.c +++ b/src/runtime/ppc-bsd-os.c @@ -8,26 +8,42 @@ int * os_context_register_addr(os_context_t *context, int offset) { +#if defined(LISP_FEATURE_NETBSD) return &context->uc_mcontext.__gregs[offset]; +#elif defined(LISP_FEATURE_OPENBSD) + return &context->sc_frame.fixreg[offset]; +#endif } +#if defined(ARCH_HAS_STACK_POINTER) /* It's not defined on PPC. */ int * os_context_sp_addr(os_context_t *context) { +#if defined(LISP_FEATURE_NETBSD) return &(_UC_MACHINE_SP(context)); +#endif } +#endif int * os_context_pc_addr(os_context_t *context) { +#if defined(LISP_FEATURE_NETBSD) return &(_UC_MACHINE_PC(context)); +#elif defined(LISP_FEATURE_OPENBSD) + return &context->sc_frame.srr0; +#endif } int * os_context_lr_addr(os_context_t *context) { +#if defined(LISP_FEATURE_NETBSD) return &context->uc_mcontext.__gregs[_REG_LR]; +#elif defined(LISP_FEATURE_OPENBSD) + return &context->sc_frame.lr; +#endif } /* FIXME: If this can be a no-op on BSD/x86, then it diff --git a/tests/foreign-stack-alignment.impure.lisp b/tests/foreign-stack-alignment.impure.lisp index 4bc683c..4ca957d 100644 --- a/tests/foreign-stack-alignment.impure.lisp +++ b/tests/foreign-stack-alignment.impure.lisp @@ -32,12 +32,12 @@ (defvar *required-alignment* #+(and ppc darwin) 16 - #+(and ppc linux) 8 + #+(and ppc (not darwin)) 8 #+x86-64 16 #+mips 8 #+(and x86 (not darwin)) 4 #+(and x86 darwin) 16 - #-(or x86 x86-64 mips (and ppc (or darwin linux))) (error "Unknown platform")) + #-(or x86 x86-64 mips ppc) (error "Unknown platform")) ;;;; Build the offset-tool as regular excutable, and run it with ;;;; fork/exec, so that no lisp is on the stack. This is our known-good diff --git a/tests/foreign.test.sh b/tests/foreign.test.sh index c9989bc..2c5d0d3 100644 --- a/tests/foreign.test.sh +++ b/tests/foreign.test.sh @@ -36,14 +36,23 @@ build_so() ( CFLAGS="$CFLAGS -fPIC" ;; esac - if [ "`uname`" = Darwin ]; then - SO_FLAGS="-bundle" - if run_sbcl --eval '(sb-ext:quit :unix-status #+x86-64 0 #-x86-64 1)'; then - CFLAGS="$CFLAGS -arch x86_64" - fi - else - SO_FLAGS="-shared" - fi + case "`uname`" in + Darwin) + SO_FLAGS="-bundle" + if run_sbcl --eval '(sb-ext:quit :unix-status #+x86-64 0 #-x86-64 1)'; then + CFLAGS="$CFLAGS -arch x86_64" + fi + ;; + OpenBSD) + SO_FLAGS="-shared" + if [ "`machine -a`" = "powerpc" ]; then + CFLAGS="$CFLAGS -fPIC" + fi + ;; + *) + SO_FLAGS="-shared" + ;; + esac cc -c $1.c -o $1.o $CFLAGS ld $SO_FLAGS -o $1.so $1.o ) diff --git a/version.lisp-expr b/version.lisp-expr index c92916e..1b7b1eb 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.38.9" +"1.0.38.10"