Looks like I lost track of sbcl on i386. These patches allow it to build and pass the test suite in my i386 VM. Anyone with a real i386 interested in giving it a try?
Index: Makefile =================================================================== RCS file: /cvs/ports/lang/sbcl/Makefile,v retrieving revision 1.39 diff -u -u -r1.39 Makefile --- Makefile 23 Feb 2019 18:23:13 -0000 1.39 +++ Makefile 16 Mar 2019 23:50:00 -0000 @@ -2,8 +2,8 @@ # not yet ported to other arches ONLY_FOR_ARCHS = amd64 i386 powerpc -BROKEN-i386 = persistent "Some of the contrib modules did not build successfully or pass their self-tests" USE_WXNEEDED = Yes +REVISION = 0 COMMENT= compiler and runtime system for ANSI Common Lisp Index: patches/patch-src_compiler_generic_genesis_lisp =================================================================== RCS file: patches/patch-src_compiler_generic_genesis_lisp diff -N patches/patch-src_compiler_generic_genesis_lisp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_compiler_generic_genesis_lisp 16 Mar 2019 23:50:00 -0000 @@ -0,0 +1,24 @@ +$OpenBSD$ + +Fix build on i386 when the text segment is more than 2GB from the dynamic space, +such as when linked with lld. + +Index: src/compiler/generic/genesis.lisp +--- src/compiler/generic/genesis.lisp.orig ++++ src/compiler/generic/genesis.lisp +@@ -2118,9 +2118,12 @@ core and return a descriptor to it." + ;; Never record it. (FIXME: this is a problem for relocatable heap) + nil) + (:relative ; (used for arguments to X86 relative CALL instruction) +- (setf (bvref-32 gspace-data gspace-byte-offset) +- (the (signed-byte 32) +- (- addr (+ gspace-base gspace-byte-offset 4)))) ; 4 = size of rel32off ++ (let ((difference (- addr (+ gspace-base gspace-byte-offset 4)))) ; 4 = size of rel32off ++ (setf (bvref-32 gspace-data gspace-byte-offset) ++ (the (signed-byte 32) ++ (if (< difference #x-80000000) ++ (ldb (byte 32 0) difference) ++ difference)))) + ;; Relative fixups are recorded if without the object. + ;; Except that read-only space contains calls to asm routines, + ;; and we don't record those fixups. Index: patches/patch-src_compiler_x86_parms_lisp =================================================================== RCS file: patches/patch-src_compiler_x86_parms_lisp diff -N patches/patch-src_compiler_x86_parms_lisp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_compiler_x86_parms_lisp 16 Mar 2019 23:50:00 -0000 @@ -0,0 +1,17 @@ +$OpenBSD$ + +Move the static spaces to an address which should be available under +both ld.bfd and ld.lld + +Index: src/compiler/x86/parms.lisp +--- src/compiler/x86/parms.lisp.orig ++++ src/compiler/x86/parms.lisp +@@ -204,7 +204,7 @@ + #!+sunos (!gencgc-space-setup #x20000000 :dynamic-space-start #x48000000) + #!+freebsd (!gencgc-space-setup #x01000000 :dynamic-space-start #x58000000) + #!+dragonfly (!gencgc-space-setup #x01000000 :dynamic-space-start #x58000000) +-#!+openbsd (!gencgc-space-setup #x3d000000 :dynamic-space-start #x8d000000) ++#!+openbsd (!gencgc-space-setup #x11000000 :dynamic-space-start #x8d000000) + #!+netbsd (!gencgc-space-setup #x20000000 :dynamic-space-start #x60000000) + #!+darwin (!gencgc-space-setup #x04000000 :dynamic-space-start #x10000000) + Index: patches/patch-tests_run-compiler_sh =================================================================== RCS file: patches/patch-tests_run-compiler_sh diff -N patches/patch-tests_run-compiler_sh --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-tests_run-compiler_sh 16 Mar 2019 23:50:00 -0000 @@ -0,0 +1,15 @@ +$OpenBSD$ + +Tests must be built with -fPIC to pass on i386 + +Index: tests/run-compiler.sh +--- tests/run-compiler.sh.orig ++++ tests/run-compiler.sh +@@ -35,6 +35,7 @@ while [ $# -gt 0 ]; do + Linux-PowerPC) new=-fPIC ;; + NetBSD-PowerPC) new=-fPIC ;; + NetBSD-X86-64) new=-fPIC ;; ++ OpenBSD-X86) new=-fPIC ;; + OpenBSD-PowerPC) new=-fPIC ;; + OpenBSD-X86-64) new=-fPIC ;; + SunOS-SPARC) new=-fPIC ;;
