|
|
af8bc7 |
To: bug-pth@gnu.org
|
|
|
af8bc7 |
Subject: [PATCH] fix pth for makecontext-less glibc on Linux 3.x kernels
|
|
|
af8bc7 |
Cc: pth-users@gnu.org
|
|
|
af8bc7 |
|
|
|
af8bc7 |
Attempting to build pth-2.0.7 on arm-linux-gnueabi, running a 3.x
|
|
|
af8bc7 |
kernel, and with a glibc that doesn't yet have makecontext et al
|
|
|
af8bc7 |
(glibc-2.14.1 in my case) results in the following during configure:
|
|
|
af8bc7 |
|
|
|
af8bc7 |
Machine Context Implementation:
|
|
|
af8bc7 |
checking for ucontext.h... yes
|
|
|
af8bc7 |
checking for makecontext... no
|
|
|
af8bc7 |
checking for swapcontext... no
|
|
|
af8bc7 |
checking for getcontext... no
|
|
|
af8bc7 |
checking for setcontext... no
|
|
|
af8bc7 |
checking for usable SVR4/SUSv2 makecontext(2)/swapcontext(2)... no
|
|
|
af8bc7 |
checking for signal.h... (cached) yes
|
|
|
af8bc7 |
checking for sigsetjmp... no
|
|
|
af8bc7 |
checking for siglongjmp... yes
|
|
|
af8bc7 |
checking for setjmp... yes
|
|
|
af8bc7 |
checking for longjmp... yes
|
|
|
af8bc7 |
checking for _setjmp... yes
|
|
|
af8bc7 |
checking for _longjmp... yes
|
|
|
af8bc7 |
checking for sigaltstack... yes
|
|
|
af8bc7 |
checking for sigstack... yes
|
|
|
af8bc7 |
checking for signal-mask aware setjmp(3)/longjmp(3)... yes: sjljlx
|
|
|
af8bc7 |
checking for typedef stack_t... (cached) yes
|
|
|
af8bc7 |
checking for direction of stack growth... down
|
|
|
af8bc7 |
checking for makecontext... (cached) no
|
|
|
af8bc7 |
checking for stack setup via makecontext... N.A.
|
|
|
af8bc7 |
checking for sigaltstack... (cached) yes
|
|
|
af8bc7 |
checking for typedef stack_t... (cached) yes
|
|
|
af8bc7 |
checking for stack setup via sigaltstack... ok
|
|
|
af8bc7 |
checking for sigstack... (cached) yes
|
|
|
af8bc7 |
checking for stack setup via sigstack... guessed
|
|
|
af8bc7 |
decision on mctx implementation... sjlj/sjljlx/none
|
|
|
af8bc7 |
|
|
|
af8bc7 |
Note the "sjljlx", that's bogus since sjljlx is a fallback for
|
|
|
af8bc7 |
truly ancient systems; the correct choice is ssjlj.
|
|
|
af8bc7 |
|
|
|
af8bc7 |
Configure succeeds, but 'make' then results in:
|
|
|
af8bc7 |
|
|
|
af8bc7 |
./shtool scpp -o pth_p.h -t pth_p.h.in -Dcpp -Cintern -M '==#==' pth_compat.c pth_debug.c pth_syscall.c pth_errno.c pth_ring.c pth_mctx.c pth_uctx.c pth_clean.c pth_time.c pth_tcb.c pth_util.c pth_pqueue.c pth_event.c pth_sched.c pth_data.c pth_msg.c pth_cancel.c pth_sync.c pth_attr.c pth_lib.c pth_fork.c pth_high.c pth_ext.c pth_string.c pthread.c
|
|
|
af8bc7 |
./libtool --mode=compile --quiet gcc -c -I. -O2 -pipe pth_debug.c
|
|
|
af8bc7 |
./libtool --mode=compile --quiet gcc -c -I. -O2 -pipe pth_ring.c
|
|
|
af8bc7 |
./libtool --mode=compile --quiet gcc -c -I. -O2 -pipe pth_pqueue.c
|
|
|
af8bc7 |
./libtool --mode=compile --quiet gcc -c -I. -O2 -pipe pth_time.c
|
|
|
af8bc7 |
./libtool --mode=compile --quiet gcc -c -I. -O2 -pipe pth_errno.c
|
|
|
af8bc7 |
./libtool --mode=compile --quiet gcc -c -I. -O2 -pipe pth_mctx.c
|
|
|
af8bc7 |
pth_mctx.c: In function '__pth_mctx_set':
|
|
|
af8bc7 |
pth_mctx.c:480:2: error: #error "Unsupported Linux (g)libc version and/or platform"
|
|
|
af8bc7 |
make: *** [pth_mctx.lo] Error 1
|
|
|
af8bc7 |
|
|
|
af8bc7 |
This happens because there's a Linux kernel version check that
|
|
|
af8bc7 |
unfortunately only recognises 2.x versions, so it classifies a
|
|
|
af8bc7 |
3.x kernel as "braindead", which selects sjljlx and causes the
|
|
|
af8bc7 |
breakage.
|
|
|
af8bc7 |
|
|
|
af8bc7 |
The fix is to expand the kernel version regexp in aclocal.m4 to
|
|
|
af8bc7 |
also accept 3.x kernels; with that fix configure says:
|
|
|
af8bc7 |
|
|
|
af8bc7 |
checking for signal-mask aware setjmp(3)/longjmp(3)... yes: ssjlj
|
|
|
af8bc7 |
checking for typedef stack_t... (cached) yes
|
|
|
af8bc7 |
checking for direction of stack growth... down
|
|
|
af8bc7 |
checking for makecontext... (cached) no
|
|
|
af8bc7 |
checking for stack setup via makecontext... N.A.
|
|
|
af8bc7 |
checking for sigaltstack... (cached) yes
|
|
|
af8bc7 |
checking for typedef stack_t... (cached) yes
|
|
|
af8bc7 |
checking for stack setup via sigaltstack... ok
|
|
|
af8bc7 |
checking for sigstack... (cached) yes
|
|
|
af8bc7 |
checking for stack setup via sigstack... guessed
|
|
|
af8bc7 |
decision on mctx implementation... sjlj/ssjlj/sas
|
|
|
af8bc7 |
|
|
|
af8bc7 |
Both 'make' and 'make test' then succeed.
|
|
|
af8bc7 |
|
|
|
af8bc7 |
m68k-linux' glibc also lacks makecontext() et al, so it too is sensitive
|
|
|
af8bc7 |
to the kernel version check. For m68k there is some specific support
|
|
|
af8bc7 |
in the sjljlx fallback code which appears to work, but with the fix
|
|
|
af8bc7 |
m68k too gets to use sjlj/ssjlj/sas (which works fine btw).
|
|
|
af8bc7 |
|
|
|
af8bc7 |
Signed-off-by: Mikael Pettersson <mikpe@it.uu.se>
|
|
|
af8bc7 |
---
|
|
|
af8bc7 |
--- pth-2.0.7/aclocal.m4.~1~ 2006-06-08 19:54:01.000000000 +0200
|
|
|
af8bc7 |
+++ pth-2.0.7/aclocal.m4 2012-05-30 18:44:42.000000000 +0200
|
|
|
af8bc7 |
@@ -1074,7 +1074,7 @@ case $PLATFORM in
|
|
|
af8bc7 |
braindead=no
|
|
|
af8bc7 |
case "x`uname -r`" in
|
|
|
af8bc7 |
changequote(, )dnl
|
|
|
af8bc7 |
- x2.[23456789]* ) ;;
|
|
|
af8bc7 |
+ x2.[23456789]* | x3.[0-9]* ) ;;
|
|
|
af8bc7 |
changequote([, ])
|
|
|
af8bc7 |
* ) braindead=yes ;;
|
|
|
af8bc7 |
esac
|
|
|
af8bc7 |
--- pth-2.0.7/configure.~1~ 2006-06-08 20:14:48.000000000 +0200
|
|
|
af8bc7 |
+++ pth-2.0.7/configure 2012-05-30 18:45:03.000000000 +0200
|
|
|
af8bc7 |
@@ -22512,7 +22512,7 @@ case $PLATFORM in
|
|
|
af8bc7 |
*-*-linux* )
|
|
|
af8bc7 |
braindead=no
|
|
|
af8bc7 |
case "x`uname -r`" in
|
|
|
af8bc7 |
- x2.[23456789]* ) ;;
|
|
|
af8bc7 |
+ x2.[23456789]* | x3.[0-9]* ) ;;
|
|
|
af8bc7 |
|
|
|
af8bc7 |
* ) braindead=yes ;;
|
|
|
af8bc7 |
esac
|