[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Help needed: small piece of assembler code for IRAF



Hi Ole,

Ole Streicher <olebole@debian.org> writes:
> I created a small repository [4] that contains the assembler I
> collected so far as well as two test programs.

The code you've written looks OK -- the only problem is that in
glibc, sigsetjmp is a macro which calls the real function __sigsetjmp:
https://sourceware.org/git/?p=glibc.git;a=blob;f=setjmp/setjmp.h;hb=HEAD#l72

So you need "jra __sigsetjmp" (as you've done on other architectures),
rather than "jra sigsetjmp". With that change, your tests work on an
emulated m68k machine:

$ git diff
diff --git a/zsvjmp-m68k.s b/zsvjmp-m68k.s
index 3b12e5d..43ca08c 100644
--- a/zsvjmp-m68k.s
+++ b/zsvjmp-m68k.s
@@ -12,7 +12,7 @@ zsvjmp_:
 	move.l %a1,(%a0)+
 	clr.l 8(%sp)
 	move.l %a0,4(%sp)
-	jra sigsetjmp
+	jra __sigsetjmp
 
 	.size	zsvjmp_, .-zsvjmp_
 	.section	.note.GNU-stack,"",@progbits

$ make ARCH=m68k test
gfortran -ff2c -g  -c -o jmptest.o jmptest.f
gcc -g    -c -o zdojmp.o zdojmp.c
as   -o zsvjmp-m68k.o zsvjmp-m68k.s
ar cr libzsvjmp.a zdojmp.o zsvjmp-m68k.o
gfortran -o jmptest jmptest.o -L. -lzsvjmp
gcc -g    -c -o zzdebug.o zzdebug.c
gcc -g -g -o zzdebug zzdebug.o -L. -lzsvjmp
./zzdebug
Status = 0, step = 0
Calling zdojmp
Status = 1, step = 1
All OK
./jmptest
 Status =                     0 step =                     0
 Calling zdojmp
 Status =            4294967296 step =                     1
 All OK
STOP 0

Thanks,

-- 
Adam Sampson <ats@offog.org>                         <http://offog.org/>


Reply to: