From: Nikodemus Siivola Date: Tue, 31 Aug 2010 13:04:54 +0000 (+0000) Subject: 1.0.42.8: fix build on OpenBSD/i386 -current and upcoming 4.8 release X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=ddff81699041badddbf6dc6f31b4c9eec8cb5f44;p=sbcl.git 1.0.42.8: fix build on OpenBSD/i386 -current and upcoming 4.8 release * Patch by Josh Elsasser, lp#615489. * On OpenBSD/i386, the structure that stores the FPU state during signals was recently moved. Add a script to tools-for-build/ which is run from make-config.sh to detect where the FPU state is located, and create a src/runtime/openbsd-sigcontext.h header containing a #define which src/runtime/x86-bsd-os.c can use. This is necessary to build SBCL on recent -current snapshots of OpenBSD, and for the upcoming 4.8 release. * Missing NEWS entry for last commit. --- diff --git a/NEWS b/NEWS index 64ca237..ed85faa 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,10 @@ changes relative to sbcl-1.0.42 correctly. (lp#598374, thanks to Stas Boukarev) * bug fix: better availability of names of foreign functions in backtraces on Linux. (lp#626962, thanks to Stas Boukarev) + * bug fix: scripting fixes for Solaris and FreeBSD. (lp#615497, thanks to + Josh Elsasser) + * bug fix: build fixes for OpenBSD -current and 4.8 (lp#615489, thanks to + Josh Elsasser) changes in sbcl-1.0.42 relative to sbcl-1.0.41 * build changes diff --git a/make-config.sh b/make-config.sh index c05acab..fcdd9f9 100644 --- a/make-config.sh +++ b/make-config.sh @@ -310,6 +310,10 @@ if [ "$sbcl_arch" = "x86" ]; then # roughly-equivalent magic nevertheless. printf ' :os-provides-dlopen' >> $ltf fi + if [ "$sbcl_os" = "openbsd" ]; then + rm -f src/runtime/openbsd-sigcontext.h + sh tools-for-build/openbsd-sigcontext.sh > src/runtime/openbsd-sigcontext.h + fi elif [ "$sbcl_arch" = "x86-64" ]; then printf ' :gencgc :stack-grows-downward-not-upward :c-stack-is-control-stack :linkage-table' >> $ltf printf ' :compare-and-swap-vops :unwind-to-frame-and-call-vop :raw-instance-init-vops' >> $ltf diff --git a/src/runtime/x86-bsd-os.c b/src/runtime/x86-bsd-os.c index d071666..1054659 100644 --- a/src/runtime/x86-bsd-os.c +++ b/src/runtime/x86-bsd-os.c @@ -20,9 +20,12 @@ #endif #if defined(LISP_FEATURE_OPENBSD) -#include #include #include +#include "openbsd-sigcontext.h" +#ifdef OS_OPENBSD_FPSTATE_IN_SIGFRAME +# include +#endif #endif /* KLUDGE: There is strong family resemblance in the signal context @@ -248,11 +251,14 @@ os_restore_fp_control(os_context_t *context) void os_restore_fp_control(os_context_t *context) { - struct sigframe *frame; - union savefpu *fpu; +#ifdef OS_OPENBSD_FPSTATE_IN_SIGFRAME + struct sigframe *frame = (struct sigframe *)((char*)context - + offsetof(struct sigframe, sf_sc)); + union savefpu *fpu = frame->sf_fpstate; +#elif defined(OS_OPENBSD_FPSTATE_IN_SIGCONTEXT) + union savefpu *fpu = context->sc_fpstate; +#endif - frame = (struct sigframe *)((char*)context - offsetof(struct sigframe, sf_sc)); - fpu = frame->sf_fpstate; if (openbsd_use_fxsave) __asm__ __volatile__ ("fldcw %0" : : "m" (fpu->sv_xmm.sv_env.en_cw)); else diff --git a/tools-for-build/openbsd-sigcontext.sh b/tools-for-build/openbsd-sigcontext.sh new file mode 100644 index 0000000..4281bef --- /dev/null +++ b/tools-for-build/openbsd-sigcontext.sh @@ -0,0 +1,41 @@ +cd ./tools-for-build + +base=openbsd-sigcontext + +# check for sf_fpstate in struct sigframe (ie: pre July 2010) +rm -f "${base}.c" +cat > "${base}.c" < +#include +#include +int +main() +{ + printf("it works: %d\n", offsetof(struct sigframe, sf_fpstate)); + return (0); +} +EOF +if $GNUMAKE "${base}" > /dev/null 2>&1 && "./${base}" > /dev/null 2>&1 +then + echo '#define OS_OPENBSD_FPSTATE_IN_SIGFRAME' +fi + +# check for sc_fpstate in struct sigcontext (ie: July 2010 and later) +rm -f "${base}.c" +cat > "${base}.c" < +#include +#include +int +main() +{ + printf("it works: %d\n", offsetof(struct sigcontext, sc_fpstate)); + return (0); +} +EOF +if $GNUMAKE "${base}" > /dev/null 2>&1 && "./${base}" > /dev/null 2>&1 +then + echo '#define OS_OPENBSD_FPSTATE_IN_SIGCONTEXT' +fi + +rm -f "${base}.c" "${base}" diff --git a/version.lisp-expr b/version.lisp-expr index 922b464..b9a66dd 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.42.7" +"1.0.42.8"