initfini.c revision 1.4
11.4Sxtraeme/* 	$NetBSD: initfini.c,v 1.4 2008/02/25 14:06:13 xtraeme Exp $	 */
21.1Sad
31.1Sad/*-
41.1Sad * Copyright (c) 2007 The NetBSD Foundation, Inc.
51.1Sad * All rights reserved.
61.1Sad *
71.1Sad * This code is derived from software contributed to The NetBSD Foundation
81.1Sad * by Andrew Doran.
91.1Sad *
101.1Sad * Redistribution and use in source and binary forms, with or without
111.1Sad * modification, are permitted provided that the following conditions
121.1Sad * are met:
131.1Sad * 1. Redistributions of source code must retain the above copyright
141.1Sad *    notice, this list of conditions and the following disclaimer.
151.1Sad * 2. Redistributions in binary form must reproduce the above copyright
161.1Sad *    notice, this list of conditions and the following disclaimer in the
171.1Sad *    documentation and/or other materials provided with the distribution.
181.1Sad * 3. All advertising materials mentioning features or use of this software
191.1Sad *    must display the following acknowledgement:
201.1Sad *        This product includes software developed by the NetBSD
211.1Sad *        Foundation, Inc. and its contributors.
221.1Sad * 4. Neither the name of The NetBSD Foundation nor the names of its
231.1Sad *    contributors may be used to endorse or promote products derived
241.1Sad *    from this software without specific prior written permission.
251.1Sad *
261.1Sad * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
271.1Sad * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
281.1Sad * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
291.1Sad * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
301.1Sad * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
311.1Sad * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
321.1Sad * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
331.1Sad * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
341.1Sad * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
351.1Sad * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
361.1Sad * POSSIBILITY OF SUCH DAMAGE.
371.1Sad */
381.1Sad
391.2Sad#include <sys/cdefs.h>
401.4Sxtraeme__RCSID("$NetBSD: initfini.c,v 1.4 2008/02/25 14:06:13 xtraeme Exp $");
411.2Sad
421.2Sad#ifdef _LIBC
431.2Sad#include "namespace.h"
441.2Sad#endif
451.2Sad
461.1Sadstatic void	__libc_init(void) __attribute__((__constructor__, __used__));
471.1Sad
481.1Sadvoid	__guard_setup(void);
491.1Sadvoid	__libc_thr_init(void);
501.3Sadvoid	__libc_atomic_init(void);
511.4Sxtraemevoid	__libc_atexit_init(void);
521.1Sad
531.2Sad/* LINTED used */
541.1Sadstatic void
551.1Sad__libc_init(void)
561.1Sad{
571.1Sad
581.1Sad	/* For -fstack-protector */
591.1Sad	__guard_setup();
601.1Sad
611.3Sad	/* Atomic operations */
621.3Sad	__libc_atomic_init();
631.3Sad
641.1Sad	/* Threads */
651.1Sad	__libc_thr_init();
661.4Sxtraeme
671.4Sxtraeme	/* Initialize the atexit mutexes */
681.4Sxtraeme	__libc_atexit_init();
691.1Sad}
70