Module Name: src Committed By: riz Date: Fri Jul 16 18:34:08 UTC 2010
Modified Files: src/lib/libc/misc [netbsd-5]: initfini.c src/lib/libc/stdlib [netbsd-5]: exit.c Log Message: Pull up following revision(s) (requested by joerg in ticket #1423): lib/libc/stdlib/exit.c: revision 1.12 lib/libc/misc/initfini.c: revision 1.6 Ensure that initfini.c is referenced by exit.c. The start up code has to reference the latter as a return of main() results in a call to exit(3), so this ensures that the libc constructors are run for statically linked programs. Fixes PR 37454. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.5.6.1 src/lib/libc/misc/initfini.c cvs rdiff -u -r1.11 -r1.11.12.1 src/lib/libc/stdlib/exit.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/misc/initfini.c diff -u src/lib/libc/misc/initfini.c:1.5 src/lib/libc/misc/initfini.c:1.5.6.1 --- src/lib/libc/misc/initfini.c:1.5 Mon Apr 28 20:23:00 2008 +++ src/lib/libc/misc/initfini.c Fri Jul 16 18:34:08 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: initfini.c,v 1.5 2008/04/28 20:23:00 martin Exp $ */ +/* $NetBSD: initfini.c,v 1.5.6.1 2010/07/16 18:34:08 riz Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -30,13 +30,13 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: initfini.c,v 1.5 2008/04/28 20:23:00 martin Exp $"); +__RCSID("$NetBSD: initfini.c,v 1.5.6.1 2010/07/16 18:34:08 riz Exp $"); #ifdef _LIBC #include "namespace.h" #endif -static void __libc_init(void) __attribute__((__constructor__, __used__)); +void __libc_init(void) __attribute__((__constructor__, __used__)); void __guard_setup(void); void __libc_thr_init(void); @@ -44,7 +44,7 @@ void __libc_atexit_init(void); /* LINTED used */ -static void +void __libc_init(void) { Index: src/lib/libc/stdlib/exit.c diff -u src/lib/libc/stdlib/exit.c:1.11 src/lib/libc/stdlib/exit.c:1.11.12.1 --- src/lib/libc/stdlib/exit.c:1.11 Tue Oct 30 17:19:59 2007 +++ src/lib/libc/stdlib/exit.c Fri Jul 16 18:34:08 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: exit.c,v 1.11 2007/10/30 17:19:59 skrll Exp $ */ +/* $NetBSD: exit.c,v 1.11.12.1 2010/07/16 18:34:08 riz Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)exit.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: exit.c,v 1.11 2007/10/30 17:19:59 skrll Exp $"); +__RCSID("$NetBSD: exit.c,v 1.11.12.1 2010/07/16 18:34:08 riz Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -45,14 +45,18 @@ #include "atexit.h" #endif +extern void __libc_init(void); +#ifndef __lint +static void (*force_ref)(void) __used = __libc_init; +#endif + void (*__cleanup) __P((void)); /* * Exit, flushing stdio buffers if necessary. */ void -exit(status) - int status; +exit(int status) { #ifdef _LIBC