Subject: Split crtbegin/crtend into more pieces
To: None <tech-userlevel@netbsd.org>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: tech-toolchain
Date: 11/21/2002 18:35:55
--huq684BweRXVnRxX
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Folks...
First of all, sorry for the double-post, but this is overlapping
toolchain/library area.
This patch splits crtbegin and crtend into more pieces:
crti beginning of _init() and _fini() functions
crtbegin support for calling global ctors/dtors
crtend ends of the ctor/dtor lists
crtn end of _init() and _fini() functions
In addition, I've made our crtbegin and crtend work more like the
ones supplied by GCC (at least the ones that come with GCC 3.3).
These changes are mostly mechanical -- code which was already present
in the various dot_init.h files was copied into crti.S and crtn.S for
each architecture. Most of the dot_init.h files have been removed,
although some remain, in order to provide a new macro for platforms
which need it: CALL_STATIC_FUNCTION() (this is part of making the
crtbegin/crtend files work more like GCC's).
The whole point of this exercise is to then put the NetBSD-specific
support bits (currently, that means ".note.netbsd.ident") into crti.
..which will enable us to switch to using the GCC-supplied crtbegin
and crtend when we move to GCC 3.3. The reason for switching to the
GCC-supplied crtbegin/crtend is that GCC's version of those files
contain special support for various languate features that GCC
supplies (e.g. C++ and Java exception handling). We have some support
for these GCC features in our own crtbegin/crtend, but trying to keep
up with GCC's crtbegin/crtend is a losing proposition -- because those
files sometimes contain feature support which is tied to specific
versions of the compiler.
There is no concern with using the GCC crtbegin/crtend from a licensing
point of view -- those files use the same license as libgcc, which contains
a special exception from the GPL's viral clause for programs compiled
with GCC.
--
-- Jason R. Thorpe <thorpej@wasabisystems.com>
--huq684BweRXVnRxX
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=crtstuff-patch
Index: lib/csu/alpha/crti.S
===================================================================
RCS file: crti.S
diff -N crti.S
*** /dev/null Fri Nov 22 04:09:35 2002
--- crti.S Fri Nov 22 04:10:15 2002
***************
*** 0 ****
--- 1,52 ----
+ /* $NetBSD$ */
+
+ /*-
+ * Copyright (c) 2001 Ross Harvey
+ * 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 the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+ #include <machine/asm.h>
+
+ #define MD_SECTION_PROLOGUE(sect, entry_pt) \
+ .section sect,"ax",@progbits ; \
+ \
+ .align 5 ; \
+ .globl entry_pt ; \
+ entry_pt: \
+ LDGP(pv) ; \
+ lda sp, -32(sp) ; \
+ stq ra, 0(sp) ; \
+ stq gp, 8(sp) ; \
+ .align 5 ; \
+ /* fall thru */
+
+ MD_SECTION_PROLOGUE(.init, _init)
+ MD_SECTION_PROLOGUE(.fini, _fini)
Index: lib/csu/alpha/crtn.S
===================================================================
RCS file: crtn.S
diff -N crtn.S
*** /dev/null Fri Nov 22 04:09:35 2002
--- crtn.S Fri Nov 22 04:10:15 2002
***************
*** 0 ****
--- 1,47 ----
+ /* $NetBSD$ */
+
+ /*-
+ * Copyright (c) 2001 Ross Harvey
+ * 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 the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+ #include <machine/asm.h>
+
+ #define MD_SECTION_EPILOGUE(sect) \
+ .section sect,"ax",@progbits ; \
+ \
+ ldq gp, 8(sp) ; \
+ ldq ra, 0(sp) ; \
+ lda sp, 32(sp) ; \
+ RET
+
+ MD_SECTION_EPILOGUE(.init)
+ MD_SECTION_EPILOGUE(.fini)
Index: lib/csu/alpha/dot_init.h
===================================================================
RCS file: /cvsroot/basesrc/lib/csu/alpha/dot_init.h,v
retrieving revision 1.1
diff -c -r1.1 dot_init.h
*** lib/csu/alpha/dot_init.h 2001/05/11 22:44:14 1.1
--- lib/csu/alpha/dot_init.h 2002/11/22 02:10:15
***************
*** 1,79 ****
! /* $NetBSD: dot_init.h,v 1.1 2001/05/11 22:44:14 ross Exp $ */
- /*-
- * Copyright (c) 2001 Ross Harvey
- * 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 the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``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 FOUNDATION OR CONTRIBUTORS
- * 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.
- */
-
- #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
- #include <machine/asm.h>
-
/*
! * These must be extern to avoid warnings ("declared static but never defined")
! * However, only the declaration is extern, the actually __asm() defines them
! * as static.
*/
- #define INIT_FALLTHRU_DECL void init_fallthru(void)
- #define FINI_FALLTHRU_DECL void fini_fallthru(void)
-
- #define INIT_FALLTHRU() init_fallthru()
- #define FINI_FALLTHRU() fini_fallthru()
-
- #define ASM_SETUP "sp = $30; gp = $29; pv = $27; ra = $26 \n"
-
- #define MD_SECTION_PROLOGUE(sect, entry_pt) \
- __asm ( \
- ASM_SETUP \
- ".section "#sect",\"ax\",@progbits \n"\
- #entry_pt": \n"\
- " ldgp gp, 0(pv) \n"\
- " lda sp, -32(sp) \n"\
- " stq ra, 0(sp) \n"\
- " stq gp, 8(sp) \n"\
- " .align 5 \n"\
- " /* fall thru */ \n"\
- ".previous")
-
- #define MD_SECTION_EPILOGUE(sect) \
- __asm ( \
- ASM_SETUP \
- ".section "#sect",\"ax\",@progbits \n"\
- " ldq gp, 8(sp) \n"\
- " ldq ra, 0(sp) \n"\
- " lda sp, 32(sp) \n"\
- " RET \n"\
- ".previous")
-
- #define MD_INIT_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.init, init_fallthru)
- #define MD_FINI_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.fini, fini_fallthru)
! #define MD_INIT_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.init)
! #define MD_FINI_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.fini)
--- 1,15 ----
! /* $NetBSD$ */
/*
! * Written by Jason R. Thorpe, Nov. 2002.
! * Public domain.
*/
! /* We assume we need to reload our GP. */
! #define CALL_STATIC_FUNCTION(section, func) \
! asm(".section " #section "\n" \
! " br $29, 1f \n" \
! "1: ldgp $29, 1f \n" \
! " unop \n" \
! " jsr $26, " #func "\n" \
! " .align 3; .previous");
Index: lib/csu/arm_elf/Makefile
===================================================================
RCS file: /cvsroot/basesrc/lib/csu/arm_elf/Makefile,v
retrieving revision 1.2
diff -c -r1.2 Makefile
*** lib/csu/arm_elf/Makefile 2001/07/17 06:39:14 1.2
--- lib/csu/arm_elf/Makefile 2002/11/22 02:10:15
***************
*** 1,4 ****
# $NetBSD: Makefile,v 1.2 2001/07/17 06:39:14 matt Exp $
- CPPFLAGS+= -I- -I${.CURDIR}
.include "${.CURDIR}/../common_elf/Makefile.inc"
--- 1,3 ----
Index: lib/csu/arm_elf/crti.S
===================================================================
RCS file: crti.S
diff -N crti.S
*** /dev/null Fri Nov 22 04:09:35 2002
--- crti.S Fri Nov 22 04:10:15 2002
***************
*** 0 ****
--- 1,50 ----
+ /* $NetBSD$ */
+
+ /*-
+ * Copyright (c) 2001 Ross Harvey
+ * 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 the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+ #include <machine/asm.h>
+
+ #define MD_SECTION_PROLOGUE(sect, entry_pt) \
+ .section sect,"ax",%progbits ; \
+ \
+ .align 0 ; \
+ .global entry_pt ; \
+ entry_pt: \
+ mov ip, sp ; \
+ stmfd sp!, {fp, ip, lr, pc} ; \
+ sub fp, ip, #4 ; \
+ /* fall thru */
+
+ MD_SECTION_PROLOGUE(.init, _init)
+ MD_SECTION_PROLOGUE(.fini, _fini)
Index: lib/csu/arm_elf/crtn.S
===================================================================
RCS file: crtn.S
diff -N crtn.S
*** /dev/null Fri Nov 22 04:09:35 2002
--- crtn.S Fri Nov 22 04:10:15 2002
***************
*** 0 ****
--- 1,43 ----
+ /* $NetBSD$ */
+
+ /*-
+ * Copyright (c) 2001 Ross Harvey
+ * 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 the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+ #include <machine/asm.h>
+
+ #define MD_SECTION_EPILOGUE(sect) \
+ .section sect,"ax",%progbits ; \
+ ldmea fp, {fp, sp, pc}
+
+ MD_SECTION_EPILOGUE(.init)
+ MD_SECTION_EPILOGUE(.fini)
Index: lib/csu/arm_elf/dot_init.h
===================================================================
RCS file: dot_init.h
diff -N dot_init.h
*** /tmp/cvs26522ac Fri Nov 22 04:10:20 2002
--- /dev/null Fri Nov 22 04:09:35 2002
***************
*** 1,71 ****
- /* $NetBSD: dot_init.h,v 1.2 2002/01/01 01:36:21 thorpej Exp $ */
-
- /*-
- * Copyright (c) 2001 Ross Harvey
- * 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 the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``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 FOUNDATION OR CONTRIBUTORS
- * 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.
- */
-
- #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
- #include <machine/asm.h>
-
- /*
- * These must be extern to avoid warnings ("declared static but never defined")
- * However, only the declaration is extern, the actually __asm() defines them
- * as static.
- */
- #define INIT_FALLTHRU_DECL void init_fallthru(void)
- #define FINI_FALLTHRU_DECL void fini_fallthru(void)
-
- #define INIT_FALLTHRU() init_fallthru()
- #define FINI_FALLTHRU() fini_fallthru()
-
- #define MD_SECTION_PROLOGUE(sect, entry_pt) \
- __asm ( \
- ".section "#sect",\"ax\",%progbits \n"\
- " .align 0 \n"\
- #entry_pt": \n"\
- "mov ip, sp \n"\
- "stmfd sp!, {fp, ip, lr, pc} \n"\
- "sub fp, ip, #4 \n"\
- " /* fall thru */ \n"\
- ".previous")
-
- #define MD_SECTION_EPILOGUE(sect) \
- __asm ( \
- ".section "#sect",\"ax\",%progbits \n"\
- "ldmea fp, {fp, sp, pc} \n"\
- ".previous")
-
- #define MD_INIT_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.init, init_fallthru)
- #define MD_FINI_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.fini, fini_fallthru)
-
- #define MD_INIT_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.init)
- #define MD_FINI_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.fini)
--- 0 ----
Index: lib/csu/common_elf/Makefile.inc
===================================================================
RCS file: /cvsroot/basesrc/lib/csu/common_elf/Makefile.inc,v
retrieving revision 1.18
diff -c -r1.18 Makefile.inc
*** lib/csu/common_elf/Makefile.inc 2002/08/19 09:41:27 1.18
--- lib/csu/common_elf/Makefile.inc 2002/11/22 02:10:15
***************
*** 18,27 ****
.PATH: ${.CURDIR}/../common_elf
! OBJS+= crt0.o gcrt0.o crtbegin.o crtend.o
.if ${MKPIC} != "no"
OBJS+= crtbeginS.o crtendS.o
COPTS+= -fPIC
.endif
realall: ${OBJS}
--- 18,28 ----
.PATH: ${.CURDIR}/../common_elf
! OBJS+= crt0.o gcrt0.o crtbegin.o crtend.o crti.o crtn.o
.if ${MKPIC} != "no"
OBJS+= crtbeginS.o crtendS.o
COPTS+= -fPIC
+ AFLAGS+= -fPIC
.endif
realall: ${OBJS}
***************
*** 59,64 ****
--- 60,77 ----
crtendS.o: crtend.c
@echo "${COMPILE.c} -DSHARED ${.ALLSRC} -o ${.TARGET}"
@${COMPILE.c} -DSHARED ${.ALLSRC} -o ${.TARGET}.o
+ @${LD} -X -r -o ${.TARGET} ${.TARGET}.o
+ @rm -f ${.TARGET}.o
+
+ crti.o: crti.S
+ @echo "${COMPILE.S} ${.ALLSRC} -o ${.TARGET}"
+ @${COMPILE.S} ${.ALLSRC} -o ${.TARGET}.o
+ @${LD} -X -r -o ${.TARGET} ${.TARGET}.o
+ @rm -f ${.TARGET}.o
+
+ crtn.o: crtn.S
+ @echo "${COMPILE.S} ${.ALLSRC} -o ${.TARGET}"
+ @${COMPILE.S} ${.ALLSRC} -o ${.TARGET}.o
@${LD} -X -r -o ${.TARGET} ${.TARGET}.o
@rm -f ${.TARGET}.o
Index: lib/csu/common_elf/crtbegin.c
===================================================================
RCS file: /cvsroot/basesrc/lib/csu/common_elf/crtbegin.c,v
retrieving revision 1.19
diff -c -r1.19 crtbegin.c
*** lib/csu/common_elf/crtbegin.c 2002/11/11 00:44:43 1.19
--- lib/csu/common_elf/crtbegin.c 2002/11/22 02:10:15
***************
*** 1,7 ****
/* $NetBSD: crtbegin.c,v 1.19 2002/11/11 00:44:43 thorpej Exp $ */
/*-
! * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
--- 1,7 ----
/* $NetBSD: crtbegin.c,v 1.19 2002/11/11 00:44:43 thorpej Exp $ */
/*-
! * Copyright (c) 1998, 2001, 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
***************
*** 94,112 ****
#endif
#endif
! static void __dtors(void);
! static void __ctors(void);
!
! INIT_FALLTHRU_DECL;
! FINI_FALLTHRU_DECL;
!
! extern void _init(void) __attribute__((section(".init")));
! extern void _fini(void) __attribute__((section(".fini")));
! static void __ctors(void) __attribute__((section(".init")));
! static void __dtors(void) __attribute__((section(".fini")));
static void
! __ctors()
{
unsigned long i = (unsigned long) __CTOR_LIST__[0];
void (**p)(void);
--- 94,116 ----
#endif
#endif
! #ifndef CALL_STATIC_FUNCTION
! #if defined(__GNUC__)
! #define CALL_STATIC_FUNCTION(section, func) \
! static void __attribute__((__unused__)) \
! __call_##func(void) \
! { \
! __asm __volatile (".section " #section); \
! func(); \
! __asm __volatile (".previous"); \
! }
! #else
! #error Need CALL_STATIC_FUNCTION
! #endif
! #endif /* ! CALL_STATIC_FUNCTION */
static void
! __ctors(void)
{
unsigned long i = (unsigned long) __CTOR_LIST__[0];
void (**p)(void);
***************
*** 122,128 ****
}
static void
! __dtors()
{
void (**p)(void) = __DTOR_LIST__ + 1;
--- 126,132 ----
}
static void
! __dtors(void)
{
void (**p)(void) = __DTOR_LIST__ + 1;
***************
*** 130,149 ****
(**p++)();
}
! void
! _init()
{
! static int initialized = 0;
#ifdef DWARF2_EH
#if defined(__GNUC__)
static struct dwarf2_eh_object object;
#endif /* __GNUC__ */
#endif /* DWARF2_EH */
- /*
- * Execute code in the .init sections
- */
- INIT_FALLTHRU();
if (!initialized) {
initialized = 1;
--- 134,149 ----
(**p++)();
}
! static void __attribute__((__unused__))
! __do_global_ctors_aux(void)
{
! static int initialized;
#ifdef DWARF2_EH
#if defined(__GNUC__)
static struct dwarf2_eh_object object;
#endif /* __GNUC__ */
#endif /* DWARF2_EH */
if (!initialized) {
initialized = 1;
***************
*** 165,174 ****
__ctors();
}
}
! void
! _fini()
{
#if defined(DSO_HANDLE) && defined(__GNUC__) && defined(SHARED)
/*
--- 165,179 ----
__ctors();
}
}
+ CALL_STATIC_FUNCTION(.init, __do_global_ctors_aux)
! static void __attribute__((__unused__))
! __do_global_dtors_aux(void)
{
+ static int finished;
+
+ if (finished)
+ return;
#if defined(DSO_HANDLE) && defined(__GNUC__) && defined(SHARED)
/*
***************
*** 190,201 ****
#endif /* __GNUC__ */
#endif /* DWARF2_EH */
! /*
! * Execute code in the .fini sections
! */
! FINI_FALLTHRU();
}
!
! MD_INIT_SECTION_PROLOGUE;
!
! MD_FINI_SECTION_PROLOGUE;
--- 195,200 ----
#endif /* __GNUC__ */
#endif /* DWARF2_EH */
! finished = 1;
}
! CALL_STATIC_FUNCTION(.fini, __do_global_dtors_aux)
Index: lib/csu/common_elf/crtend.c
===================================================================
RCS file: /cvsroot/basesrc/lib/csu/common_elf/crtend.c,v
retrieving revision 1.9
diff -c -r1.9 crtend.c
*** lib/csu/common_elf/crtend.c 2001/12/30 23:45:01 1.9
--- lib/csu/common_elf/crtend.c 2002/11/22 02:10:15
***************
*** 20,26 ****
static void *__JCR_END__[1]
__attribute__((__unused__, section(".jcr"))) = { (void *) 0 };
#endif
-
- MD_INIT_SECTION_EPILOGUE;
-
- MD_FINI_SECTION_EPILOGUE;
--- 20,22 ----
Index: lib/csu/common_elf/dot_init.h
===================================================================
RCS file: /cvsroot/basesrc/lib/csu/common_elf/dot_init.h,v
retrieving revision 1.1
diff -c -r1.1 dot_init.h
*** lib/csu/common_elf/dot_init.h 2001/05/11 22:44:15 1.1
--- lib/csu/common_elf/dot_init.h 2002/11/22 02:10:15
***************
*** 33,48 ****
* POSSIBILITY OF SUCH DAMAGE.
*/
! #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
!
! #define INIT_FALLTHRU_DECL
! #define FINI_FALLTHRU_DECL
!
! #define INIT_FALLTHRU()
! #define FINI_FALLTHRU()
!
! #define MD_INIT_SECTION_PROLOGUE
! #define MD_FINI_SECTION_PROLOGUE
!
! #define MD_INIT_SECTION_EPILOGUE
! #define MD_FINI_SECTION_EPILOGUE
--- 33,36 ----
* POSSIBILITY OF SUCH DAMAGE.
*/
! /* Empty dummy header. */
Index: lib/csu/i386_elf/crti.S
===================================================================
RCS file: crti.S
diff -N crti.S
*** /dev/null Fri Nov 22 04:09:35 2002
--- crti.S Fri Nov 22 04:10:15 2002
***************
*** 0 ****
--- 1,48 ----
+ /* $NetBSD$ */
+
+ /*-
+ * Copyright (c) 2001 Ross Harvey
+ * 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 the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+ #include <machine/asm.h>
+
+ /* Placement of the .align _after_ the label is intentional. */
+ #define MD_SECTION_PROLOGUE(sect, entry_pt) \
+ .section sect,"ax",@progbits ; \
+ \
+ .globl entry_pt ; \
+ entry_pt: \
+ .align 16 ; \
+ /* fall thru */
+
+ MD_SECTION_PROLOGUE(.init, _init)
+ MD_SECTION_PROLOGUE(.fini, _fini)
Index: lib/csu/i386_elf/crtn.S
===================================================================
RCS file: crtn.S
diff -N crtn.S
*** /dev/null Fri Nov 22 04:09:35 2002
--- crtn.S Fri Nov 22 04:10:15 2002
***************
*** 0 ****
--- 1,43 ----
+ /* $NetBSD$ */
+
+ /*-
+ * Copyright (c) 2001 Ross Harvey
+ * 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 the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+ #include <machine/asm.h>
+
+ #define MD_SECTION_EPILOGUE(sect) \
+ .section sect,"ax",@progbits ; \
+ ret
+
+ MD_SECTION_EPILOGUE(.init)
+ MD_SECTION_EPILOGUE(.fini)
Index: lib/csu/i386_elf/dot_init.h
===================================================================
RCS file: /cvsroot/basesrc/lib/csu/i386_elf/dot_init.h,v
retrieving revision 1.2
diff -c -r1.2 dot_init.h
*** lib/csu/i386_elf/dot_init.h 2002/01/14 12:06:49 1.2
--- lib/csu/i386_elf/dot_init.h 2002/11/22 02:10:15
***************
*** 1,69 ****
! /* $NetBSD: dot_init.h,v 1.2 2002/01/14 12:06:49 drochner Exp $ */
- /*-
- * Copyright (c) 2001 Ross Harvey
- * 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 the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``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 FOUNDATION OR CONTRIBUTORS
- * 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.
- */
-
- #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-
/*
! * These must be extern to avoid warnings ("declared static but never defined")
! * However, only the declaration is extern, the actually __asm() defines them
! * as static.
*/
- #define INIT_FALLTHRU_DECL void init_fallthru(void)
- #define FINI_FALLTHRU_DECL void fini_fallthru(void)
-
- #define INIT_FALLTHRU() init_fallthru()
- #define FINI_FALLTHRU() fini_fallthru()
-
- #define MD_SECTION_PROLOGUE(sect, entry_pt) \
- __asm ( \
- ".section "#sect",\"ax\",@progbits \n"\
- #entry_pt": \n"\
- " .align 16 \n"\
- " /* fall thru */ \n"\
- ".previous")
-
- /* placement of the .align _after_ the label is intentional */
-
- #define MD_SECTION_EPILOGUE(sect) \
- __asm ( \
- ".section "#sect",\"ax\",@progbits \n"\
- " ret \n"\
- ".previous")
-
- #define MD_INIT_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.init, init_fallthru)
- #define MD_FINI_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.fini, fini_fallthru)
! #define MD_INIT_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.init)
! #define MD_FINI_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.fini)
--- 1,9 ----
! /* $NetBSD$ */
/*
! * Written by Jason R. Thorpe, Nov. 2002.
! * Public domain.
*/
! #define CALL_STATIC_FUNCTION(section, func) \
! asm(".section " #section "; call " #func "; .previous");
Index: lib/csu/m68k_elf/Makefile
===================================================================
RCS file: /cvsroot/basesrc/lib/csu/m68k_elf/Makefile,v
retrieving revision 1.6
diff -c -r1.6 Makefile
*** lib/csu/m68k_elf/Makefile 2001/07/17 03:56:49 1.6
--- lib/csu/m68k_elf/Makefile 2002/11/22 02:10:15
***************
*** 1,6 ****
# $NetBSD: Makefile,v 1.6 2001/07/17 03:56:49 thorpej Exp $
- #Uncomment the next line to enable the new .init fallthru
- CPPFLAGS+= -I- -I${.CURDIR}
-
.include "${.CURDIR}/../common_elf/Makefile.inc"
--- 1,3 ----
Index: lib/csu/m68k_elf/crti.S
===================================================================
RCS file: crti.S
diff -N crti.S
*** /dev/null Fri Nov 22 04:09:35 2002
--- crti.S Fri Nov 22 04:10:15 2002
***************
*** 0 ****
--- 1,48 ----
+ /* $NetBSD$ */
+
+ /*-
+ * Copyright (c) 2001 Ross Harvey
+ * 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 the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+ #include <machine/asm.h>
+
+ /* Placement of the .align _after_ the label is intentional. */
+ #define MD_SECTION_PROLOGUE(sect, entry_pt) \
+ .section sect,"ax",@progbits ; \
+ \
+ .globl entry_pt ; \
+ entry_pt: \
+ .align 2 ; \
+ /* fall thru */
+
+ MD_SECTION_PROLOGUE(.init, _init)
+ MD_SECTION_PROLOGUE(.fini, _fini)
Index: lib/csu/m68k_elf/crtn.S
===================================================================
RCS file: crtn.S
diff -N crtn.S
*** /dev/null Fri Nov 22 04:09:35 2002
--- crtn.S Fri Nov 22 04:10:15 2002
***************
*** 0 ****
--- 1,43 ----
+ /* $NetBSD$ */
+
+ /*-
+ * Copyright (c) 2001 Ross Harvey
+ * 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 the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+ #include <machine/asm.h>
+
+ #define MD_SECTION_EPILOGUE(sect) \
+ .section sect,"ax",@progbits ; \
+ rts
+
+ MD_SECTION_EPILOGUE(.init)
+ MD_SECTION_EPILOGUE(.fini)
Index: lib/csu/m68k_elf/dot_init.h
===================================================================
RCS file: dot_init.h
diff -N dot_init.h
*** /tmp/cvs26522aj Fri Nov 22 04:10:22 2002
--- /dev/null Fri Nov 22 04:09:35 2002
***************
*** 1,70 ****
- /* $NetBSD: dot_init.h,v 1.2 2001/10/13 09:21:50 scw Exp $ */
-
- /*-
- * Copyright (c) 2001 Ross Harvey
- * 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 the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``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 FOUNDATION OR CONTRIBUTORS
- * 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.
- */
-
- #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
- #include <machine/asm.h>
-
- /*
- * These must be extern to avoid warnings ("declared static but never defined")
- * However, only the declaration is extern, the actually __asm() defines them
- * as static.
- */
- #define INIT_FALLTHRU_DECL void init_fallthru(void)
- #define FINI_FALLTHRU_DECL void fini_fallthru(void)
-
- #define INIT_FALLTHRU() init_fallthru()
- #define FINI_FALLTHRU() fini_fallthru()
-
- #define MD_SECTION_PROLOGUE(sect, entry_pt) \
- __asm ( \
- ".section "#sect",\"ax\",@progbits \n"\
- #entry_pt": \n"\
- " .align 2 \n"\
- " /* fall thru */ \n"\
- ".previous")
-
- /* placement of the .align _after_ the label is intentional */
-
- #define MD_SECTION_EPILOGUE(sect) \
- __asm ( \
- ".section "#sect",\"ax\",@progbits \n"\
- " rts \n"\
- ".previous")
-
- #define MD_INIT_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.init, init_fallthru)
- #define MD_FINI_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.fini, fini_fallthru)
-
- #define MD_INIT_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.init)
- #define MD_FINI_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.fini)
--- 0 ----
Index: lib/csu/mips/Makefile
===================================================================
RCS file: /cvsroot/basesrc/lib/csu/mips/Makefile,v
retrieving revision 1.23
diff -c -r1.23 Makefile
*** lib/csu/mips/Makefile 2001/07/18 04:43:48 1.23
--- lib/csu/mips/Makefile 2002/11/22 02:10:15
***************
*** 1,6 ****
# $NetBSD: Makefile,v 1.23 2001/07/18 04:43:48 simonb Exp $
- #Uncomment the next line to enable the new .init fallthru
- CPPFLAGS+= -I- -I${.CURDIR}
-
.include "${.CURDIR}/../common_elf/Makefile.inc"
--- 1,3 ----
Index: lib/csu/mips/crti.S
===================================================================
RCS file: crti.S
diff -N crti.S
*** /dev/null Fri Nov 22 04:09:35 2002
--- crti.S Fri Nov 22 04:10:16 2002
***************
*** 0 ****
--- 1,54 ----
+ /* $NetBSD$ */
+
+ /*-
+ * Copyright (c) 2001 Ross Harvey
+ * Copyright (c) 2001 Simon Burge
+ * 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 the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+ #include <mips/regdef.h>
+
+ /*
+ * The stack frame is 16 bytes long; big enough to store the GP saved
+ * by .cpload (at offset 0) and the caller's RA (at offset 8), allowing
+ * for 64-bit pointers.
+ */
+ #define MD_SECTION_PROLOGUE(sect, entry_pt) \
+ .section sect,"ax",@progbits ; \
+ \
+ .globl entry_pt ; \
+ entry_pt: \
+ subu sp, sp, 16 ; \
+ sw ra, 8(sp) ; \
+ /* fall thru */
+
+ MD_SECTION_PROLOGUE(.init, _init)
+ MD_SECTION_PROLOGUE(.fini, _fini)
Index: lib/csu/mips/crtn.S
===================================================================
RCS file: crtn.S
diff -N crtn.S
*** /dev/null Fri Nov 22 04:09:35 2002
--- crtn.S Fri Nov 22 04:10:16 2002
***************
*** 0 ****
--- 1,49 ----
+ /* $NetBSD$ */
+
+ /*-
+ * Copyright (c) 2001 Ross Harvey
+ * Copyright (c) 2001 Simon Burge
+ * 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 the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+ #include <mips/regdef.h>
+
+ #define MD_SECTION_EPILOGUE(sect) \
+ .section sect,"ax",@progbits ; \
+ \
+ lw ra, 8(sp) ; \
+ .set noreorder ; \
+ j ra ; \
+ addu sp, sp, 16 ; \
+ .set reorder
+
+ MD_SECTION_EPILOGUE(.init)
+ MD_SECTION_EPILOGUE(.fini)
Index: lib/csu/mips/dot_init.h
===================================================================
RCS file: dot_init.h
diff -N dot_init.h
*** /tmp/cvs26522al Fri Nov 22 04:10:22 2002
--- /dev/null Fri Nov 22 04:09:35 2002
***************
*** 1,80 ****
- /* $NetBSD: dot_init.h,v 1.2 2001/08/16 03:44:46 simonb Exp $ */
-
- /*-
- * Copyright (c) 2001 Ross Harvey
- * Copyright (c) 2001 Simon Burge
- * 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 the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``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 FOUNDATION OR CONTRIBUTORS
- * 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.
- */
-
- #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-
- /*
- * These must be extern to avoid warnings ("declared static but never defined")
- * However, only the declaration is extern, the actually __asm() defines them
- * as static.
- */
- #define INIT_FALLTHRU_DECL void init_fallthru(void)
- #define FINI_FALLTHRU_DECL void fini_fallthru(void)
-
- #define INIT_FALLTHRU() init_fallthru()
- #define FINI_FALLTHRU() fini_fallthru()
-
- #define ra "$31"
-
- /*
- * The stack frame is 16 bytes long; big enough to store the GP saved
- * by .cpload (at offset 0) and the caller's RA (at offset 8),
- * allowing for 64bit addresses.
- */
- #define MD_SECTION_PROLOGUE(sect, entry_pt) \
- __asm ( \
- ".section "#sect",\"ax\",@progbits \n"\
- #entry_pt": \n"\
- " subu $sp,$sp,16 \n"\
- " sw "ra",8($sp) \n"\
- " /* fall thru */ \n"\
- ".previous")
-
- #define MD_SECTION_EPILOGUE(sect) \
- __asm ( \
- ".section "#sect",\"ax\",@progbits \n"\
- " lw "ra",8($sp) \n"\
- " .set noreorder \n"\
- " j "ra" \n"\
- " addu $sp,$sp,16 \n"\
- " .set reorder \n"\
- ".previous")
-
- #define MD_INIT_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.init, init_fallthru)
- #define MD_FINI_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.fini, fini_fallthru)
-
- #define MD_INIT_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.init)
- #define MD_FINI_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.fini)
--- 0 ----
Index: lib/csu/powerpc/Makefile
===================================================================
RCS file: /cvsroot/basesrc/lib/csu/powerpc/Makefile,v
retrieving revision 1.12
diff -c -r1.12 Makefile
*** lib/csu/powerpc/Makefile 2001/07/17 12:16:43 1.12
--- lib/csu/powerpc/Makefile 2002/11/22 02:10:16
***************
*** 1,5 ****
# $NetBSD: Makefile,v 1.12 2001/07/17 12:16:43 tsubai Exp $
- CPPFLAGS+= -I- -I${.CURDIR}
-
.include "${.CURDIR}/../common_elf/Makefile.inc"
--- 1,3 ----
Index: lib/csu/powerpc/crti.S
===================================================================
RCS file: crti.S
diff -N crti.S
*** /dev/null Fri Nov 22 04:09:35 2002
--- crti.S Fri Nov 22 04:10:16 2002
***************
*** 0 ****
--- 1,49 ----
+ /* $NetBSD$ */
+
+ /*-
+ * Copyright (c) 2001 Ross Harvey
+ * 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 the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+ #include <machine/asm.h>
+
+ #define MD_SECTION_PROLOGUE(sect, entry_pt) \
+ .section sect,"ax",@progbits ; \
+ \
+ .globl entry_pt ; \
+ entry_pt: \
+ stwu %r1,-16(%r1) ; \
+ mflr %r0 ; \
+ stw %r0,12(%r1) ; \
+ /* fall thru */
+
+ MD_SECTION_PROLOGUE(.init, _init)
+ MD_SECTION_PROLOGUE(.fini, _fini)
Index: lib/csu/powerpc/crtn.S
===================================================================
RCS file: crtn.S
diff -N crtn.S
*** /dev/null Fri Nov 22 04:09:35 2002
--- crtn.S Fri Nov 22 04:10:16 2002
***************
*** 0 ****
--- 1,47 ----
+ /* $NetBSD$ */
+
+ /*-
+ * Copyright (c) 2001 Ross Harvey
+ * 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 the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+ #include <machine/asm.h>
+
+ #define MD_SECTION_EPILOGUE(sect) \
+ .section sect,"ax",@progbits ; \
+ \
+ lwz %r0,12(%r1) ; \
+ mtlr %r0 ; \
+ la %r1,16(%r1) ; \
+ blr
+
+ MD_SECTION_EPILOGUE(.init)
+ MD_SECTION_EPILOGUE(.fini)
Index: lib/csu/powerpc/dot_init.h
===================================================================
RCS file: dot_init.h
diff -N dot_init.h
*** /tmp/cvs26522an Fri Nov 22 04:10:23 2002
--- /dev/null Fri Nov 22 04:09:35 2002
***************
*** 1,73 ****
- /* $NetBSD: dot_init.h,v 1.2 2002/07/29 21:54:35 matt Exp $ */
-
- /*-
- * Copyright (c) 2001 Ross Harvey
- * 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 the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``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 FOUNDATION OR CONTRIBUTORS
- * 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.
- */
-
- #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
- #include <machine/asm.h>
-
- /*
- * These must be extern to avoid warnings ("declared static but never defined")
- * However, only the declaration is extern, the actually __asm() defines them
- * as static.
- */
- #define INIT_FALLTHRU_DECL void init_fallthru(void)
- #define FINI_FALLTHRU_DECL void fini_fallthru(void)
-
- #define INIT_FALLTHRU() init_fallthru()
- #define FINI_FALLTHRU() fini_fallthru()
-
- #define MD_SECTION_PROLOGUE(sect, entry_pt) \
- __asm ( \
- ".section "#sect",\"ax\",@progbits \n" \
- #entry_pt": \n" \
- " stwu %r1,-16(%r1) \n" \
- " mflr %r0 \n" \
- " stw %r0,12(%r1) \n" \
- " /* fall thru */ \n" \
- ".previous")
-
- #define MD_SECTION_EPILOGUE(sect) \
- __asm ( \
- ".section "#sect",\"ax\",@progbits \n" \
- " lwz %r0,12(%r1) \n" \
- " mtlr %r0 \n" \
- " la %r1,16(%r1) \n" \
- " blr \n" \
- ".previous")
-
- #define MD_INIT_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.init, init_fallthru)
- #define MD_FINI_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.fini, fini_fallthru)
-
- #define MD_INIT_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.init)
- #define MD_FINI_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.fini)
--- 0 ----
Index: lib/csu/sh3_elf/crti.S
===================================================================
RCS file: crti.S
diff -N crti.S
*** /dev/null Fri Nov 22 04:09:35 2002
--- crti.S Fri Nov 22 04:10:16 2002
***************
*** 0 ****
--- 1,48 ----
+ /* $NetBSD$ */
+
+ /*-
+ * Copyright (c) 2001 Ross Harvey
+ * 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 the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+ #include <machine/asm.h>
+
+ #define MD_SECTION_PROLOGUE(sect, entry_pt) \
+ .section sect,"ax",@progbits ; \
+ \
+ .globl entry_pt ; \
+ entry_pt: \
+ sts.l pr, @-r15 ; \
+ .align 2 ; \
+ /* fall thru */
+
+ MD_SECTION_PROLOGUE(.init, _init)
+ MD_SECTION_PROLOGUE(.fini, _fini)
Index: lib/csu/sh3_elf/crtn.S
===================================================================
RCS file: crtn.S
diff -N crtn.S
*** /dev/null Fri Nov 22 04:09:35 2002
--- crtn.S Fri Nov 22 04:10:16 2002
***************
*** 0 ****
--- 1,46 ----
+ /* $NetBSD$ */
+
+ /*-
+ * Copyright (c) 2001 Ross Harvey
+ * 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 the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+ #include <machine/asm.h>
+
+ #define MD_SECTION_EPILOGUE(sect) \
+ .section sect,"ax",@progbits ; \
+ \
+ lds.l @r15+, pr ; \
+ rts ; \
+ nop
+
+ MD_SECTION_EPILOGUE(.init)
+ MD_SECTION_EPILOGUE(.fini)
Index: lib/csu/sh3_elf/dot_init.h
===================================================================
RCS file: /cvsroot/basesrc/lib/csu/sh3_elf/dot_init.h,v
retrieving revision 1.1
diff -c -r1.1 dot_init.h
*** lib/csu/sh3_elf/dot_init.h 2001/07/23 20:43:31 1.1
--- lib/csu/sh3_elf/dot_init.h 2002/11/22 02:10:16
***************
*** 1,75 ****
! /* $NetBSD: dot_init.h,v 1.1 2001/07/23 20:43:31 tsubai Exp $ */
! /*-
! * Copyright (c) 2001 Ross Harvey
! * 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 the NetBSD
! * Foundation, Inc. and its contributors.
! * 4. Neither the name of The NetBSD Foundation nor the names of its
! * contributors may be used to endorse or promote products derived
! * from this software without specific prior written permission.
! *
! * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
! * ``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 FOUNDATION OR CONTRIBUTORS
! * 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.
*/
- #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-
/*
! * These must be extern to avoid warnings ("declared static but never defined")
! * However, only the declaration is extern, the actually __asm() defines them
! * as static.
*/
! #define INIT_FALLTHRU_DECL void init_fallthru(void)
! #define FINI_FALLTHRU_DECL void fini_fallthru(void)
!
! #define INIT_FALLTHRU() init_fallthru()
! #define FINI_FALLTHRU() fini_fallthru()
!
! #define MD_SECTION_PROLOGUE(sect, entry_pt) \
! __asm ( \
! ".section "#sect",\"ax\",@progbits \n" \
! #entry_pt": \n" \
! " sts.l pr, @-r15 \n" \
! " .align 2 \n" \
! " /* fall thru */ \n" \
! ".previous")
!
! #define MD_SECTION_EPILOGUE(sect) \
! __asm ( \
! ".section "#sect",\"ax\",@progbits \n" \
! " lds.l @r15+, pr \n" \
! " rts \n" \
! " nop \n" \
! ".previous")
!
! #ifdef __LEADING_UNDERSCORE
! #define MD_INIT_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.init, _init_fallthru)
! #define MD_FINI_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.fini, _fini_fallthru)
! #else
! #define MD_INIT_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.init, init_fallthru)
! #define MD_FINI_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.fini, fini_fallthru)
! #endif
!
! #define MD_INIT_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.init)
! #define MD_FINI_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.fini)
--- 1,20 ----
! /* $NetBSD$ */
! /*
! * Written by Jason R. Thorpe, Nov. 2002.
! * Public domain.
*/
/*
! * We need to put the function pointer in our own constant
! * pool (otherwise it might be too far away to reference).
*/
! #define CALL_STATIC_FUNCTION(section, func) \
! asm(".section " #section "\n" \
! " mov.l 1f, r1 \n" \
! " mova 2f, r0 \n" \
! " braf r1 \n" \
! " lds r0, pr \n" \
! "0: .p2align 2 \n" \
! "1: .long " #func " - 0b \n" \
! "2: .previous");
Index: lib/csu/sh5/Makefile
===================================================================
RCS file: /cvsroot/basesrc/lib/csu/sh5/Makefile,v
retrieving revision 1.1
diff -c -r1.1 Makefile
*** lib/csu/sh5/Makefile 2002/07/05 13:31:28 1.1
--- lib/csu/sh5/Makefile 2002/11/22 02:10:16
***************
*** 1,6 ****
# $NetBSD: Makefile,v 1.1 2002/07/05 13:31:28 scw Exp $
- #Uncomment the next line to enable the new .init fallthru
- CPPFLAGS+= -I- -I${.CURDIR}
-
.include "${.CURDIR}/../common_elf/Makefile.inc"
--- 1,3 ----
Index: lib/csu/sh5/crti.S
===================================================================
RCS file: crti.S
diff -N crti.S
*** /dev/null Fri Nov 22 04:09:35 2002
--- crti.S Fri Nov 22 04:10:17 2002
***************
*** 0 ****
--- 1,84 ----
+ /* $NetBSD$ */
+
+ /*
+ * Copyright 2002 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Steve C. Woodford for Wasabi Systems, Inc.
+ *
+ * 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 for the NetBSD Project by
+ * Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * 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.
+ */
+ /*-
+ * Copyright (c) 2001 Ross Harvey
+ * 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 the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+ #include <machine/asm.h>
+
+ #define MD_SECTION_PROLOGUE(sect, entry_pt) \
+ .section sect,"ax",@progbits ; \
+ \
+ .globl entry_pt ; \
+ entry_pt: \
+ addi r15, -16, r15 ; \
+ st.q r15, 0, r14 ; \
+ st.q r15, 8, r18 ; \
+ add r15, r63, r14 ; \
+ /* fall thru */
+
+ MD_SECTION_PROLOGUE(.init, _C_LABEL(_init))
+ MD_SECTION_PROLOGUE(.fini, _C_LABEL(_fini))
Index: lib/csu/sh5/crtn.S
===================================================================
RCS file: crtn.S
diff -N crtn.S
*** /dev/null Fri Nov 22 04:09:35 2002
--- crtn.S Fri Nov 22 04:10:17 2002
***************
*** 0 ****
--- 1,82 ----
+ /* $NetBSD$ */
+
+ /*
+ * Copyright 2002 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Steve C. Woodford for Wasabi Systems, Inc.
+ *
+ * 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 for the NetBSD Project by
+ * Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * 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.
+ */
+ /*-
+ * Copyright (c) 2001 Ross Harvey
+ * 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 the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+ #include <machine/asm.h>
+
+ #define MD_SECTION_EPILOGUE(sect) \
+ .section sect,"ax",@progbits ; \
+ \
+ ld.q r15, 8, r18 ; \
+ ld.q r15, 0, r14 ; \
+ ptabs/l r18, tr0 ; \
+ addi r15, 16, r15 ; \
+ blink tr0, r63
+
+ MD_SECTION_EPILOGUE(.init)
+ MD_SECTION_EPILOGUE(.fini)
Index: lib/csu/sh5/dot_init.h
===================================================================
RCS file: dot_init.h
diff -N dot_init.h
*** /tmp/cvs26522aq Fri Nov 22 04:10:23 2002
--- /dev/null Fri Nov 22 04:09:35 2002
***************
*** 1,113 ****
- /* $NetBSD: dot_init.h,v 1.2 2002/07/10 13:13:48 scw Exp $ */
-
- /*
- * Copyright 2002 Wasabi Systems, Inc.
- * All rights reserved.
- *
- * Written by Steve C. Woodford for Wasabi Systems, Inc.
- *
- * 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 for the NetBSD Project by
- * Wasabi Systems, Inc.
- * 4. The name of Wasabi Systems, Inc. may not be used to endorse
- * or promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
- * 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.
- */
- /*-
- * Copyright (c) 2001 Ross Harvey
- * 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 the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``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 FOUNDATION OR CONTRIBUTORS
- * 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.
- */
-
- #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-
- /*
- * These must be extern to avoid warnings ("declared static but never defined")
- * However, only the declaration is extern, the actually __asm() defines them
- * as static.
- */
- #define INIT_FALLTHRU_DECL void init_fallthru(void)
- #define FINI_FALLTHRU_DECL void fini_fallthru(void)
-
- #define INIT_FALLTHRU() init_fallthru()
- #define FINI_FALLTHRU() fini_fallthru()
-
- #define MD_SECTION_PROLOGUE(sect, entry_pt) \
- __asm ( \
- ".section "#sect",\"ax\",@progbits \n"\
- #entry_pt": \n"\
- " addi r15, -16, r15 \n"\
- " st.q r15, 0, r14 \n"\
- " st.q r15, 8, r18 \n"\
- " add r15, r63, r14 \n"\
- " /* fall thru */ \n"\
- ".previous")
-
- #define MD_SECTION_EPILOGUE(sect) \
- __asm ( \
- ".section "#sect",\"ax\",@progbits \n"\
- " ld.q r15, 8, r18 \n"\
- " ld.q r15, 0, r14 \n"\
- " ptabs/l r18, tr0 \n"\
- " addi r15, 16, r15 \n"\
- " blink tr0, r63 \n"\
- ".previous")
-
- #if __GNUC__ < 3
- #define MD_INIT_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.init, _init_fallthru)
- #define MD_FINI_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.fini, _fini_fallthru)
- #else
- #define MD_INIT_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.init, init_fallthru)
- #define MD_FINI_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.fini, fini_fallthru)
- #endif
-
- #define MD_INIT_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.init)
- #define MD_FINI_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.fini)
--- 0 ----
Index: lib/csu/sparc64/Makefile
===================================================================
RCS file: /cvsroot/basesrc/lib/csu/sparc64/Makefile,v
retrieving revision 1.5
diff -c -r1.5 Makefile
*** lib/csu/sparc64/Makefile 2001/07/17 18:25:11 1.5
--- lib/csu/sparc64/Makefile 2002/11/22 02:10:17
***************
*** 1,8 ****
# $NetBSD: Makefile,v 1.5 2001/07/17 18:25:11 mrg Exp $
- #Uncomment the next line to enable the new .init fallthru
- CPPFLAGS+= -I- -I${.CURDIR}/../sparc_elf
-
ELFSIZE=64
.include "${.CURDIR}/../common_elf/Makefile.inc"
--- 1,5 ----
Index: lib/csu/sparc64/crti.S
===================================================================
RCS file: crti.S
diff -N crti.S
*** /dev/null Fri Nov 22 04:09:35 2002
--- crti.S Fri Nov 22 04:10:17 2002
***************
*** 0 ****
--- 1,48 ----
+ /* $NetBSD$ */
+
+ /*-
+ * Copyright (c) 2001 Ross Harvey
+ * 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 the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+ #include <machine/asm.h>
+
+ #define MD_SECTION_PROLOGUE(sect, entry_pt) \
+ .section sect,"ax",@progbits ; \
+ \
+ .align 4 ; \
+ .globl entry_pt ; \
+ entry_pt: \
+ save %sp, -176, %sp ; \
+ /* fall thru */
+
+ MD_SECTION_PROLOGUE(.init, _init)
+ MD_SECTION_PROLOGUE(.fini, _fini)
Index: lib/csu/sparc64/crtn.S
===================================================================
RCS file: crtn.S
diff -N crtn.S
*** /dev/null Fri Nov 22 04:09:35 2002
--- crtn.S Fri Nov 22 04:10:17 2002
***************
*** 0 ****
--- 1,44 ----
+ /* $NetBSD$ */
+
+ /*-
+ * Copyright (c) 2001 Ross Harvey
+ * 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 the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+ #include <machine/asm.h>
+
+ #define MD_SECTION_EPILOGUE(sect) \
+ .section sect,"ax",@progbits ; \
+ ret ; \
+ restore
+
+ MD_SECTION_EPILOGUE(.init)
+ MD_SECTION_EPILOGUE(.fini)
Index: lib/csu/sparc_elf/Makefile
===================================================================
RCS file: /cvsroot/basesrc/lib/csu/sparc_elf/Makefile,v
retrieving revision 1.5
diff -c -r1.5 Makefile
*** lib/csu/sparc_elf/Makefile 2001/07/17 18:25:12 1.5
--- lib/csu/sparc_elf/Makefile 2002/11/22 02:10:17
***************
*** 1,6 ****
# $NetBSD: Makefile,v 1.5 2001/07/17 18:25:12 mrg Exp $
- #Uncomment the next line to enable the new .init fallthru
- CPPFLAGS+= -I- -I${.CURDIR}
-
.include "${.CURDIR}/../common_elf/Makefile.inc"
--- 1,3 ----
Index: lib/csu/sparc_elf/crti.S
===================================================================
RCS file: crti.S
diff -N crti.S
*** /dev/null Fri Nov 22 04:09:35 2002
--- crti.S Fri Nov 22 04:10:17 2002
***************
*** 0 ****
--- 1,48 ----
+ /* $NetBSD$ */
+
+ /*-
+ * Copyright (c) 2001 Ross Harvey
+ * 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 the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+ #include <machine/asm.h>
+
+ #define MD_SECTION_PROLOGUE(sect, entry_pt) \
+ .section sect,"ax",@progbits ; \
+ \
+ .align 4 ; \
+ .globl entry_pt ; \
+ entry_pt: \
+ save %sp, -96, %sp ; \
+ /* fall thru */
+
+ MD_SECTION_PROLOGUE(.init, _init)
+ MD_SECTION_PROLOGUE(.fini, _fini)
Index: lib/csu/sparc_elf/crtn.S
===================================================================
RCS file: crtn.S
diff -N crtn.S
*** /dev/null Fri Nov 22 04:09:35 2002
--- crtn.S Fri Nov 22 04:10:17 2002
***************
*** 0 ****
--- 1,44 ----
+ /* $NetBSD$ */
+
+ /*-
+ * Copyright (c) 2001 Ross Harvey
+ * 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 the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+ #include <machine/asm.h>
+
+ #define MD_SECTION_EPILOGUE(sect) \
+ .section sect,"ax",@progbits ; \
+ ret ; \
+ restore
+
+ MD_SECTION_EPILOGUE(.init)
+ MD_SECTION_EPILOGUE(.fini)
Index: lib/csu/sparc_elf/dot_init.h
===================================================================
RCS file: dot_init.h
diff -N dot_init.h
*** /tmp/cvs26522at Fri Nov 22 04:10:24 2002
--- /dev/null Fri Nov 22 04:09:35 2002
***************
*** 1,77 ****
- /* $NetBSD: dot_init.h,v 1.2 2002/09/19 01:24:43 grant Exp $ */
-
- /*-
- * Copyright (c) 2001 Ross Harvey
- * Copyright (c) 2001 Matthew Green
- * 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 the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``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 FOUNDATION OR CONTRIBUTORS
- * 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.
- */
-
- #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-
- /*
- * These must be extern to avoid warnings ("declared static but never defined")
- * However, only the declaration is extern, the actually __asm() defines them
- * as static.
- */
- #define INIT_FALLTHRU_DECL void init_fallthru(void)
- #define FINI_FALLTHRU_DECL void fini_fallthru(void)
-
- #define INIT_FALLTHRU() init_fallthru()
- #define FINI_FALLTHRU() fini_fallthru()
-
- #ifdef __sparc64__
- #define SAVE " save %sp, -176, %sp \n"
- #else
- #define SAVE " save %sp, -96, %sp \n"
- #endif
-
- #define MD_SECTION_PROLOGUE(sect, entry_pt) \
- __asm ( \
- ".section "#sect",\"ax\",@progbits \n"\
- " .align 4 \n"\
- #entry_pt": \n"\
- SAVE \
- " /* fall thru */ \n"\
- ".previous")
-
- #define MD_SECTION_EPILOGUE(sect) \
- __asm ( \
- ".section "#sect",\"ax\",@progbits \n"\
- " .align 4 \n"\
- " ret \n"\
- " restore \n"\
- ".previous")
-
- #define MD_INIT_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.init, init_fallthru)
- #define MD_FINI_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.fini, fini_fallthru)
-
- #define MD_INIT_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.init)
- #define MD_FINI_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.fini)
--- 0 ----
Index: lib/csu/vax_elf/Makefile
===================================================================
RCS file: /cvsroot/basesrc/lib/csu/vax_elf/Makefile,v
retrieving revision 1.2
diff -c -r1.2 Makefile
*** lib/csu/vax_elf/Makefile 2001/07/17 06:45:46 1.2
--- lib/csu/vax_elf/Makefile 2002/11/22 02:10:17
***************
*** 1,4 ****
# $NetBSD: Makefile,v 1.2 2001/07/17 06:45:46 matt Exp $
- CPPFLAGS+= -I- -I${.CURDIR}
.include "${.CURDIR}/../common_elf/Makefile.inc"
--- 1,3 ----
Index: lib/csu/vax_elf/crti.S
===================================================================
RCS file: crti.S
diff -N crti.S
*** /dev/null Fri Nov 22 04:09:35 2002
--- crti.S Fri Nov 22 04:10:17 2002
***************
*** 0 ****
--- 1,48 ----
+ /* $NetBSD$ */
+
+ /*-
+ * Copyright (c) 2001 Ross Harvey
+ * 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 the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+ #include <machine/asm.h>
+
+ #define MD_SECTION_PROLOGUE(sect, entry_pt) \
+ .section sect,"ax",@progbits ; \
+ \
+ .align 1 ; \
+ .globl entry_pt ; \
+ entry_pt: \
+ .word 0 ; \
+ /* fall thru */
+
+ MD_SECTION_PROLOGUE(.init, _init)
+ MD_SECTION_PROLOGUE(.fini, _fini)
Index: lib/csu/vax_elf/crtn.S
===================================================================
RCS file: crtn.S
diff -N crtn.S
*** /dev/null Fri Nov 22 04:09:35 2002
--- crtn.S Fri Nov 22 04:10:17 2002
***************
*** 0 ****
--- 1,43 ----
+ /* $NetBSD$ */
+
+ /*-
+ * Copyright (c) 2001 Ross Harvey
+ * 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 the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+ #include <machine/asm.h>
+
+ #define MD_SECTION_EPILOGUE(sect) \
+ .section sect,"ax",@progbits ; \
+ ret
+
+ MD_SECTION_EPILOGUE(.init)
+ MD_SECTION_EPILOGUE(.fini)
Index: lib/csu/vax_elf/dot_init.h
===================================================================
RCS file: dot_init.h
diff -N dot_init.h
*** /tmp/cvs26522av Fri Nov 22 04:10:24 2002
--- /dev/null Fri Nov 22 04:09:35 2002
***************
*** 1,69 ****
- /* $NetBSD: dot_init.h,v 1.1 2001/07/17 06:45:46 matt Exp $ */
-
- /*-
- * Copyright (c) 2001 Ross Harvey
- * 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 the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``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 FOUNDATION OR CONTRIBUTORS
- * 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.
- */
-
- #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
- #include <machine/asm.h>
-
- /*
- * These must be extern to avoid warnings ("declared static but never defined")
- * However, only the declaration is extern, the actually __asm() defines them
- * as static.
- */
- #define INIT_FALLTHRU_DECL void init_fallthru(void)
- #define FINI_FALLTHRU_DECL void fini_fallthru(void)
-
- #define INIT_FALLTHRU() init_fallthru()
- #define FINI_FALLTHRU() fini_fallthru()
-
- #define MD_SECTION_PROLOGUE(sect, entry_pt) \
- __asm ( \
- ".section "#sect",\"ax\",@progbits \n"\
- " .align 1 \n"\
- #entry_pt": \n"\
- " .word 0 \n"\
- " /* fall thru */ \n"\
- ".previous")
-
- #define MD_SECTION_EPILOGUE(sect) \
- __asm ( \
- ".section "#sect",\"ax\",@progbits \n"\
- "ret \n"\
- ".previous")
-
- #define MD_INIT_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.init, init_fallthru)
- #define MD_FINI_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.fini, fini_fallthru)
-
- #define MD_INIT_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.init)
- #define MD_FINI_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.fini)
--- 0 ----
Index: lib/csu/x86_64/crti.S
===================================================================
RCS file: crti.S
diff -N crti.S
*** /dev/null Fri Nov 22 04:09:35 2002
--- crti.S Fri Nov 22 04:10:18 2002
***************
*** 0 ****
--- 1,48 ----
+ /* $NetBSD$ */
+
+ /*-
+ * Copyright (c) 2001 Ross Harvey
+ * 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 the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+ #include <machine/asm.h>
+
+ /* Placement of the .align _after_ the label is intentional. */
+ #define MD_SECTION_PROLOGUE(sect, entry_pt) \
+ .section sect,"ax",@progbits ; \
+ \
+ .globl entry_pt ; \
+ entry_pt: \
+ .align 16 ; \
+ /* fall thru */
+
+ MD_SECTION_PROLOGUE(.init, _init)
+ MD_SECTION_PROLOGUE(.fini, _fini)
Index: lib/csu/x86_64/crtn.S
===================================================================
RCS file: crtn.S
diff -N crtn.S
*** /dev/null Fri Nov 22 04:09:35 2002
--- crtn.S Fri Nov 22 04:10:18 2002
***************
*** 0 ****
--- 1,43 ----
+ /* $NetBSD$ */
+
+ /*-
+ * Copyright (c) 2001 Ross Harvey
+ * 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 the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+ #include <machine/asm.h>
+
+ #define MD_SECTION_EPILOGUE(sect) \
+ .section sect,"ax",@progbits ; \
+ ret
+
+ MD_SECTION_EPILOGUE(.init)
+ MD_SECTION_EPILOGUE(.fini)
Index: lib/csu/x86_64/dot_init.h
===================================================================
RCS file: /cvsroot/basesrc/lib/csu/x86_64/dot_init.h,v
retrieving revision 1.1
diff -c -r1.1 dot_init.h
*** lib/csu/x86_64/dot_init.h 2002/06/06 19:18:22 1.1
--- lib/csu/x86_64/dot_init.h 2002/11/22 02:10:18
***************
*** 1,69 ****
! /* $NetBSD: dot_init.h,v 1.1 2002/06/06 19:18:22 fvdl Exp $ */
- /*-
- * Copyright (c) 2001 Ross Harvey
- * 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 the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``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 FOUNDATION OR CONTRIBUTORS
- * 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.
- */
-
- #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-
/*
! * These must be extern to avoid warnings ("declared static but never defined")
! * However, only the declaration is extern, the actually __asm() defines them
! * as static.
*/
- #define INIT_FALLTHRU_DECL void init_fallthru(void)
- #define FINI_FALLTHRU_DECL void fini_fallthru(void)
-
- #define INIT_FALLTHRU() init_fallthru()
- #define FINI_FALLTHRU() fini_fallthru()
-
- #define MD_SECTION_PROLOGUE(sect, entry_pt) \
- __asm ( \
- ".section "#sect",\"ax\",@progbits \n"\
- #entry_pt": \n"\
- " .align 16 \n"\
- " /* fall thru */ \n"\
- ".previous")
-
- /* placement of the .align _after_ the label is intentional */
-
- #define MD_SECTION_EPILOGUE(sect) \
- __asm ( \
- ".section "#sect",\"ax\",@progbits \n"\
- " ret \n"\
- ".previous")
-
- #define MD_INIT_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.init, init_fallthru)
- #define MD_FINI_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.fini, fini_fallthru)
! #define MD_INIT_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.init)
! #define MD_FINI_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.fini)
--- 1,9 ----
! /* $NetBSD$ */
/*
! * Written by Jason R. Thorpe, Nov. 2002.
! * Public domain.
*/
! #define CALL_STATIC_FUNCTION(section, func) \
! asm(".section " #section "; call " #func "; .previous");
Index: share/mk/bsd.dep.mk
===================================================================
RCS file: /cvsroot/sharesrc/share/mk/bsd.dep.mk,v
retrieving revision 1.37
diff -c -r1.37 bsd.dep.mk
*** share/mk/bsd.dep.mk 2002/11/10 21:26:45 1.37
--- share/mk/bsd.dep.mk 2002/11/22 02:10:18
***************
*** 15,25 ****
# some of the rules involve .h sources, so remove them from mkdep line
.if defined(SRCS)
! .if defined(HAVE_GCC3)
! __acpp_flags=
! .else
__acpp_flags= -traditional-cpp
! .endif
.NOPATH: .depend
.depend: ${SRCS} ${DPSRCS}
@rm -f .depend
--- 15,25 ----
# some of the rules involve .h sources, so remove them from mkdep line
.if defined(SRCS)
! #.if defined(HAVE_GCC3)
! #__acpp_flags=
! #.else
__acpp_flags= -traditional-cpp
! #.endif
.NOPATH: .depend
.depend: ${SRCS} ${DPSRCS}
@rm -f .depend
Index: share/mk/bsd.lib.mk
===================================================================
RCS file: /cvsroot/sharesrc/share/mk/bsd.lib.mk,v
retrieving revision 1.211
diff -c -r1.211 bsd.lib.mk
*** share/mk/bsd.lib.mk 2002/11/10 21:26:44 1.211
--- share/mk/bsd.lib.mk 2002/11/22 02:10:18
***************
*** 165,172 ****
.if ${OBJECT_FMT} == "ELF"
SHLIB_SOVERSION= ${SHLIB_MAJOR}
SHLIB_SHFLAGS= -soname lib${LIB}.so.${SHLIB_SOVERSION}
! SHLIB_LDSTARTFILE?= ${DESTDIR}/usr/lib/crtbeginS.o
! SHLIB_LDENDFILE?= ${DESTDIR}/usr/lib/crtendS.o
.endif
CFLAGS+= ${COPTS}
--- 165,172 ----
.if ${OBJECT_FMT} == "ELF"
SHLIB_SOVERSION= ${SHLIB_MAJOR}
SHLIB_SHFLAGS= -soname lib${LIB}.so.${SHLIB_SOVERSION}
! SHLIB_LDSTARTFILE?= ${DESTDIR}/usr/lib/crti.o ${DESTDIR}/usr/lib/crtbeginS.o
! SHLIB_LDENDFILE?= ${DESTDIR}/usr/lib/crtendS.o ${DESTDIR}/usr/lib/crtn.o
.endif
CFLAGS+= ${COPTS}
Index: share/mk/bsd.prog.mk
===================================================================
RCS file: /cvsroot/sharesrc/share/mk/bsd.prog.mk,v
retrieving revision 1.161
diff -c -r1.161 bsd.prog.mk
*** share/mk/bsd.prog.mk 2002/11/12 14:33:49 1.161
--- share/mk/bsd.prog.mk 2002/11/22 02:10:19
***************
*** 17,30 ****
CFLAGS+= -mcmodel=medlow
.endif
! # ELF platforms depend on crtbegin.o and crtend.o
.if ${OBJECT_FMT} == "ELF"
.ifndef LIBCRTBEGIN
! LIBCRTBEGIN= ${DESTDIR}/usr/lib/crtbegin.o
.MADE: ${LIBCRTBEGIN}
.endif
.ifndef LIBCRTEND
! LIBCRTEND= ${DESTDIR}/usr/lib/crtend.o
.MADE: ${LIBCRTEND}
.endif
_SHLINKER= ${SHLINKDIR}/ld.elf_so
--- 17,30 ----
CFLAGS+= -mcmodel=medlow
.endif
! # ELF platforms depend on crti.o, crtbegin.o, crtend.o, and crtn.o
.if ${OBJECT_FMT} == "ELF"
.ifndef LIBCRTBEGIN
! LIBCRTBEGIN= ${DESTDIR}/usr/lib/crti.o ${DESTDIR}/usr/lib/crtbegin.o
.MADE: ${LIBCRTBEGIN}
.endif
.ifndef LIBCRTEND
! LIBCRTEND= ${DESTDIR}/usr/lib/crtend.o ${DESTDIR}/usr/lib/crtn.o
.MADE: ${LIBCRTEND}
.endif
_SHLINKER= ${SHLINKDIR}/ld.elf_so
Index: share/mk/sys.mk
===================================================================
RCS file: /cvsroot/sharesrc/share/mk/sys.mk,v
retrieving revision 1.70
diff -c -r1.70 sys.mk
*** share/mk/sys.mk 2002/07/11 15:00:57 1.70
--- share/mk/sys.mk 2002/11/22 02:10:19
***************
*** 16,26 ****
AFLAGS?=
COMPILE.s?= ${CC} ${AFLAGS} -c
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
! .if defined(HAVE_GCC3)
! COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c
! .else
COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
! .endif
LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
CC?= cc
--- 16,26 ----
AFLAGS?=
COMPILE.s?= ${CC} ${AFLAGS} -c
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
! #.if defined(HAVE_GCC3)
! #COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c
! #.else
COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
! #.endif
LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
CC?= cc
--huq684BweRXVnRxX--