Bug#690531: Help needed: Porting IRAF to MIPS

2014-05-09 Thread Ole Streicher
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 08.05.2014 16:37, David Kuehling wrote:
 (I did all coding against Ole's test-case tarball and not against
 actual IRAF sources).  Rename sources at your will and/or use 
 links/#include/.include/makefile rules/autoconf code or whatever
 else to make mipsel and mips both use the same code

The tar file is just a qd extraction to put something together for
testing without the need to download the whole 80 MB source code of
IRAF. I will sort back the code into the IRAF source tree (hopefully
with upstream support).

BTW, I tested it yesterday on mips (qemu), and it works fine. Thank
you very much again.

Best regards

Ole

-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJTbHvaAAoJEHEVr9B3ENz3pW0QAMeQ6uPx7Fm0fmLaVaRHutjh
dY9psDShl65YSQyJ3jWX+zo4iH1LOpkwCmzp+VloPLkdZFVIffH9J1k8SAvC6IZN
Ls67jl7yLaemhhVNYQAjdppgeULYN8fFvNwElnEWyZQpRms208bHKzdCElNS/SWk
ezls3ndCIpES9CuYyEP5rmmUNumWiI1dHmINcNUxAXxyD2X1qRgXXkvI3b4dvV9u
PKdqN69n3oM1pXQqIbATwLvj3kdwUX2/TZwZ16oCfiYCE8rchYoL3L1WD5L+FLG0
OJQvROGLuRk07+Ri3syy36qE3nHR5Li27suRLDBlqbbZdW9G7I5xIeMu/2R0YFP7
n6OEHIExeCu6kD2olf5Cte49Lx5M7sZjbgb2hMooAUVvXtvcMGGS85cC/PDI8pcs
jjvz4gcrUhjR3prs0FiU8A1sCjDdl5VYwcVbXrrATUYlDriZSsZ+PsCwVibW/PfH
TxzwOzzUazl8R1Xo9WOe00+UEevDGV9K7bxVxxJj40IK90LXQFNfh6eL4xKD6+nh
ggMFCEZuzehIPLh7T+IZkwENlEOW4qmAVxFX5gXJgyJtR9RrPTuB11rV1CaTKqqZ
W45YKNZMKMLwB4PjfudGVyC8EA1INckQ0wgMb+TC/sWguuBDbEh9xCtVHWcdMFRD
ZWGxz1lfTDd2HfE2Sv+0
=hZ1b
-END PGP SIGNATURE-


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#690531: Help needed: Porting IRAF to MIPS

2014-05-08 Thread Ole Streicher
Hi David,

On 08.05.2014 02:07, David Kuehling wrote:
 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).

Thank you very much for your patch! I will test it on unstable at the
weekend and then use it for the MIPS port. Also, after I collected the
assembler bits for the other missing archs, I will send them upstream.

Best regards

Ole


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#690531: Help needed: Porting IRAF to MIPS

2014-05-08 Thread Ole Streicher
I will test it on both and have a symbolic link in the package for mips.

The package is also probably not released as Debian package (except
there is a demand to have this available for other programs than IRAF),
but as part of IRAF.

Best

Ole

On 08.05.2014 11:31, Thomas Bogendoerfer wrote:
 On Thu, May 08, 2014 at 02:07:45AM +0200, David Kuehling wrote:
 Index: zsvjmp/zsvjmp-mipsel.s
 
 why only mipsel ? The code should look the same for big endian MIPS...
 
 Thomas.
 


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#690531: Help needed: Porting IRAF to MIPS

2014-05-08 Thread Thomas Bogendoerfer
On Thu, May 08, 2014 at 02:07:45AM +0200, David Kuehling wrote:
 Index: zsvjmp/zsvjmp-mipsel.s

why only mipsel ? The code should look the same for big endian MIPS...

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.[ RFC1925, 2.3 ]


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#690531: Help needed: Porting IRAF to MIPS

2014-05-08 Thread David Kuehling
 Thomas == Thomas Bogendoerfer tsbog...@alpha.franken.de writes:

 On Thu, May 08, 2014 at 02:07:45AM +0200, David Kuehling wrote:
 Index: zsvjmp/zsvjmp-mipsel.s

 why only mipsel ? The code should look the same for big endian MIPS...

Because that's the name his test-case Makefile expected :) :

  ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
  zsvjmp.s: zsvjmp-$(ARCH).s
  ln -sf $ $@

(I did all coding against Ole's test-case tarball and not against actual
IRAF sources).  Rename sources at your will and/or use
links/#include/.include/makefile rules/autoconf code or whatever else to
make mipsel and mips both use the same code

David
-- 
GnuPG public key: http://dvdkhlng.users.sourceforge.net/dk2.gpg
Fingerprint: B63B 6AF2 4EEB F033 46F7  7F1D 935E 6F08 E457 205F


pgp0rsgvK7HN4.pgp
Description: PGP signature


Bug#690531: Help needed: Porting IRAF to MIPS

2014-05-07 Thread David Kuehling
 On 05.05.2014 12:16, Ole Streicher wrote:
 since a while, I am working to bring the IRAF package [1] into Debian
 [2]. I'd like to make the package working on as many Debian platforms
 as possible.
 
 The major problem here is that IRAF needs a small piece of assembler
 code that provides a (sort of) setjmp() to their Fortran variant.

Attached you'll find a patch against your zsvjmp.tar.gz test-case that
adds mipsel support.  This seems to work on my debian squeeze mipsel
system, i.e. running 'make test' outputs:

  ./zzdebug
  Status = 0, step = 0
  Calling zdojmp
  Status = 1, step = 1
  All OK
  ./jmptest
   Status = 0 step = 0
   Calling zdojmp
   Status = 1 step = 1
   All OK
  STOP 0

cheers,

David

PS: forget my last comment WRT loading $t9 when jumping to PIC code: the
mipsel linker (or assembler?) automatically adds such stub code for
calls into PIC routines when .abicalls was enabled in the assembler
source.
-- 
GnuPG public key: http://dvdkhlng.users.sourceforge.net/dk2.gpg
Fingerprint: B63B 6AF2 4EEB F033 46F7  7F1D 935E 6F08 E457 205F

Index: zsvjmp/zsvjmp-mipsel.s
===
--- /dev/null	1970-01-01 00:00:00.0 +
+++ zsvjmp/zsvjmp-mipsel.s	2014-05-08 00:18:31.433683675 +0200
@@ -0,0 +1,19 @@
+	.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_
+	.type	zsvjmp_, %function
+
+zsvjmp_:
+	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 opcode fills delay slot
+	j  __sigsetjmp	# jump to sigsetjmp
+	##  note: no delay slot, filled by GAS reordering instructions above


pgp2nf_W6sHxY.pgp
Description: PGP signature


Bug#690531: Help needed: Porting IRAF to MIPS

2014-05-07 Thread David Kuehling
 David == David Kuehling dvdkh...@posteo.de writes:

 Attached you'll find a patch against your zsvjmp.tar.gz test-case that
 adds mipsel support.  This seems to work on my debian squeeze mipsel
 system, i.e. running 'make test' outputs:

correction: I actually tested this on a debian /wheezy/ system.

david


pgpPCZrPSqDkB.pgp
Description: PGP signature


Bug#690531: Help needed: Porting IRAF to MIPS

2014-05-07 Thread David Kuehling
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.0 +
+++ 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.0 +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
 


pgpLSxE7vAwLI.pgp
Description: PGP signature