ECL doesn't build on OpenBSD with threads enabled

ECL fails to build on OpenBSD when threads are enabled. Tried it on OpenBSD-current but same things happens on 5.6 and 5.7 as well. The build seems to go just fine until it starts to compile the lisp sources. Once it runs the minimal ecl and tries to compile predlib.lsp it gets stuck, top shows no CPU and I got following ktrace output from it.

$ ECLDIR=`pwd`/ ktrace -di ./ecl_min compile                                                            
;*** Lisp core booted ****
ECL (Embeddable Common Lisp)

;;;
;;; Welcome to bare.lsp. Let's bring this instance up!
;;;
;;;
;;; About to load lsp/load.lsp
;;; 
;;; Loading src:lsp;export.lsp
;;; Loading src:lsp;defmacro.lsp
;;; Loading src:lsp;helpfile.lsp
;;; Loading src:lsp;evalmacros.lsp
;;; Loading src:lsp;cmuutil.lsp
;;; Loading src:lsp;setf.lsp
;;; Loading src:lsp;predlib.lsp   <--- stops here

Here's the tail of kdump:

 14998 ecl_min  RET   __thrwakeup 3
 14998 ecl_min  CALL  __thrwakeup(0xcc47ecfe780,0)
 14998 ecl_min  RET   __thrwakeup 3
 14998 ecl_min  CALL  __thrwakeup(0xcc47ecfe780,0)
 14998 ecl_min  RET   __thrwakeup 3
 14998 ecl_min  CALL  sigprocmask(SIG_BLOCK,~0<>)
 14998 ecl_min  RET   sigprocmask 0<>
 14998 ecl_min  CALL  mprotect(0xcc3c7490000,0x2000,0x3<PROT_READ|PROT_WRITE>)
 14998 ecl_min  RET   mprotect 0
 14998 ecl_min  CALL  mprotect(0xcc3c7490000,0x2000,0x1<PROT_READ>)
 14998 ecl_min  RET   mprotect 0
 14998 ecl_min  CALL  sigprocmask(SIG_SETMASK,0<>)
 14998 ecl_min  RET   sigprocmask ~0x10100<SIGKILL|SIGSTOP>
 14998 ecl_min  CALL  sigprocmask(SIG_BLOCK,~0<>)
 14998 ecl_min  RET   sigprocmask 0<>
 14998 ecl_min  CALL  mprotect(0xcc423ea5000,0x1000,0x3<PROT_READ|PROT_WRITE>)
 14998 ecl_min  RET   mprotect 0
 14998 ecl_min  CALL  mprotect(0xcc423ea5000,0x1000,0x1<PROT_READ>)
 14998 ecl_min  RET   mprotect 0
 14998 ecl_min  CALL  sigprocmask(SIG_SETMASK,0<>)
 14998 ecl_min  RET   sigprocmask ~0x10100<SIGKILL|SIGSTOP>
 14998 ecl_min  CALL  kill(1032698,SIGXFSZ)
 14998 ecl_min  RET   kill 0
 14998 ecl_min  CALL  __thrsleep(0xcc3e0285314,CLOCK_REALTIME,0,0xcc3e0285310,0xcc423fa5810)

So seems the process is sleeping for some reason and not waking up. Currently I don't have ideas how to proceed so any ideas would be welcome.

The build was done with following configure options:

CONFIGURE_ARGS +=	--enable-boehm=system \
			--enable-libatomic=system \
			--enable-threads=yes \
			--with-system-gmp \
			--with-gmp-prefix=${LOCALBASE}