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.
This commit is contained in:
parent
559464716e
commit
e883e926df
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: initfini.c,v 1.5 2008/04/28 20:23:00 martin Exp $ */
|
||||
/* $NetBSD: initfini.c,v 1.6 2010/06/28 21:58:02 joerg 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.6 2010/06/28 21:58:02 joerg 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_atomic_init(void);
|
|||
void __libc_atexit_init(void);
|
||||
|
||||
/* LINTED used */
|
||||
static void
|
||||
void
|
||||
__libc_init(void)
|
||||
{
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: exit.c,v 1.11 2007/10/30 17:19:59 skrll Exp $ */
|
||||
/* $NetBSD: exit.c,v 1.12 2010/06/28 21:58:02 joerg 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.12 2010/06/28 21:58:02 joerg Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
|
@ -45,14 +45,18 @@ __RCSID("$NetBSD: exit.c,v 1.11 2007/10/30 17:19:59 skrll Exp $");
|
|||
#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
|
||||
|
|
Loading…
Reference in New Issue