From 2fc49454e0967364f816a132ad5d0a6747d6cd6d Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Thu, 30 Oct 2003 17:27:36 +0000 Subject: [PATCH] 0.8.5.17: Possibly the least useful fix I shall ever make while working on SBCL: Implement ldso_stub__foo for MIPS/Linux, so that the system can be built to link dynamically, allowing linking of foreign code in ... many thanks to Ralf Baechle for education about the MIPS ABI Now foreign.test.sh passes, and we build and pass tests for all 13 contribs! Woohoo! Is there a user in the house? --- NEWS | 3 +++ src/runtime/Config.mips-linux | 5 ++--- src/runtime/ldso-stubs.S | 27 +++++++++++++++++++++++++++ version.lisp-expr | 2 +- 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index b68f9ab..669b6f4 100644 --- a/NEWS +++ b/NEWS @@ -2173,6 +2173,9 @@ changes in sbcl-0.8.6 relative to sbcl-0.8.5: that the various BOOLE-related constants have the same value in host and target lisps. (noted by Paul Dietz' test suite on an SBCL binary built from CLISP) + * the system can now be dynamically linked on the MIPS platform, + which enables dynamic loading of foreign code from Lisp. (thanks + to Ralf Baechle for discussions on the MIPS ABI) * fixed a compiler bug: MV-LET convertion did not check references to the "max args" entry point. (reported by Brian Downing) * tweaked disassembly notes to be less confident about proclaiming diff --git a/src/runtime/Config.mips-linux b/src/runtime/Config.mips-linux index 6f42f33..fc7b5f7 100644 --- a/src/runtime/Config.mips-linux +++ b/src/runtime/Config.mips-linux @@ -12,11 +12,10 @@ LD = ld LINKFLAGS = -v -g NM = nm -p -ASSEM_SRC = mips-assem.S #hppa-linux-stubs.S -ARCH_SRC = mips-arch.c undefineds.c +ASSEM_SRC = mips-assem.S ldso-stubs.S +ARCH_SRC = mips-arch.c #undefineds.c OS_SRC = linux-os.c mips-linux-os.c os-common.c -LINKFLAGS+=-static OS_LIBS= -ldl GC_SRC= cheneygc.c diff --git a/src/runtime/ldso-stubs.S b/src/runtime/ldso-stubs.S index 64e721e..98f73f1 100644 --- a/src/runtime/ldso-stubs.S +++ b/src/runtime/ldso-stubs.S @@ -99,6 +99,33 @@ ldso_stub__ ## fct: ; \ nop /* delay slot*/ ; \ .L ## fct ## e1: ; \ .size ldso_stub__ ## fct,.L ## fct ## e1-ldso_stub__ ## fct ; + +#elif defined LISP_FEATURE_MIPS + +/* KLUDGE: set up the vital fifth argument, passed on the + stack. Do this unconditionally, even if the stub is for a + function with few arguments: it can't hurt. We only do this for + the fifth argument, as the first four are passed in registers + and we apparently don't ever need to pass six arguments to a + libc function. -- CSR, 2003-10-29 */ + +#define LDSO_STUBIFY(fct) \ +.globl ldso_stub__ ## fct ; \ + .type ldso_stub__ ## fct,@function ; \ +ldso_stub__ ## fct: ; \ + addiu $29,-48 ; \ + sw $28,40($29) ; \ + sw $31,44($29) ; \ + lw $25,64($29) ; \ + sw $25,16($29) ; \ + la $25, fct ; \ + jalr $25 ; \ + lw $31,44($29) ; \ + lw $28,40($29) ; \ + addiu $29,48 ; \ + jr $31 ; \ +.L ## fct ## e1: ; \ + .size ldso_stub__ ## fct,.L ## fct ## e1-ldso_stub__ ## fct ; #else #error unsupported CPU architecture diff --git a/version.lisp-expr b/version.lisp-expr index 3d072a0..8a1ecba 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".) -"0.8.5.16" +"0.8.5.17" -- 1.7.10.4