The code needs some more changes to be compiled and work as part of a shared library. Note: you need to compile assembly sources via '$(CC) $(CFLAGS) -c' so that options like -fPIC make it to the assembler.
Patch below works with both static and shared libraries. Makefile patched so that shared library test can be built as well (set LIBEXT to either ".a" or ".so" and comment out CFLAGS+=-fPIC accordingly).
Index: zsvjmp/zsvjmp-mipsel.s =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ zsvjmp/zsvjmp-mipsel.s 2014-05-08 02:06:41.733234949 +0200 @@ -0,0 +1,28 @@ + .file "zsvjmp.s" + +# Copyright (c) 2014 David Kuehling <dvdkhlng AT posteo TOD de> +# Distributable under the same license as IRAF +# This file contains the Linux mipsel version of ZSVJMP for Debian. + + .set mips1 + .abicalls + .text + .global zsvjmp_ + .ent zsvjmp_ + .type zsvjmp_, %function + +zsvjmp_: + .set noreorder + .cpload $t9 + .set reorder + sw $a1, 0($a0) # buf[0]=status + sw $zero, 0($a1) # *status=0 + addiu $a0, $a0, 4 # &buf[1] --> 1st arg for sigsetjmp + move $a1, $zero # 2nd arg is zero + + # this call sequence is required when used inside shared library + la $t9, __sigsetjmp + j $t9 + ## note: no delay slot, filled by GAS + + .end zsvjmp_ Index: zsvjmp/Makefile =================================================================== --- zsvjmp.orig/Makefile 2014-05-05 10:50:35.000000000 +0200 +++ zsvjmp/Makefile 2014-05-08 02:02:08.515737053 +0200 @@ -2,16 +2,25 @@ FC=gfortran FFLAGS+=-ff2c +LIBEXT=.so +CFLAGS += -fPIC # uncomment when LIBEXT=.a + +%.o : %.s + $(CC) $(CFLAGS) -o $@ -c $< + libzsvjmp.a: zdojmp.o zsvjmp.o $(AR) cr $@ $^ +libzsvjmp.so: zdojmp.o zsvjmp.o + gcc -shared -fPIC -o $@ $^ + zsvjmp.s: zsvjmp-$(ARCH).s ln -sf $< $@ -jmptest: jmptest.o libzsvjmp.a +jmptest: jmptest.o libzsvjmp$(LIBEXT) $(FC) -o $@ $< -L. -lzsvjmp -zzdebug: zzdebug.o libzsvjmp.a +zzdebug: zzdebug.o libzsvjmp$(LIBEXT) $(CC) -o $@ $< -L. -lzsvjmp test: jmptest zzdebug @@ -19,5 +28,5 @@ ./jmptest clean: - rm -f *.o zsvjmp.s jmptest zzdebug *.a + rm -f *.o zsvjmp.s jmptest zzdebug *.a *.so
pgpGGRQy0XDqR.pgp
Description: PGP signature