NetBSD Problem Report #1070

From gnats  Fri May 19 21:10:55 1995
Received: from pain.lcs.mit.edu (pain.lcs.mit.edu [128.52.46.239]) by sun-lamp.cs.berkeley.edu (8.6.10/8.6.10) with ESMTP id VAA24745 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Fri, 19 May 1995 21:10:54 -0700
Message-Id: <199505200411.VAA04297@gandalf.sigmasoft.com>
Date: Fri, 19 May 1995 21:11:39 -0700
From: Thorsten Lockert <tholo@SigmaSoft.COM>
To: gnats-bugs@NetBSD.ORG
Subject: Warnings in i386 startup code
X-Send-Pr-Version: 3.2

>Number:         1070
>Category:       port-i386
>Synopsis:       Warnings in i386 startup code
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gnats-admin (GNATS administrator)
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri May 19 21:20:03 +0000 1995
>Closed-Date:    Fri Jun 02 21:44:28 +0000 1995
>Last-Modified:  
>Originator:     Thorsten Lockert
>Release:        May 7th, 1995
>Organization:
SigmaSoft, Th. Lockert
>Environment:

System: NetBSD gandalf.sigmasoft.com 1.0A NetBSD 1.0A (GANDALF) #1: Sun May 7 21:49:27 PDT 1995 tholo@gandalf.sigmasoft.com:/usr/src/sys/arch/i386/compile/GANDALF i386


>Description:
	There are multiple compile-time warnings in src/lib/csu/i386/crt0.c
	if compiled with -Wall and -Wstrict-prototypes

	Function declarations also do not follow the coding convention
>How-To-Repeat:
	Add "-Wall -Wstrict-prototypes" to CFLAGS in src/lib/csu/Makefile
>Fix:
	Apply the following patch:

--- src/lib/csu/i386/crt0.c.orig	Fri May 19 20:35:09 1995
+++ src/lib/csu/i386/crt0.c	Fri May 19 21:03:22 1995
@@ -35,9 +35,6 @@
 static char sccsid[] = "%W% (Erasmus) %G%";
 #endif /* LIBC_SCCS and not lint */

-extern void exit();
-int _callmain();
-
 #include <sys/param.h>

 #ifdef DYNAMIC
@@ -55,13 +52,19 @@
 #define MAP_COPY	MAP_PRIVATE
 #define MAP_ANON	0
 #endif
+#include <stdlib.h>
 #include <link.h>

+int _callmain __P((void));
+int main __P((int, char **, char **));
+
 extern struct _dynamic _DYNAMIC;
 static struct ld_entry	*ld_entry;
-static void	__do_dynamic_link ();
-static char	*_getenv();
-static int	_strncmp();
+static void	__do_dynamic_link __P((void));
+#ifdef DEBUG
+static char	*_getenv __P((char *));
+static int	_strncmp __P((char *, char *, int));
+#endif

 #ifdef sun
 #define LDSO	"/usr/lib/ld.so"
@@ -72,15 +75,16 @@

 #endif /* DYNAMIC */

-static char		*_strrchr();
+static char		*_strrchr __P((char *, char));
+int			__syscall __P((int, ...));

 char			**environ;

 #ifdef BSD
 extern	unsigned char	etext;
 extern	unsigned char	eprol asm ("eprol");
-extern			start() asm("start");
-extern			mcount() asm ("mcount");
+extern	void		start __P((void)) asm("start");
+extern	void		mcount __P((void)) asm ("mcount");

 int			errno;
 static char		empty[1];
@@ -110,7 +114,7 @@
 	write(2, str, sizeof(str)), \
 	_exit(1);

-
+void
 start()
 {
 	struct kframe {
@@ -125,7 +129,10 @@
 	register struct kframe *kfp;
 	register char **targv;
 	register char **argv;
-	extern void _mcleanup();
+#ifdef MCRT0
+	extern void monstartup __P((u_long, u_long));
+	extern void _mcleanup __P((void));
+#endif
 #ifdef DYNAMIC
 	volatile caddr_t x;
 #endif
@@ -165,7 +172,7 @@

 #ifdef MCRT0
 	atexit(_mcleanup);
-	monstartup(&eprol, &etext);
+	monstartup((u_long)&eprol, (u_long)&etext);
 #endif MCRT0

 asm ("__callmain:");		/* Defined for the benefit of debuggers */
@@ -179,8 +186,7 @@
 	struct crt_ldso	crt;
 	struct exec	hdr;
 	char		*ldso;
-	int		dupzfd;
-	int		(*entry)();
+	int		(*entry) __P((int, struct crt_ldso *));

 #ifdef DEBUG
 	/* Provision for alternate ld.so - security risk! */
@@ -245,7 +251,7 @@
 	crt.crt_bp = (caddr_t)_callmain;
 	crt.crt_prog = __progname;

-	entry = (int (*)())(crt.crt_ba + sizeof hdr);
+	entry = (int (*) __P((int, struct crt_ldso *)))(crt.crt_ba + sizeof hdr);
 	if ((*entry)(CRT_VERSION_BSD_3, &crt) == -1) {
 		_FATAL("ld.so failed\n");
 	}
@@ -305,10 +311,11 @@
  * Support routines
  */

+#ifdef DEBUG
 static int
 _strncmp(s1, s2, n)
 	register char *s1, *s2;
-	register n;
+	register int n;
 {

 	if (n == 0)
@@ -338,6 +345,7 @@
 			}
 	return (char *)0;
 }
+#endif

 	asm("	___syscall:");
 	asm("		popl %ecx");
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: pk 
State-Changed-When: Fri Jun 2 14:44:28 PDT 1995 
State-Changed-Why:  
Protoized as suggested. 
Also transposed to other ports where applicable. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.