Subject: Re: can't build clisp
To: None <port-sparc@netbsd.org>
From: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
List: port-sparc
Date: 03/16/2003 07:47:16
--SLDf9lqlvOQaIe6s
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Tue, Nov 05, 2002 at 16:19:25 +0300, Valeriy E. Ushakov wrote:

> On Wed, Nov 06, 2002 at 00:15:16 +1100, Paul NCC/CS wrote:
> 
> > Thats the spot where it fails yes. Thanks for having a look
> > at it. Have a look in tech-pkg for todays mail. A couple of
> > guys have responded to this with some info. And along the
> > lines of what you said about gcc etc.
> > I have not responded to them yet as I am still mucking about
> > with it also. I have made a couple of hacks to the makefile in
> > avcalls directory.
> > Basically took out the test that fails as I thought uniq may not
> > be working correctly with -u switch. It then went on and compiled
> > alot more , but then promptly core dumped in the next directory
> > that it went to build in.
> 
> I don't remember details (it was about an year ago), but it was
> something related to how arguments of type struct { int i; }; vs. mere
> "int" are passed.  Maybe for a type wider than int, but you get the
> idea.

Ok, I had some time to take a look at this.  I actually worked with
the smaller devel/ffcall package, but ffcall is also distributed as
part of clisp.  Try attached patches, they make ffcall compile and
pass self-tests.

avcall-sparc.S was, apparently, generated with too much optimizations
(note, it is not rebuilt during package compilation), so a "nop" got
reordered and functions that return structs were skipping aactual
instruction instead of the nop.

vacall*.h.in - I don't know what's the history of how sparc gcc
returned structs, but we certainly want to skip the extra word on
return from a function that returns a struct, so I just kludged around
this problem.  I will need to take a further look.

SY, Uwe
-- 
uwe@ptc.spbu.ru                         |       Zu Grunde kommen
http://www.ptc.spbu.ru/~uwe/            |       Ist zu Grunde gehen

--SLDf9lqlvOQaIe6s
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch-xa

--- ./avcall/avcall-sparc.S~	Wed Mar 21 19:19:43 2001
+++ ./avcall/avcall-sparc.S	Sun Mar 16 07:17:41 2003
@@ -83,8 +83,8 @@
 	ld	[%i0+56], %o4
 	call	%g3, 0
 	ld	[%i0+60], %o5
-	mov	%o0, %l2
 	nop
+	mov	%o0, %l2
 	ld	[%i0+12], %g3
 	cmp	%g3, 1
 	be	L11

--SLDf9lqlvOQaIe6s
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch-xb

--- ./vacall/vacall.h.in~	Sun Apr  1 06:33:26 2001
+++ ./vacall/vacall.h.in	Sun Mar 16 07:19:46 2003
@@ -185,7 +185,7 @@
    */
 #ifndef __VA_STRUCT_RETURN
   __VA_STRUCT_RETURN		=
-#if defined(__sparc__) && !defined(__sparc64__) && defined(sun) && defined(__SUNPRO_C) /* SUNWspro cc */
+#if defined(__sparc__) && !defined(__sparc64__) && ((defined(sun) && defined(__SUNPRO_C) /* SUNWspro cc */) || defined(__NetBSD__))
 				  __VA_SUNPROCC_STRUCT_RETURN,
 #else
 #if defined(__PCC_STRUCT_RETURN__) /* defined through configure, see above */

--SLDf9lqlvOQaIe6s
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch-xc

--- ./callback/vacall_r/vacall_r.h.in~	Sun Apr  1 06:33:23 2001
+++ ./callback/vacall_r/vacall_r.h.in	Sun Mar 16 07:19:24 2003
@@ -185,7 +185,7 @@
    */
 #ifndef __VA_STRUCT_RETURN
   __VA_STRUCT_RETURN		=
-#if defined(__sparc__) && !defined(__sparc64__) && defined(sun) && defined(__SUNPRO_C) /* SUNWspro cc */
+#if defined(__sparc__) && !defined(__sparc64__) && ((defined(sun) && defined(__SUNPRO_C) /* SUNWspro cc */) || defined(__NetBSD__))
 				  __VA_SUNPROCC_STRUCT_RETURN,
 #else
 #if defined(__PCC_STRUCT_RETURN__) /* defined through configure, see above */

--SLDf9lqlvOQaIe6s--