diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2001-02-03 22:48:38 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2001-02-03 22:48:38 +0000 |
commit | 4e8bab69b08a9af9676dc954905413933c8f7a12 (patch) | |
tree | 4fcfc8ed315add52b6ccebe510c99fe68c8ae7f8 /lib/csu | |
parent | 04e24e88ff981876d5cfb16cc55f928789beefbc (diff) |
Use crtbegin and crtend from common_elf.
Diffstat (limited to 'lib/csu')
-rw-r--r-- | lib/csu/alpha/Makefile | 8 | ||||
-rw-r--r-- | lib/csu/alpha/crtbegin.c | 112 | ||||
-rw-r--r-- | lib/csu/alpha/crtend.c | 13 |
3 files changed, 4 insertions, 129 deletions
diff --git a/lib/csu/alpha/Makefile b/lib/csu/alpha/Makefile index 657d157fc21..c6b90996014 100644 --- a/lib/csu/alpha/Makefile +++ b/lib/csu/alpha/Makefile @@ -1,15 +1,15 @@ -# $OpenBSD: Makefile,v 1.9 2001/02/03 03:21:35 art Exp $ +# $OpenBSD: Makefile,v 1.10 2001/02/03 22:48:36 art Exp $ # $NetBSD: Makefile,v 1.6 1996/10/18 05:27:38 thorpej Exp $ -.include <bsd.own.mk> # for ELF_TOOLCHAIN definition - CFLAGS+= -DLIBC_SCCS -DPIC -DELFSIZE=64 -CFLAGS+= -I${.CURDIR}/../ OBJS= crt0.o gcrt0.o crtbegin.o crtend.o crtbeginS.o crtendS.o CLEANFILES+= core a.out +.PATH: ${.CURDIR}/../common_elf +CFLAGS+= -I${.CURDIR}/../common_elf + PICFLAG?=-fpic all: ${OBJS} diff --git a/lib/csu/alpha/crtbegin.c b/lib/csu/alpha/crtbegin.c deleted file mode 100644 index 2ea2897f8b8..00000000000 --- a/lib/csu/alpha/crtbegin.c +++ /dev/null @@ -1,112 +0,0 @@ -/* $OpenBSD: crtbegin.c,v 1.1 1996/11/13 21:28:03 niklas Exp $ */ -/* $NetBSD: crtbegin.c,v 1.1 1996/09/12 16:59:03 cgd Exp $ */ - -/* - * Copyright (c) 1993 Paul Kranenburg - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Paul Kranenburg. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef ECOFF_COMPAT - -/* - * XXX EVENTUALLY SHOULD BE MERGED BACK WITH c++rt0.c - */ - -/* - * Run-time module for GNU C++ compiled shared libraries. - * - * The linker constructs the following arrays of pointers to global - * constructors and destructors. The first element contains the - * number of pointers in each. - * The tables are also null-terminated. - */ -#include <stdlib.h> - -static void (*__CTOR_LIST__[1]) __P((void)) - __attribute__((section(".ctors"))) = { (void *)-1 }; /* XXX */ -static void (*__DTOR_LIST__[1]) __P((void)) - __attribute__((section(".dtors"))) = { (void *)-1 }; /* XXX */ - -static void __dtors __P((void)); -static void __ctors __P((void)); - -static void -__dtors() -{ - unsigned long i = (unsigned long) __DTOR_LIST__[0]; - void (**p)(void); - - if (i == -1) { - for (i = 1; __DTOR_LIST__[i] != NULL; i++) - ; - i--; - } - p = __DTOR_LIST__ + i; - while (i--) - (**p--)(); -} - -static void -__ctors() -{ - void (**p)(void) = __CTOR_LIST__ + 1; - - while (*p) - (**p++)(); -} - -extern void __init(void) __attribute__((section(".init"))); - -void -__init() -{ - static int initialized = 0; - - /* - * Call global constructors. - * Arrange to call global destructors at exit. - */ - if (!initialized) { - initialized = 1; - __ctors(); - } - -} - -extern void __fini(void) __attribute__((section(".fini"))); - -void -__fini() -{ - /* - * Call global destructors. - */ - __dtors(); -} - -#endif /* !ECOFF_COMPAT */ diff --git a/lib/csu/alpha/crtend.c b/lib/csu/alpha/crtend.c deleted file mode 100644 index 6e446b76a6b..00000000000 --- a/lib/csu/alpha/crtend.c +++ /dev/null @@ -1,13 +0,0 @@ -/* $OpenBSD: crtend.c,v 1.1 1996/11/13 21:28:04 niklas Exp $ */ -/* $NetBSD: crtend.c,v 1.1 1996/09/12 16:59:04 cgd Exp $ */ - -#ifndef ECOFF_COMPAT - -#include <sys/cdefs.h> - -static void (*__CTOR_LIST__[1]) __P((void)) - __attribute__((section(".ctors"))) = { (void *)0 }; /* XXX */ -static void (*__DTOR_LIST__[1]) __P((void)) - __attribute__((section(".dtors"))) = { (void *)0 }; /* XXX */ - -#endif /* !ECOFF_COMPAT */ |