diff options
author | Dale S. Rahn <rahnds@cvs.openbsd.org> | 2000-06-13 04:07:04 +0000 |
---|---|---|
committer | Dale S. Rahn <rahnds@cvs.openbsd.org> | 2000-06-13 04:07:04 +0000 |
commit | 054a2b28e38fc52ebfcfaf539099c48a0df47c58 (patch) | |
tree | 873f9f73be5f74392bdf638b9f59aef768d72340 | |
parent | b8a10218d7a9228cccfeeb16d19f74bddae195a9 (diff) |
Support files for shared library, expected by gcc, allows shared libraries to
have constructors and destructors.
-rw-r--r-- | lib/csu/powerpc/Makefile | 16 | ||||
-rw-r--r-- | lib/csu/powerpc/crtbeginS.c | 52 | ||||
-rw-r--r-- | lib/csu/powerpc/crtendS.c | 9 |
3 files changed, 75 insertions, 2 deletions
diff --git a/lib/csu/powerpc/Makefile b/lib/csu/powerpc/Makefile index aaa416ae999..2225f9d1ee5 100644 --- a/lib/csu/powerpc/Makefile +++ b/lib/csu/powerpc/Makefile @@ -1,8 +1,8 @@ -# $OpenBSD: Makefile,v 1.4 1999/08/20 14:11:36 niklas Exp $ +# $OpenBSD: Makefile,v 1.5 2000/06/13 04:07:03 rahnds Exp $ # from: @(#)Makefile 8.1 (Berkeley) 6/1/93 CFLAGS= -DLIBC_SCCS -OBJS= crt0.o gcrt0.o crtbegin.o crtend.o +OBJS= crt0.o gcrt0.o crtbegin.o crtend.o crtbeginS.o crtendS.o CLEANFILES+= core a.out all: ${OBJS} @@ -29,6 +29,18 @@ crtend.o: crtend.c @${LD} -x -r -o ${.TARGET} ${.TARGET}.o @rm -f ${.TARGET}.o +crtbeginS.o: crtbeginS.c + @echo ${CC} ${CFLAGS} -c ${.ALLSRC} -o ${.TARGET} + @${CC} ${CFLAGS} -c ${.ALLSRC} -o ${.TARGET}.o + @${LD} -x -r -o ${.TARGET} ${.TARGET}.o + @rm -f ${.TARGET}.o + +crtendS.o: crtendS.c + @echo ${CC} ${CFLAGS} -c ${.ALLSRC} -o ${.TARGET} + @${CC} ${CFLAGS} -c ${.ALLSRC} -o ${.TARGET}.o + @${LD} -x -r -o ${.TARGET} ${.TARGET}.o + @rm -f ${.TARGET}.o + install: ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 ${OBJS} \ ${DESTDIR}/usr/lib diff --git a/lib/csu/powerpc/crtbeginS.c b/lib/csu/powerpc/crtbeginS.c new file mode 100644 index 00000000000..2b7e08d53a4 --- /dev/null +++ b/lib/csu/powerpc/crtbeginS.c @@ -0,0 +1,52 @@ +/* $OpenBSD: crtbeginS.c,v 1.1 2000/06/13 04:07:03 rahnds 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. + */ + +/* + * 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> + +void (*__CTOR_LIST__[0]) __P((void)) + __attribute__((section(".ctors"))) = { (void *)-1 }; /* XXX */ +void (*__DTOR_LIST__[0]) __P((void)) + __attribute__((section(".dtors"))) = { (void *)-1 }; /* XXX */ diff --git a/lib/csu/powerpc/crtendS.c b/lib/csu/powerpc/crtendS.c new file mode 100644 index 00000000000..ea35355a16f --- /dev/null +++ b/lib/csu/powerpc/crtendS.c @@ -0,0 +1,9 @@ +/* $OpenBSD: crtendS.c,v 1.1 2000/06/13 04:07:03 rahnds Exp $ */ +/* $NetBSD: crtend.c,v 1.1 1997/04/16 19:38:24 thorpej Exp $ */ + +#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 */ |