Subject: Re: netbsd-4 can't build itself (at least not with -static)
To: NetBSD-current Users's Discussion List <current-users@netbsd.org>
From: Matthias Scheler <tron@zhadum.org.uk>
List: current-users
Date: 02/17/2007 20:10:30
--OXfL5xGRrasGEqWY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Sat, Feb 17, 2007 at 01:33:58AM -0500, Greg A. Woods wrote:
> >   __weak_alias(SHA512_Init,_SHA512_Init) 
> >   __weak_alias(SHA512_Update,_SHA512_Update)
> > + __weak_alias(SHA512_Last,_SHA512_Last)
> >   __weak_alias(SHA512_Final,_SHA512_Final)
> >   __weak_alias(SHA512_Transform,_SHA512_Transform)
> >   #endif
> > 
> >  
> > 
> > But if so it would seem I'll have to rebuild at least the netbsd-4
> > libc.a for this system on a different system....  Hmmm... that's easy
> > enough to try I guess since the netbsd-3 system I did the first build on
> > still has the object tree....
> 
> 
> Indeed the patch above solves the problem.

But it is IMHO not the correct fix. 
 
> Was the missing weak alias just an oversight?

I think the oversigh is that SHA512_Last() is not marked as "static".
Could you please try whether the attached patch fixes your problem?

	Kind regards

-- 
Matthias Scheler                                  http://zhadum.org.uk/

--OXfL5xGRrasGEqWY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="sha2.patch"

Index: common/lib/libc/hash/sha2/sha2.c
===================================================================
RCS file: /cvsroot/src/common/lib/libc/hash/sha2/sha2.c,v
retrieving revision 1.2
diff -u -r1.2 sha2.c
--- common/lib/libc/hash/sha2/sha2.c	1 Nov 2006 11:29:08 -0000	1.2
+++ common/lib/libc/hash/sha2/sha2.c	17 Feb 2007 20:10:22 -0000
@@ -218,7 +218,7 @@
  * library -- they are intended for private internal visibility/use
  * only.
  */
-void SHA512_Last(SHA512_CTX*);
+static void SHA512_Last(SHA512_CTX*);
 void SHA256_Transform(SHA256_CTX*, const sha2_word32*);
 void SHA384_Transform(SHA384_CTX*, const sha2_word64*);
 void SHA512_Transform(SHA512_CTX*, const sha2_word64*);
@@ -866,7 +866,7 @@
 	usedspace = freespace = 0;
 }
 
-void SHA512_Last(SHA512_CTX* context) {
+static void SHA512_Last(SHA512_CTX* context) {
 	unsigned int	usedspace;
 
 	usedspace = (unsigned int)((context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH);

--OXfL5xGRrasGEqWY--