CVS commit: src/lib/csu/arch/ia64

2019-05-04 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Sat May  4 22:55:32 UTC 2019

Modified Files:
src/lib/csu/arch/ia64: crt0.S

Log Message:
add stop (;;) to elimate WAW dependency compiler warning


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/csu/arch/ia64/crt0.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/ia64/crt0.S
diff -u src/lib/csu/arch/ia64/crt0.S:1.2 src/lib/csu/arch/ia64/crt0.S:1.3
--- src/lib/csu/arch/ia64/crt0.S:1.2	Mon Nov 26 17:37:45 2018
+++ src/lib/csu/arch/ia64/crt0.S	Sat May  4 22:55:32 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.S,v 1.2 2018/11/26 17:37:45 joerg Exp $ */
+/* $NetBSD: crt0.S,v 1.3 2019/05/04 22:55:32 scole Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-RCSID("$NetBSD: crt0.S,v 1.2 2018/11/26 17:37:45 joerg Exp $")
+RCSID("$NetBSD: crt0.S,v 1.3 2019/05/04 22:55:32 scole Exp $")
 
 STRONG_ALIAS(_start,__start)
 	
@@ -53,5 +53,6 @@ __start:
 	mov sp = in3 /* Setup Memory Stack Pointer. */
 	mov in1 = in2 /* obj is no longer used. */
 	alloc r31 = ar.pfs, 3, 0, 0, 0 /* Adjust backingstore for ___start() */
+	;;
 	br.call.sptk.many rp = ___start
 



CVS commit: src/lib/csu/arch/riscv

2019-02-09 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sun Feb 10 07:28:06 UTC 2019

Modified Files:
src/lib/csu/arch/riscv: crti.S crtn.S

Log Message:
Update comment (copied from or1k)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/riscv/crti.S \
src/lib/csu/arch/riscv/crtn.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/riscv/crti.S
diff -u src/lib/csu/arch/riscv/crti.S:1.1 src/lib/csu/arch/riscv/crti.S:1.2
--- src/lib/csu/arch/riscv/crti.S:1.1	Fri Sep 19 17:36:25 2014
+++ src/lib/csu/arch/riscv/crti.S	Sun Feb 10 07:28:06 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: crti.S,v 1.1 2014/09/19 17:36:25 matt Exp $ */
+/* $NetBSD: crti.S,v 1.2 2019/02/10 07:28:06 maya Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,11 +31,11 @@
 
 #include 
 
-RCSID("$NetBSD: crti.S,v 1.1 2014/09/19 17:36:25 matt Exp $")
+RCSID("$NetBSD: crti.S,v 1.2 2019/02/10 07:28:06 maya Exp $")
 
 #include "sysident.S"
 
 /*
- * Since OR1K for NetBSD uses .init_array/.fini_array,
+ * Since RISC-V for NetBSD uses .init_array/.fini_array,
  * there is no need for .init/.fini
  */
Index: src/lib/csu/arch/riscv/crtn.S
diff -u src/lib/csu/arch/riscv/crtn.S:1.1 src/lib/csu/arch/riscv/crtn.S:1.2
--- src/lib/csu/arch/riscv/crtn.S:1.1	Fri Sep 19 17:36:25 2014
+++ src/lib/csu/arch/riscv/crtn.S	Sun Feb 10 07:28:06 2019
@@ -1,3 +1,3 @@
-/* $NetBSD: crtn.S,v 1.1 2014/09/19 17:36:25 matt Exp $ */
+/* $NetBSD: crtn.S,v 1.2 2019/02/10 07:28:06 maya Exp $ */
 
-/* no need for anything here since OR1K for NetBSD uses .init_array/.fini_array */
+/* no need for anything here since RISC-V for NetBSD uses .init_array/.fini_array */



CVS commit: src/lib/csu

2019-01-26 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jan 27 04:35:25 UTC 2019

Modified Files:
src/lib/csu: Makefile

Log Message:
fix duplicated chunk from merge


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/lib/csu/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/Makefile
diff -u src/lib/csu/Makefile:1.38 src/lib/csu/Makefile:1.39
--- src/lib/csu/Makefile:1.38	Sun Jan 27 02:08:35 2019
+++ src/lib/csu/Makefile	Sun Jan 27 04:35:25 2019
@@ -1,7 +1,4 @@
-#	$NetBSD: Makefile,v 1.38 2019/01/27 02:08:35 pgoyette Exp $
-
-NOLIBCSANITIZER=	# defined
-NOSANITIZER=		# defined
+#	$NetBSD: Makefile,v 1.39 2019/01/27 04:35:25 dholland Exp $
 
 NOLIBCSANITIZER=	# defined
 NOSANITIZER=		# defined



CVS commit: src/lib/csu/common

2018-12-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 28 20:12:35 UTC 2018

Modified Files:
src/lib/csu/common: crt0-common.c

Log Message:
Re-do previous (always make available preinit/initarray/finiarray), with
less disruption.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/lib/csu/common/crt0-common.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/crt0-common.c
diff -u src/lib/csu/common/crt0-common.c:1.22 src/lib/csu/common/crt0-common.c:1.23
--- src/lib/csu/common/crt0-common.c:1.22	Fri Dec 28 13:17:11 2018
+++ src/lib/csu/common/crt0-common.c	Fri Dec 28 15:12:35 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0-common.c,v 1.22 2018/12/28 18:17:11 christos Exp $ */
+/* $NetBSD: crt0-common.c,v 1.23 2018/12/28 20:12:35 christos Exp $ */
 
 /*
  * Copyright (c) 1998 Christos Zoulas
@@ -36,7 +36,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: crt0-common.c,v 1.22 2018/12/28 18:17:11 christos Exp $");
+__RCSID("$NetBSD: crt0-common.c,v 1.23 2018/12/28 20:12:35 christos Exp $");
 
 #include 
 #include 
@@ -48,9 +48,8 @@ __RCSID("$NetBSD: crt0-common.c,v 1.22 2
 
 extern int main(int, char **, char **);
 
-#ifdef HAVE_INITFINI_ARRAY
 typedef void (*fptr_t)(void);
-#else
+#ifndef HAVE_INITFINI_ARRAY
 extern void	_init(void);
 extern void	_fini(void);
 #endif
@@ -87,7 +86,6 @@ do {		\
 	_exit(1);\
 } while (0)
 
-#ifdef HAVE_INITFINI_ARRAY
 /*
  * If we are using INIT_ARRAY/FINI_ARRAY and we are linked statically,
  * we have to process these instead of relying on RTLD to do it for us.
@@ -111,7 +109,7 @@ _preinit(void)
 }
 
 static inline void
-_init(void)
+_initarray(void)
 {
 	for (const fptr_t *f = __init_array_start; f < __init_array_end; f++) {
 		(*f)();
@@ -119,13 +117,12 @@ _init(void)
 }
 
 static void
-_fini(void)
+_finiarray(void)
 {
 	for (const fptr_t *f = __fini_array_start; f < __fini_array_end; f++) {
 		(*f)();
 	}
 }
-#endif /* HAVE_INITFINI_ARRAY */
 
 #if defined(__x86_64__) || defined(__powerpc__) || defined(__sparc__)
 #define HAS_IPLTA
@@ -327,17 +324,20 @@ ___start(void (*cleanup)(void),			/* fro
 #endif
 	}
 
-#ifdef HAVE_INITFINI_ARRAY
 	_preinit();
-#endif
 
 #ifdef MCRT0
 	atexit(_mcleanup);
 	monstartup((u_long)&__eprol, (u_long)&__etext);
 #endif
 
+	atexit(_finiarray);
+	_initarray();
+
+#ifndef HAVE_INITFINI_ARRAY
 	atexit(_fini);
 	_init();
+#endif
 
 	exit(main(ps_strings->ps_nargvstr, ps_strings->ps_argvstr, environ));
 }



CVS commit: src/lib/csu

2018-12-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 28 18:17:11 UTC 2018

Modified Files:
src/lib/csu/arch/aarch64: Makefile.inc
src/lib/csu/arch/arm: Makefile.inc
src/lib/csu/arch/earm: Makefile.inc
src/lib/csu/arch/or1k: Makefile.inc
src/lib/csu/arch/riscv: Makefile.inc
src/lib/csu/common: Makefile.inc crt0-common.c crtbegin.c

Log Message:
Undo previous; breaks macppc/m68k (at least)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/csu/arch/aarch64/Makefile.inc
cvs rdiff -u -r1.8 -r1.9 src/lib/csu/arch/arm/Makefile.inc
cvs rdiff -u -r1.4 -r1.5 src/lib/csu/arch/earm/Makefile.inc
cvs rdiff -u -r1.2 -r1.3 src/lib/csu/arch/or1k/Makefile.inc
cvs rdiff -u -r1.2 -r1.3 src/lib/csu/arch/riscv/Makefile.inc
cvs rdiff -u -r1.34 -r1.35 src/lib/csu/common/Makefile.inc
cvs rdiff -u -r1.21 -r1.22 src/lib/csu/common/crt0-common.c
cvs rdiff -u -r1.16 -r1.17 src/lib/csu/common/crtbegin.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/aarch64/Makefile.inc
diff -u src/lib/csu/arch/aarch64/Makefile.inc:1.2 src/lib/csu/arch/aarch64/Makefile.inc:1.3
--- src/lib/csu/arch/aarch64/Makefile.inc:1.2	Thu Dec 27 13:57:14 2018
+++ src/lib/csu/arch/aarch64/Makefile.inc	Fri Dec 28 13:17:10 2018
@@ -1,4 +1,5 @@
-# $NetBSD: Makefile.inc,v 1.2 2018/12/27 18:57:14 christos Exp $
+# $NetBSD: Makefile.inc,v 1.3 2018/12/28 18:17:10 christos Exp $
 
 CPPFLAGS+=	-I${ARCHDIR}
+CPPFLAGS+=	-DHAVE_INITFINI_ARRAY
 #CPPFLAGS+=	-DELF_NOTE_MARCH_DESC=\"${CSU_MACHINE_ARCH}\"

Index: src/lib/csu/arch/arm/Makefile.inc
diff -u src/lib/csu/arch/arm/Makefile.inc:1.8 src/lib/csu/arch/arm/Makefile.inc:1.9
--- src/lib/csu/arch/arm/Makefile.inc:1.8	Thu Dec 27 13:57:15 2018
+++ src/lib/csu/arch/arm/Makefile.inc	Fri Dec 28 13:17:10 2018
@@ -1,4 +1,7 @@
-# $NetBSD: Makefile.inc,v 1.8 2018/12/27 18:57:15 christos Exp $
+# $NetBSD: Makefile.inc,v 1.9 2018/12/28 18:17:10 christos Exp $
 
 CPPFLAGS+=	-I${ARCHDIR}
+.if (!empty(CPUFLAGS) && ${CPUFLAGS:M-mabi=aapcs*} != "")
+CPPFLAGS+=  -DHAVE_INITFINI_ARRAY
+.endif
 CPPFLAGS+=	-DELF_NOTE_MARCH_DESC=\"${CSU_MACHINE_ARCH}\"

Index: src/lib/csu/arch/earm/Makefile.inc
diff -u src/lib/csu/arch/earm/Makefile.inc:1.4 src/lib/csu/arch/earm/Makefile.inc:1.5
--- src/lib/csu/arch/earm/Makefile.inc:1.4	Thu Dec 27 13:57:15 2018
+++ src/lib/csu/arch/earm/Makefile.inc	Fri Dec 28 13:17:10 2018
@@ -1,4 +1,5 @@
-# $NetBSD: Makefile.inc,v 1.4 2018/12/27 18:57:15 christos Exp $
+# $NetBSD: Makefile.inc,v 1.5 2018/12/28 18:17:10 christos Exp $
 
 CPPFLAGS+=	-I${ARCHDIR}
+CPPFLAGS+=	-DHAVE_INITFINI_ARRAY
 CPPFLAGS+=	-DELF_NOTE_MARCH_DESC=\"${CSU_MACHINE_ARCH}\"

Index: src/lib/csu/arch/or1k/Makefile.inc
diff -u src/lib/csu/arch/or1k/Makefile.inc:1.2 src/lib/csu/arch/or1k/Makefile.inc:1.3
--- src/lib/csu/arch/or1k/Makefile.inc:1.2	Thu Dec 27 13:57:15 2018
+++ src/lib/csu/arch/or1k/Makefile.inc	Fri Dec 28 13:17:11 2018
@@ -1,4 +1,5 @@
-# $NetBSD: Makefile.inc,v 1.2 2018/12/27 18:57:15 christos Exp $
+# $NetBSD: Makefile.inc,v 1.3 2018/12/28 18:17:11 christos Exp $
 
 CPPFLAGS+=	-I${ARCHDIR}
+CPPFLAGS+=	-DHAVE_INITFINI_ARRAY
 #CPPFLAGS+=	-DELF_NOTE_MARCH_DESC=\"${CSU_MACHINE_ARCH}\"

Index: src/lib/csu/arch/riscv/Makefile.inc
diff -u src/lib/csu/arch/riscv/Makefile.inc:1.2 src/lib/csu/arch/riscv/Makefile.inc:1.3
--- src/lib/csu/arch/riscv/Makefile.inc:1.2	Thu Dec 27 13:57:15 2018
+++ src/lib/csu/arch/riscv/Makefile.inc	Fri Dec 28 13:17:11 2018
@@ -1,4 +1,5 @@
-# $NetBSD: Makefile.inc,v 1.2 2018/12/27 18:57:15 christos Exp $
+# $NetBSD: Makefile.inc,v 1.3 2018/12/28 18:17:11 christos Exp $
 
 CPPFLAGS+=	-I${ARCHDIR}
+CPPFLAGS+=	-DHAVE_INITFINI_ARRAY
 #CPPFLAGS+=	-DELF_NOTE_MARCH_DESC=\"${CSU_MACHINE_ARCH}\"

Index: src/lib/csu/common/Makefile.inc
diff -u src/lib/csu/common/Makefile.inc:1.34 src/lib/csu/common/Makefile.inc:1.35
--- src/lib/csu/common/Makefile.inc:1.34	Thu Dec 27 13:57:15 2018
+++ src/lib/csu/common/Makefile.inc	Fri Dec 28 13:17:11 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.34 2018/12/27 18:57:15 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.35 2018/12/28 18:17:11 christos Exp $
 
 .include 
 
@@ -9,7 +9,6 @@ COMMON_DIR:=	${.CURDIR}/common
 .PATH:		${COMMON_DIR}
 
 CPPFLAGS+=	-I${COMMON_DIR} -I.
-CPPFLAGS+=	-DHAVE_INITFINI_ARRAY
 
 OBJS+=		crt0.o gcrt0.o crti.o crtn.o
 OBJS+=		crtbegin.o crtend.o

Index: src/lib/csu/common/crt0-common.c
diff -u src/lib/csu/common/crt0-common.c:1.21 src/lib/csu/common/crt0-common.c:1.22
--- src/lib/csu/common/crt0-common.c:1.21	Thu Dec 27 14:32:32 2018
+++ src/lib/csu/common/crt0-common.c	Fri Dec 28 13:17:11 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0-common.c,v 1.21 2018/12/27 19:32:32 christos Exp $ */
+/* $NetBSD: crt0-common.c,v 1.22 2018/12/28 18:17:11 christos Exp $ */
 
 /*
  * Copyright (c) 1998 Christos Zoulas
@@ -36,7 +36,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: crt0-common.c,v 1.21 2018/12/27 

CVS commit: src/lib/csu/common

2018-12-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Dec 28 13:53:17 UTC 2018

Modified Files:
src/lib/csu/common: crtbegin.c

Log Message:
Avoid duplicate definitions on arm (reported by kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/lib/csu/common/crtbegin.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/crtbegin.c
diff -u src/lib/csu/common/crtbegin.c:1.15 src/lib/csu/common/crtbegin.c:1.16
--- src/lib/csu/common/crtbegin.c:1.15	Thu Dec 27 14:32:32 2018
+++ src/lib/csu/common/crtbegin.c	Fri Dec 28 08:53:17 2018
@@ -27,7 +27,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: crtbegin.c,v 1.15 2018/12/27 19:32:32 christos Exp $");
+__RCSID("$NetBSD: crtbegin.c,v 1.16 2018/12/28 13:53:17 christos Exp $");
 
 #include "crtbegin.h"
 
@@ -38,12 +38,14 @@ __dso_hidden const fptr_t __JCR_LIST__[0
 __weakref_visible void Jv_RegisterClasses(const fptr_t *)
 	__weak_reference(_Jv_RegisterClasses);
 
+#if !defined(HAVE_INITFINI_ARRAY)
 extern __dso_hidden const fptr_t __CTOR_LIST__start __asm("__CTOR_LIST__");
 
 __dso_hidden const fptr_t __aligned(sizeof(void *)) __CTOR_LIST__[] __section(".ctors") = {
 	(fptr_t) -1,
 };
 __dso_hidden extern const fptr_t __CTOR_LIST_END__[];
+#endif
 
 #ifdef SHARED
 __dso_hidden void *__dso_handle = &__dso_handle;



CVS commit: src/lib/csu/common

2018-12-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Dec 27 19:32:32 UTC 2018

Modified Files:
src/lib/csu/common: crt0-common.c crtbegin.c

Log Message:
Allow both array and non-array constructors for transition.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/lib/csu/common/crt0-common.c
cvs rdiff -u -r1.14 -r1.15 src/lib/csu/common/crtbegin.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/crt0-common.c
diff -u src/lib/csu/common/crt0-common.c:1.20 src/lib/csu/common/crt0-common.c:1.21
--- src/lib/csu/common/crt0-common.c:1.20	Mon Nov 26 12:37:46 2018
+++ src/lib/csu/common/crt0-common.c	Thu Dec 27 14:32:32 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0-common.c,v 1.20 2018/11/26 17:37:46 joerg Exp $ */
+/* $NetBSD: crt0-common.c,v 1.21 2018/12/27 19:32:32 christos Exp $ */
 
 /*
  * Copyright (c) 1998 Christos Zoulas
@@ -36,7 +36,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: crt0-common.c,v 1.20 2018/11/26 17:37:46 joerg Exp $");
+__RCSID("$NetBSD: crt0-common.c,v 1.21 2018/12/27 19:32:32 christos Exp $");
 
 #include 
 #include 
@@ -50,10 +50,9 @@ extern int main(int, char **, char **);
 
 #ifdef HAVE_INITFINI_ARRAY
 typedef void (*fptr_t)(void);
-#else
+#endif
 extern void	_init(void);
 extern void	_fini(void);
-#endif
 extern void	_libc_init(void);
 
 /*
@@ -111,7 +110,7 @@ _preinit(void)
 }
 
 static inline void
-_init(void)
+_initarray(void)
 {
 	for (const fptr_t *f = __init_array_start; f < __init_array_end; f++) {
 		(*f)();
@@ -119,7 +118,7 @@ _init(void)
 }
 
 static void
-_fini(void)
+_finiarray(void)
 {
 	for (const fptr_t *f = __fini_array_start; f < __fini_array_end; f++) {
 		(*f)();
@@ -337,6 +336,10 @@ ___start(void (*cleanup)(void),			/* fro
 #endif
 
 	atexit(_fini);
+#ifdef HAVE_INITFINI_ARRAY
+	atexit(_finiarray);
+	_initarray();
+#endif
 	_init();
 
 	exit(main(ps_strings->ps_nargvstr, ps_strings->ps_argvstr, environ));

Index: src/lib/csu/common/crtbegin.c
diff -u src/lib/csu/common/crtbegin.c:1.14 src/lib/csu/common/crtbegin.c:1.15
--- src/lib/csu/common/crtbegin.c:1.14	Tue Jul 18 10:34:19 2017
+++ src/lib/csu/common/crtbegin.c	Thu Dec 27 14:32:32 2018
@@ -27,7 +27,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: crtbegin.c,v 1.14 2017/07/18 14:34:19 joerg Exp $");
+__RCSID("$NetBSD: crtbegin.c,v 1.15 2018/12/27 19:32:32 christos Exp $");
 
 #include "crtbegin.h"
 
@@ -38,14 +38,12 @@ __dso_hidden const fptr_t __JCR_LIST__[0
 __weakref_visible void Jv_RegisterClasses(const fptr_t *)
 	__weak_reference(_Jv_RegisterClasses);
 
-#if !defined(HAVE_INITFINI_ARRAY)
 extern __dso_hidden const fptr_t __CTOR_LIST__start __asm("__CTOR_LIST__");
 
 __dso_hidden const fptr_t __aligned(sizeof(void *)) __CTOR_LIST__[] __section(".ctors") = {
 	(fptr_t) -1,
 };
 __dso_hidden extern const fptr_t __CTOR_LIST_END__[];
-#endif
 
 #ifdef SHARED
 __dso_hidden void *__dso_handle = &__dso_handle;



CVS commit: src/lib/csu

2018-12-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Dec 27 18:57:15 UTC 2018

Modified Files:
src/lib/csu/arch/aarch64: Makefile.inc
src/lib/csu/arch/arm: Makefile.inc
src/lib/csu/arch/earm: Makefile.inc
src/lib/csu/arch/or1k: Makefile.inc
src/lib/csu/arch/riscv: Makefile.inc
src/lib/csu/common: Makefile.inc

Log Message:
Enable initfini array support for everyone.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/aarch64/Makefile.inc
cvs rdiff -u -r1.7 -r1.8 src/lib/csu/arch/arm/Makefile.inc
cvs rdiff -u -r1.3 -r1.4 src/lib/csu/arch/earm/Makefile.inc
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/or1k/Makefile.inc
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/riscv/Makefile.inc
cvs rdiff -u -r1.33 -r1.34 src/lib/csu/common/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/aarch64/Makefile.inc
diff -u src/lib/csu/arch/aarch64/Makefile.inc:1.1 src/lib/csu/arch/aarch64/Makefile.inc:1.2
--- src/lib/csu/arch/aarch64/Makefile.inc:1.1	Sun Aug 10 01:47:36 2014
+++ src/lib/csu/arch/aarch64/Makefile.inc	Thu Dec 27 13:57:14 2018
@@ -1,5 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.1 2014/08/10 05:47:36 matt Exp $
+# $NetBSD: Makefile.inc,v 1.2 2018/12/27 18:57:14 christos Exp $
 
 CPPFLAGS+=	-I${ARCHDIR}
-CPPFLAGS+=	-DHAVE_INITFINI_ARRAY
 #CPPFLAGS+=	-DELF_NOTE_MARCH_DESC=\"${CSU_MACHINE_ARCH}\"

Index: src/lib/csu/arch/arm/Makefile.inc
diff -u src/lib/csu/arch/arm/Makefile.inc:1.7 src/lib/csu/arch/arm/Makefile.inc:1.8
--- src/lib/csu/arch/arm/Makefile.inc:1.7	Tue Sep 10 18:00:01 2013
+++ src/lib/csu/arch/arm/Makefile.inc	Thu Dec 27 13:57:15 2018
@@ -1,7 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.7 2013/09/10 22:00:01 matt Exp $
+# $NetBSD: Makefile.inc,v 1.8 2018/12/27 18:57:15 christos Exp $
 
 CPPFLAGS+=	-I${ARCHDIR}
-.if (!empty(CPUFLAGS) && ${CPUFLAGS:M-mabi=aapcs*} != "")
-CPPFLAGS+=  -DHAVE_INITFINI_ARRAY
-.endif
 CPPFLAGS+=	-DELF_NOTE_MARCH_DESC=\"${CSU_MACHINE_ARCH}\"

Index: src/lib/csu/arch/earm/Makefile.inc
diff -u src/lib/csu/arch/earm/Makefile.inc:1.3 src/lib/csu/arch/earm/Makefile.inc:1.4
--- src/lib/csu/arch/earm/Makefile.inc:1.3	Tue Sep 10 12:45:33 2013
+++ src/lib/csu/arch/earm/Makefile.inc	Thu Dec 27 13:57:15 2018
@@ -1,5 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.3 2013/09/10 16:45:33 matt Exp $
+# $NetBSD: Makefile.inc,v 1.4 2018/12/27 18:57:15 christos Exp $
 
 CPPFLAGS+=	-I${ARCHDIR}
-CPPFLAGS+=	-DHAVE_INITFINI_ARRAY
 CPPFLAGS+=	-DELF_NOTE_MARCH_DESC=\"${CSU_MACHINE_ARCH}\"

Index: src/lib/csu/arch/or1k/Makefile.inc
diff -u src/lib/csu/arch/or1k/Makefile.inc:1.1 src/lib/csu/arch/or1k/Makefile.inc:1.2
--- src/lib/csu/arch/or1k/Makefile.inc:1.1	Wed Sep  3 15:34:25 2014
+++ src/lib/csu/arch/or1k/Makefile.inc	Thu Dec 27 13:57:15 2018
@@ -1,5 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.1 2014/09/03 19:34:25 matt Exp $
+# $NetBSD: Makefile.inc,v 1.2 2018/12/27 18:57:15 christos Exp $
 
 CPPFLAGS+=	-I${ARCHDIR}
-CPPFLAGS+=	-DHAVE_INITFINI_ARRAY
 #CPPFLAGS+=	-DELF_NOTE_MARCH_DESC=\"${CSU_MACHINE_ARCH}\"

Index: src/lib/csu/arch/riscv/Makefile.inc
diff -u src/lib/csu/arch/riscv/Makefile.inc:1.1 src/lib/csu/arch/riscv/Makefile.inc:1.2
--- src/lib/csu/arch/riscv/Makefile.inc:1.1	Fri Sep 19 13:36:25 2014
+++ src/lib/csu/arch/riscv/Makefile.inc	Thu Dec 27 13:57:15 2018
@@ -1,5 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.1 2014/09/19 17:36:25 matt Exp $
+# $NetBSD: Makefile.inc,v 1.2 2018/12/27 18:57:15 christos Exp $
 
 CPPFLAGS+=	-I${ARCHDIR}
-CPPFLAGS+=	-DHAVE_INITFINI_ARRAY
 #CPPFLAGS+=	-DELF_NOTE_MARCH_DESC=\"${CSU_MACHINE_ARCH}\"

Index: src/lib/csu/common/Makefile.inc
diff -u src/lib/csu/common/Makefile.inc:1.33 src/lib/csu/common/Makefile.inc:1.34
--- src/lib/csu/common/Makefile.inc:1.33	Mon Nov 26 12:37:46 2018
+++ src/lib/csu/common/Makefile.inc	Thu Dec 27 13:57:15 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.33 2018/11/26 17:37:46 joerg Exp $
+#	$NetBSD: Makefile.inc,v 1.34 2018/12/27 18:57:15 christos Exp $
 
 .include 
 
@@ -9,6 +9,7 @@ COMMON_DIR:=	${.CURDIR}/common
 .PATH:		${COMMON_DIR}
 
 CPPFLAGS+=	-I${COMMON_DIR} -I.
+CPPFLAGS+=	-DHAVE_INITFINI_ARRAY
 
 OBJS+=		crt0.o gcrt0.o crti.o crtn.o
 OBJS+=		crtbegin.o crtend.o



CVS commit: src/lib/csu

2018-11-26 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Nov 26 17:37:46 UTC 2018

Modified Files:
src/lib/csu/arch/aarch64: crt0.S
src/lib/csu/arch/alpha: crt0.S
src/lib/csu/arch/arm: crt0.S
src/lib/csu/arch/earm: crt0.S
src/lib/csu/arch/hppa: crt0.S
src/lib/csu/arch/i386: crt0.S
src/lib/csu/arch/ia64: crt0.S
src/lib/csu/arch/m68k: crt0.S
src/lib/csu/arch/mips: crt0.S
src/lib/csu/arch/or1k: crt0.S
src/lib/csu/arch/powerpc: crt0.S
src/lib/csu/arch/riscv: crt0.S
src/lib/csu/arch/sh3: crt0.S
src/lib/csu/arch/sparc: crt0.S
src/lib/csu/arch/sparc64: crt0.S
src/lib/csu/arch/vax: crt0.S
src/lib/csu/arch/x86_64: crt0.S
src/lib/csu/common: Makefile.inc crt0-common.c

Log Message:
Do not pass the main object handle from the assembler startup stub to
the common ___start routine. It's only used for a pointless magic
version check. Thanks to martin@ for testing various architectures.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/aarch64/crt0.S
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/alpha/crt0.S
cvs rdiff -u -r1.3 -r1.4 src/lib/csu/arch/arm/crt0.S
cvs rdiff -u -r1.3 -r1.4 src/lib/csu/arch/earm/crt0.S
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/hppa/crt0.S
cvs rdiff -u -r1.3 -r1.4 src/lib/csu/arch/i386/crt0.S
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/ia64/crt0.S
cvs rdiff -u -r1.4 -r1.5 src/lib/csu/arch/m68k/crt0.S
cvs rdiff -u -r1.3 -r1.4 src/lib/csu/arch/mips/crt0.S
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/or1k/crt0.S
cvs rdiff -u -r1.6 -r1.7 src/lib/csu/arch/powerpc/crt0.S
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/riscv/crt0.S
cvs rdiff -u -r1.6 -r1.7 src/lib/csu/arch/sh3/crt0.S
cvs rdiff -u -r1.2 -r1.3 src/lib/csu/arch/sparc/crt0.S
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/sparc64/crt0.S
cvs rdiff -u -r1.3 -r1.4 src/lib/csu/arch/vax/crt0.S
cvs rdiff -u -r1.3 -r1.4 src/lib/csu/arch/x86_64/crt0.S
cvs rdiff -u -r1.32 -r1.33 src/lib/csu/common/Makefile.inc
cvs rdiff -u -r1.19 -r1.20 src/lib/csu/common/crt0-common.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/aarch64/crt0.S
diff -u src/lib/csu/arch/aarch64/crt0.S:1.1 src/lib/csu/arch/aarch64/crt0.S:1.2
--- src/lib/csu/arch/aarch64/crt0.S:1.1	Sun Aug 10 05:47:36 2014
+++ src/lib/csu/arch/aarch64/crt0.S	Mon Nov 26 17:37:44 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: crt0.S,v 1.1 2014/08/10 05:47:36 matt Exp $	*/
+/*	$NetBSD: crt0.S,v 1.2 2018/11/26 17:37:44 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,14 +31,15 @@
 
 #include 
 
-RCSID("$NetBSD: crt0.S,v 1.1 2014/08/10 05:47:36 matt Exp $")
+RCSID("$NetBSD: crt0.S,v 1.2 2018/11/26 17:37:44 joerg Exp $")
 
 STRONG_ALIAS(_start,__start)
 
 _ENTRY(__start)
 	/*
-	 * void ___start(void (*cleanup)(void), const Obj_Entry *obj,
+	 * void ___start(void (*cleanup)(void),
 	 *struct ps_strings *ps_strings);
 	 */
+	mov	x1, x2
 	b	___start
 END(__start)

Index: src/lib/csu/arch/alpha/crt0.S
diff -u src/lib/csu/arch/alpha/crt0.S:1.1 src/lib/csu/arch/alpha/crt0.S:1.2
--- src/lib/csu/arch/alpha/crt0.S:1.1	Thu Jul 11 16:40:27 2013
+++ src/lib/csu/arch/alpha/crt0.S	Mon Nov 26 17:37:44 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.S,v 1.1 2013/07/11 16:40:27 matt Exp $ */
+/* $NetBSD: crt0.S,v 1.2 2018/11/26 17:37:44 joerg Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-RCSID("$NetBSD: crt0.S,v 1.1 2013/07/11 16:40:27 matt Exp $")
+RCSID("$NetBSD: crt0.S,v 1.2 2018/11/26 17:37:44 joerg Exp $")
 
 STRONG_ALIAS(_start,__start)
 
@@ -48,7 +48,6 @@ STRONG_ALIAS(_start,__start)
 LEAF(__start, 4)
 	LDGP(pv)
 	mov	a1, a0		/* cleanup */
-	mov	a2, a1		/* Obj_Entry */
-	mov	a3, a2		/* ps_strings */
+	mov	a3, a1		/* ps_strings */
 	CALL(___start)
 END(__start)

Index: src/lib/csu/arch/arm/crt0.S
diff -u src/lib/csu/arch/arm/crt0.S:1.3 src/lib/csu/arch/arm/crt0.S:1.4
--- src/lib/csu/arch/arm/crt0.S:1.3	Sat Aug 11 07:25:44 2012
+++ src/lib/csu/arch/arm/crt0.S	Mon Nov 26 17:37:44 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: crt0.S,v 1.3 2012/08/11 07:25:44 matt Exp $	*/
+/*	$NetBSD: crt0.S,v 1.4 2018/11/26 17:37:44 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -31,24 +31,23 @@
 
 #include 
 
-RCSID("$NetBSD: crt0.S,v 1.3 2012/08/11 07:25:44 matt Exp $")
+RCSID("$NetBSD: crt0.S,v 1.4 2018/11/26 17:37:44 joerg Exp $")
 
 STRONG_ALIAS(_start,__start)
 
 _ENTRY(__start)
 	/*
-	 * We need to swap ps_strings and cleanup
+	 * ps_strings is passed in r0 and cleanup in r2.
+	 * It should be ps_string in r1 and cleanup in r0.
  	 */
-	mov	ip, r0		/* ps_strings -> tmp */
-	mov	r0, r2		/* cleanup -> ps_strings */
-	mov	r2, ip		/* tmp -> ps_strings */
+	mov	r1, r0
+	mov	r0, r2
 
 	/* Ensure the stack is properly aligned before calling C code. */
 	bic	sp, sp, #7
 
 	/*
 	 * void 

CVS commit: src/lib/csu

2018-07-25 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jul 26 01:25:23 UTC 2018

Modified Files:
src/lib/csu: Makefile

Log Message:
Specify NOLIBCSANITIZER in lib/csu

The low-level libraries in csu are used in non-sanitized code.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/lib/csu/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/Makefile
diff -u src/lib/csu/Makefile:1.36 src/lib/csu/Makefile:1.37
--- src/lib/csu/Makefile:1.36	Sat Jun 16 18:58:00 2018
+++ src/lib/csu/Makefile	Thu Jul 26 01:25:23 2018
@@ -1,5 +1,6 @@
-#	$NetBSD: Makefile,v 1.36 2018/06/16 18:58:00 kamil Exp $
+#	$NetBSD: Makefile,v 1.37 2018/07/26 01:25:23 kamil Exp $
 
+NOLIBCSANITIZER=	# defined
 NOSANITIZER=		# defined
 
 .include 



CVS commit: src/lib/csu/common

2018-07-12 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Jul 13 01:00:17 UTC 2018

Modified Files:
src/lib/csu/common: crt0-common.c

Log Message:
i386/amd64 build fix.   Fix "possibly used uninitialized" from gcc.
These changes should make no practical effect - but because external
data is being examined, it would be possible to contrive a situation
(perhaps) where uninit'd vars could actually be used (unless the format
has been checked elsewhere earlier - I did not look ... we have to
appease gcc anyway).

Joerg: Please review (& fix)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/lib/csu/common/crt0-common.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/crt0-common.c
diff -u src/lib/csu/common/crt0-common.c:1.18 src/lib/csu/common/crt0-common.c:1.19
--- src/lib/csu/common/crt0-common.c:1.18	Thu Jul 12 21:36:45 2018
+++ src/lib/csu/common/crt0-common.c	Fri Jul 13 01:00:17 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0-common.c,v 1.18 2018/07/12 21:36:45 joerg Exp $ */
+/* $NetBSD: crt0-common.c,v 1.19 2018/07/13 01:00:17 kre Exp $ */
 
 /*
  * Copyright (c) 1998 Christos Zoulas
@@ -36,7 +36,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: crt0-common.c,v 1.18 2018/07/12 21:36:45 joerg Exp $");
+__RCSID("$NetBSD: crt0-common.c,v 1.19 2018/07/13 01:00:17 kre Exp $");
 
 #include 
 #include 
@@ -214,9 +214,9 @@ relocate_self(struct ps_strings *ps_stri
 {
 	AuxInfo *aux = (AuxInfo *)(ps_strings->ps_argvstr + ps_strings->ps_nargvstr +
 	ps_strings->ps_nenvstr + 2);
-	uintptr_t relocbase;
-	const Elf_Phdr *phdr;
-	Elf_Half phnum;
+	uintptr_t relocbase = (uintptr_t)~0U;
+	const Elf_Phdr *phdr = NULL;
+	Elf_Half phnum = (Elf_Half)~0;
 
 	for (; aux->a_type != AT_NULL; ++aux) {
 		switch (aux->a_type) {
@@ -232,7 +232,11 @@ relocate_self(struct ps_strings *ps_stri
 			break;
 		}
 	}
-	const Elf_Phdr *phlimit = phdr + phnum, *dynphdr;
+
+	if (phdr == NULL || phnum == (Elf_Half)~0)
+		return;
+
+	const Elf_Phdr *phlimit = phdr + phnum, *dynphdr = NULL;
 
 	for (; phdr < phlimit; ++phdr) {
 		if (phdr->p_type == PT_DYNAMIC)
@@ -240,6 +244,9 @@ relocate_self(struct ps_strings *ps_stri
 		if (phdr->p_type == PT_PHDR)
 			relocbase = (uintptr_t)phdr - phdr->p_vaddr;
 	}
+	if (dynphdr == NULL || relocbase == (uintptr_t)~0U)
+		return;
+
 	Elf_Dyn *dynp = (Elf_Dyn *)((uint8_t *)dynphdr->p_vaddr + relocbase);
 
 	const REL_TYPE *relocs = 0, *relocslim;



CVS commit: src/lib/csu/common

2018-07-12 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Jul 12 21:36:46 UTC 2018

Modified Files:
src/lib/csu/common: crt0-common.c

Log Message:
Add static PIE support for i386 and AMD64.

The basic glue works with mininal changes for other architectures as
well, but those require linker changes first to avoid leaking dynamic
relocations into the binary.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/lib/csu/common/crt0-common.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/crt0-common.c
diff -u src/lib/csu/common/crt0-common.c:1.17 src/lib/csu/common/crt0-common.c:1.18
--- src/lib/csu/common/crt0-common.c:1.17	Thu Jul 12 21:35:12 2018
+++ src/lib/csu/common/crt0-common.c	Thu Jul 12 21:36:45 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0-common.c,v 1.17 2018/07/12 21:35:12 joerg Exp $ */
+/* $NetBSD: crt0-common.c,v 1.18 2018/07/12 21:36:45 joerg Exp $ */
 
 /*
  * Copyright (c) 1998 Christos Zoulas
@@ -36,7 +36,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: crt0-common.c,v 1.17 2018/07/12 21:35:12 joerg Exp $");
+__RCSID("$NetBSD: crt0-common.c,v 1.18 2018/07/12 21:36:45 joerg Exp $");
 
 #include 
 #include 
@@ -192,11 +192,103 @@ fix_iplt(void)
 }
 #endif
 
+#if defined(__x86_64__) || defined(__i386__)
+#  define HAS_RELOCATE_SELF
+#  if defined(__x86_64__)
+#  define RELA
+#  define REL_TAG DT_RELA
+#  define RELSZ_TAG DT_RELASZ
+#  define REL_TYPE Elf_Rela
+#  else
+#  define REL_TAG DT_REL
+#  define RELSZ_TAG DT_RELSZ
+#  define REL_TYPE Elf_Rel
+#  endif
+
+#include 
+
+static void relocate_self(struct ps_strings *) __noinline;
+
+static void
+relocate_self(struct ps_strings *ps_strings)
+{
+	AuxInfo *aux = (AuxInfo *)(ps_strings->ps_argvstr + ps_strings->ps_nargvstr +
+	ps_strings->ps_nenvstr + 2);
+	uintptr_t relocbase;
+	const Elf_Phdr *phdr;
+	Elf_Half phnum;
+
+	for (; aux->a_type != AT_NULL; ++aux) {
+		switch (aux->a_type) {
+		case AT_BASE:
+			if (aux->a_v)
+return;
+			break;
+		case AT_PHDR:
+			phdr = (void *)aux->a_v;
+			break;
+		case AT_PHNUM:
+			phnum = (Elf_Half)aux->a_v;
+			break;
+		}
+	}
+	const Elf_Phdr *phlimit = phdr + phnum, *dynphdr;
+
+	for (; phdr < phlimit; ++phdr) {
+		if (phdr->p_type == PT_DYNAMIC)
+			dynphdr = phdr;
+		if (phdr->p_type == PT_PHDR)
+			relocbase = (uintptr_t)phdr - phdr->p_vaddr;
+	}
+	Elf_Dyn *dynp = (Elf_Dyn *)((uint8_t *)dynphdr->p_vaddr + relocbase);
+
+	const REL_TYPE *relocs = 0, *relocslim;
+	Elf_Addr relocssz = 0;
+
+	for (; dynp->d_tag != DT_NULL; dynp++) {
+		switch (dynp->d_tag) {
+		case REL_TAG:
+			relocs =
+			(const REL_TYPE *)(relocbase + dynp->d_un.d_ptr);
+			break;
+		case RELSZ_TAG:
+			relocssz = dynp->d_un.d_val;
+			break;
+		}
+	}
+	relocslim = (const REL_TYPE *)((const uint8_t *)relocs + relocssz);
+	for (; relocs < relocslim; ++relocs) {
+		Elf_Addr *where;
+
+		where = (Elf_Addr *)(relocbase + relocs->r_offset);
+
+		switch (ELF_R_TYPE(relocs->r_info)) {
+		case R_TYPE(RELATIVE):  /* word64 B + A */
+#ifdef RELA
+			*where = (Elf_Addr)(relocbase + relocs->r_addend);
+#else
+			*where += (Elf_Addr)relocbase;
+#endif
+			break;
+#ifdef IFUNC_RELOCATION
+		case IFUNC_RELOCATION:
+			break;
+#endif
+		default:
+			abort();
+		}
+	}
+}
+#endif
+
 void
 ___start(void (*cleanup)(void),			/* from shared loader */
 const Obj_Entry *obj,			/* from shared loader */
 struct ps_strings *ps_strings)
 {
+#if defined(HAS_RELOCATE_SELF)
+	relocate_self(ps_strings);
+#endif
 
 	if (ps_strings == NULL)
 		_FATAL("ps_strings missing\n");



CVS commit: src/lib/csu/common

2018-07-12 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Jul 12 21:35:12 UTC 2018

Modified Files:
src/lib/csu/common: crt0-common.c

Log Message:
_DYNAMIC is present for static PIE as well, so loosen rtld check.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/lib/csu/common/crt0-common.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/crt0-common.c
diff -u src/lib/csu/common/crt0-common.c:1.16 src/lib/csu/common/crt0-common.c:1.17
--- src/lib/csu/common/crt0-common.c:1.16	Thu Mar 29 13:23:39 2018
+++ src/lib/csu/common/crt0-common.c	Thu Jul 12 21:35:12 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0-common.c,v 1.16 2018/03/29 13:23:39 joerg Exp $ */
+/* $NetBSD: crt0-common.c,v 1.17 2018/07/12 21:35:12 joerg Exp $ */
 
 /*
  * Copyright (c) 1998 Christos Zoulas
@@ -36,7 +36,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: crt0-common.c,v 1.16 2018/03/29 13:23:39 joerg Exp $");
+__RCSID("$NetBSD: crt0-common.c,v 1.17 2018/07/12 21:35:12 joerg Exp $");
 
 #include 
 #include 
@@ -215,9 +215,7 @@ ___start(void (*cleanup)(void),			/* fro
 		__progname = empty_string;
 	}
 
-	if (_DYNAMIC != NULL) {
-		if (obj == NULL)
-			_FATAL("NULL Obj_Entry pointer in GOT\n");
+	if (_DYNAMIC != NULL && obj != NULL) {
 		if (obj->magic != RTLD_MAGIC)
 			_FATAL("Corrupt Obj_Entry pointer in GOT\n");
 		if (obj->version != RTLD_VERSION)



CVS commit: src/lib/csu

2018-06-16 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Jun 16 18:58:00 UTC 2018

Modified Files:
src/lib/csu: Makefile

Log Message:
Disable MKSANITIZER in lib/csu

These low-level libraries are expected to be not touched by a sanitizer.
Every libc program not using sanitizers cannot work with sanitized csu.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/lib/csu/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/Makefile
diff -u src/lib/csu/Makefile:1.35 src/lib/csu/Makefile:1.36
--- src/lib/csu/Makefile:1.35	Sun Aug 10 23:25:49 2014
+++ src/lib/csu/Makefile	Sat Jun 16 18:58:00 2018
@@ -1,4 +1,6 @@
-#	$NetBSD: Makefile,v 1.35 2014/08/10 23:25:49 matt Exp $
+#	$NetBSD: Makefile,v 1.36 2018/06/16 18:58:00 kamil Exp $
+
+NOSANITIZER=		# defined
 
 .include 
 



CVS commit: src/lib/csu

2017-07-18 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Jul 18 14:34:19 UTC 2017

Modified Files:
src/lib/csu/arch/mips: crtend.S
src/lib/csu/common: crtbegin.c

Log Message:
.eh_frame should be read-only on MIPS too.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/csu/arch/mips/crtend.S
cvs rdiff -u -r1.13 -r1.14 src/lib/csu/common/crtbegin.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/mips/crtend.S
diff -u src/lib/csu/arch/mips/crtend.S:1.3 src/lib/csu/arch/mips/crtend.S:1.4
--- src/lib/csu/arch/mips/crtend.S:1.3	Thu Sep  5 00:28:11 2013
+++ src/lib/csu/arch/mips/crtend.S	Tue Jul 18 14:34:19 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: crtend.S,v 1.3 2013/09/05 00:28:11 matt Exp $	*/
+/*	$NetBSD: crtend.S,v 1.4 2017/07/18 14:34:19 joerg Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,7 +30,7 @@
 
 #include 
 
-RCSID("$NetBSD: crtend.S,v 1.3 2013/09/05 00:28:11 matt Exp $")
+RCSID("$NetBSD: crtend.S,v 1.4 2017/07/18 14:34:19 joerg Exp $")
 
 	.section	.ctors, "aw", @progbits
 	.p2align 	PTR_SCALESHIFT
@@ -46,7 +46,7 @@ __CTOR_LIST_END__:
 __DTOR_LIST_END__:
 	.word		0
 
-	.section	.eh_frame, "aw", @progbits
+	.section	.eh_frame, "a", @progbits
 	.p2align	 PTR_SCALESHIFT
 	.space		_MIPS_SZPTR / 8
 

Index: src/lib/csu/common/crtbegin.c
diff -u src/lib/csu/common/crtbegin.c:1.13 src/lib/csu/common/crtbegin.c:1.14
--- src/lib/csu/common/crtbegin.c:1.13	Wed Jun 29 11:16:47 2016
+++ src/lib/csu/common/crtbegin.c	Tue Jul 18 14:34:19 2017
@@ -27,7 +27,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: crtbegin.c,v 1.13 2016/06/29 11:16:47 joerg Exp $");
+__RCSID("$NetBSD: crtbegin.c,v 1.14 2017/07/18 14:34:19 joerg Exp $");
 
 #include "crtbegin.h"
 
@@ -57,11 +57,7 @@ __dso_hidden void *__dso_handle;
 #endif
 
 #if !defined(__ARM_EABI__) || defined(__ARM_DWARF_EH__)
-__dso_hidden
-#if !defined(__mips__)
-	const
-#endif
-	long __EH_FRAME_LIST__[0] __section(".eh_frame");
+__dso_hidden const long __EH_FRAME_LIST__[0] __section(".eh_frame");
 
 __weakref_visible void register_frame_info(const void *, const void *)
 	__weak_reference(__register_frame_info);



CVS commit: src/lib/csu/arch/alpha

2017-01-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 14 15:50:24 UTC 2017

Modified Files:
src/lib/csu/arch/alpha: crtbegin.h

Log Message:
remove useless include; asm.h is not useful for c files. our current assumption
is that stuff in cdefs.h is duplicated in asm.h.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/alpha/crtbegin.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/alpha/crtbegin.h
diff -u src/lib/csu/arch/alpha/crtbegin.h:1.1 src/lib/csu/arch/alpha/crtbegin.h:1.2
--- src/lib/csu/arch/alpha/crtbegin.h:1.1	Thu Jul 11 12:40:27 2013
+++ src/lib/csu/arch/alpha/crtbegin.h	Sat Jan 14 10:50:24 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: crtbegin.h,v 1.1 2013/07/11 16:40:27 matt Exp $ */
+/* $NetBSD: crtbegin.h,v 1.2 2017/01/14 15:50:24 christos Exp $ */
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,6 @@
  */
 
 #include 
-#include 
 
 /* Assume we need to reload our GP. */
 __asm(		".pushsection .init"



CVS commit: src/lib/csu/arch/sh3

2016-08-29 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Mon Aug 29 21:27:03 UTC 2016

Modified Files:
src/lib/csu/arch/sh3: crt0.S

Log Message:
___start is __dso_hidden, so use CALL_DATUM_LOCAL and drop the PIC
prologue from __start.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/csu/arch/sh3/crt0.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/sh3/crt0.S
diff -u src/lib/csu/arch/sh3/crt0.S:1.5 src/lib/csu/arch/sh3/crt0.S:1.6
--- src/lib/csu/arch/sh3/crt0.S:1.5	Sun Aug 28 13:50:25 2016
+++ src/lib/csu/arch/sh3/crt0.S	Mon Aug 29 21:27:03 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.S,v 1.5 2016/08/28 13:50:25 christos Exp $ */
+/* $NetBSD: crt0.S,v 1.6 2016/08/29 21:27:03 uwe Exp $ */
 
 /*
  * Copyright (c) 1998 Christos Zoulas
@@ -37,7 +37,7 @@
 
 #include 
 
-RCSID("$NetBSD: crt0.S,v 1.5 2016/08/28 13:50:25 christos Exp $")
+RCSID("$NetBSD: crt0.S,v 1.6 2016/08/29 21:27:03 uwe Exp $")
 
 STRONG_ALIAS(_start,__start)
 
@@ -49,7 +49,6 @@ STRONG_ALIAS(_start,__start)
  * proper registers.
  */
 _ENTRY(__start)
-	PIC_PROLOGUE_NOSAVE(.L_got)
 	mov.l	.L___start, r0
 	mov	r7, r4		! void (*cleanup)(void)
 	mov	r8, r5		! const Obj_Entry *obj
@@ -57,7 +56,5 @@ _ENTRY(__start)
 	 mov	r9, r6		! struct ps_strings *ps_strings
 
 	.p2align 2
-.L_got:
-	PIC_GOT_DATUM
 .L___start:
-	CALL_DATUM(___start, 1b)
+	CALL_DATUM_LOCAL(___start, 1b)



CVS commit: src/lib/csu/arch/sh3

2016-08-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 28 13:50:26 UTC 2016

Modified Files:
src/lib/csu/arch/sh3: crt0.S

Log Message:
fix pic code; otherwise we generate text relocations.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/csu/arch/sh3/crt0.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/sh3/crt0.S
diff -u src/lib/csu/arch/sh3/crt0.S:1.4 src/lib/csu/arch/sh3/crt0.S:1.5
--- src/lib/csu/arch/sh3/crt0.S:1.4	Tue Jan 31 15:17:57 2012
+++ src/lib/csu/arch/sh3/crt0.S	Sun Aug 28 09:50:25 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.S,v 1.4 2012/01/31 20:17:57 uwe Exp $ */
+/* $NetBSD: crt0.S,v 1.5 2016/08/28 13:50:25 christos Exp $ */
 
 /*
  * Copyright (c) 1998 Christos Zoulas
@@ -37,7 +37,7 @@
 
 #include 
 
-RCSID("$NetBSD: crt0.S,v 1.4 2012/01/31 20:17:57 uwe Exp $")
+RCSID("$NetBSD: crt0.S,v 1.5 2016/08/28 13:50:25 christos Exp $")
 
 STRONG_ALIAS(_start,__start)
 
@@ -49,11 +49,15 @@ STRONG_ALIAS(_start,__start)
  * proper registers.
  */
 _ENTRY(__start)
+	PIC_PROLOGUE_NOSAVE(.L_got)
 	mov.l	.L___start, r0
 	mov	r7, r4		! void (*cleanup)(void)
 	mov	r8, r5		! const Obj_Entry *obj
-	jmp	@r0
+1:	JUMP	r0
 	 mov	r9, r6		! struct ps_strings *ps_strings
 
 	.p2align 2
-.L___start:	.long	_C_LABEL(___start)
+.L_got:
+	PIC_GOT_DATUM
+.L___start:
+	CALL_DATUM(___start, 1b)



CVS commit: src/lib/csu/common

2016-06-29 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Jun 29 11:16:47 UTC 2016

Modified Files:
src/lib/csu/common: crtbegin.c

Log Message:
For some mind-boogling reasons, GCC 5.4 believes that a weak reference
cannot alias with an extern. While this is clearly bogus, avoid yet
another alias handling bug and use strong aliases. It's actually
slightly simpler, too.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/lib/csu/common/crtbegin.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/crtbegin.c
diff -u src/lib/csu/common/crtbegin.c:1.12 src/lib/csu/common/crtbegin.c:1.13
--- src/lib/csu/common/crtbegin.c:1.12	Tue Jun  7 12:07:35 2016
+++ src/lib/csu/common/crtbegin.c	Wed Jun 29 11:16:47 2016
@@ -27,7 +27,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: crtbegin.c,v 1.12 2016/06/07 12:07:35 joerg Exp $");
+__RCSID("$NetBSD: crtbegin.c,v 1.13 2016/06/29 11:16:47 joerg Exp $");
 
 #include "crtbegin.h"
 
@@ -39,8 +39,7 @@ __weakref_visible void Jv_RegisterClasse
 	__weak_reference(_Jv_RegisterClasses);
 
 #if !defined(HAVE_INITFINI_ARRAY)
-__weakref_visible const fptr_t __CTOR_LIST__start
-__weak_reference(__CTOR_LIST__);
+extern __dso_hidden const fptr_t __CTOR_LIST__start __asm("__CTOR_LIST__");
 
 __dso_hidden const fptr_t __aligned(sizeof(void *)) __CTOR_LIST__[] __section(".ctors") = {
 	(fptr_t) -1,
@@ -101,8 +100,7 @@ __do_global_ctors_aux(void)
 
 #if !defined(__ARM_EABI__) || defined(SHARED) || defined(__ARM_DWARF_EH__)
 #if !defined(HAVE_INITFINI_ARRAY)
-__weakref_visible const fptr_t __DTOR_LIST__start
-__weak_reference(__DTOR_LIST__);
+extern __dso_hidden const fptr_t __DTOR_LIST__start __asm("__DTOR_LIST__");
 
 __dso_hidden const fptr_t __aligned(sizeof(void *)) __DTOR_LIST__[] __section(".dtors") = {
 	(fptr_t) -1,



CVS commit: src/lib/csu/common

2016-06-07 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Jun  7 12:07:35 UTC 2016

Modified Files:
src/lib/csu/common: crt0-common.c crtbegin.c

Log Message:
Fun fact of the weak: a weak reference doesn't have visibility attached.
As such, reorganize the start/end references to use a weak reference
only, if we use it to remove size knowledge. Otherwise use weak
external declarations.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/csu/common/crt0-common.c
cvs rdiff -u -r1.11 -r1.12 src/lib/csu/common/crtbegin.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/crt0-common.c
diff -u src/lib/csu/common/crt0-common.c:1.13 src/lib/csu/common/crt0-common.c:1.14
--- src/lib/csu/common/crt0-common.c:1.13	Thu Jan 31 22:24:25 2013
+++ src/lib/csu/common/crt0-common.c	Tue Jun  7 12:07:35 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0-common.c,v 1.13 2013/01/31 22:24:25 matt Exp $ */
+/* $NetBSD: crt0-common.c,v 1.14 2016/06/07 12:07:35 joerg Exp $ */
 
 /*
  * Copyright (c) 1998 Christos Zoulas
@@ -36,7 +36,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: crt0-common.c,v 1.13 2013/01/31 22:24:25 matt Exp $");
+__RCSID("$NetBSD: crt0-common.c,v 1.14 2016/06/07 12:07:35 joerg Exp $");
 
 #include 
 #include 
@@ -95,23 +95,17 @@ do {		\
  * Since we don't need .init or .fini sections, just code them in C
  * to make life easier.
  */
-__weakref_visible const fptr_t preinit_array_start[1]
-__weak_reference(__preinit_array_start);
-__weakref_visible const fptr_t preinit_array_end[1]
-__weak_reference(__preinit_array_end);
-__weakref_visible const fptr_t init_array_start[1]
-__weak_reference(__init_array_start);
-__weakref_visible const fptr_t init_array_end[1]
-__weak_reference(__init_array_end);
-__weakref_visible const fptr_t fini_array_start[1]
-__weak_reference(__fini_array_start);
-__weakref_visible const fptr_t fini_array_end[1]
-__weak_reference(__fini_array_end);
+extern const fptr_t __preinit_array_start[] __dso_hidden;
+extern const fptr_t __preinit_array_end[] __dso_hidden __weak;
+extern const fptr_t __init_array_start[] __dso_hidden;
+extern const fptr_t __init_array_end[] __dso_hidden __weak;
+extern const fptr_t __fini_array_start[] __dso_hidden;
+extern const fptr_t __fini_array_end[] __dso_hidden __weak;
 
 static inline void
 _preinit(void)
 {
-	for (const fptr_t *f = preinit_array_start; f < preinit_array_end; f++) {
+	for (const fptr_t *f = __preinit_array_start; f < __preinit_array_end; f++) {
 		(*f)();
 	}
 }
@@ -119,7 +113,7 @@ _preinit(void)
 static inline void
 _init(void)
 {
-	for (const fptr_t *f = init_array_start; f < init_array_end; f++) {
+	for (const fptr_t *f = __init_array_start; f < __init_array_end; f++) {
 		(*f)();
 	}
 }
@@ -127,7 +121,7 @@ _init(void)
 static void
 _fini(void)
 {
-	for (const fptr_t *f = fini_array_start; f < fini_array_end; f++) {
+	for (const fptr_t *f = __fini_array_start; f < __fini_array_end; f++) {
 		(*f)();
 	}
 }

Index: src/lib/csu/common/crtbegin.c
diff -u src/lib/csu/common/crtbegin.c:1.11 src/lib/csu/common/crtbegin.c:1.12
--- src/lib/csu/common/crtbegin.c:1.11	Sun Jun  5 00:43:39 2016
+++ src/lib/csu/common/crtbegin.c	Tue Jun  7 12:07:35 2016
@@ -27,7 +27,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: crtbegin.c,v 1.11 2016/06/05 00:43:39 joerg Exp $");
+__RCSID("$NetBSD: crtbegin.c,v 1.12 2016/06/07 12:07:35 joerg Exp $");
 
 #include "crtbegin.h"
 
@@ -41,8 +41,6 @@ __weakref_visible void Jv_RegisterClasse
 #if !defined(HAVE_INITFINI_ARRAY)
 __weakref_visible const fptr_t __CTOR_LIST__start
 __weak_reference(__CTOR_LIST__);
-__weakref_visible const fptr_t __CTOR_LIST__end
-__weak_reference(__CTOR_LIST_END__);
 
 __dso_hidden const fptr_t __aligned(sizeof(void *)) __CTOR_LIST__[] __section(".ctors") = {
 	(fptr_t) -1,
@@ -95,7 +93,7 @@ __do_global_ctors_aux(void)
 		Jv_RegisterClasses(__JCR_LIST__);
 
 #if !defined(HAVE_INITFINI_ARRAY)
-	for (const fptr_t *p = &__CTOR_LIST__end; p > &__CTOR_LIST__start + 1; ) {
+	for (const fptr_t *p = __CTOR_LIST_END__; p > &__CTOR_LIST__start + 1; ) {
 		(*(*--p))();
 	}
 #endif
@@ -105,8 +103,6 @@ __do_global_ctors_aux(void)
 #if !defined(HAVE_INITFINI_ARRAY)
 __weakref_visible const fptr_t __DTOR_LIST__start
 __weak_reference(__DTOR_LIST__);
-__weakref_visible const fptr_t __DTOR_LIST__end
-__weak_reference(__DTOR_LIST_END__);
 
 __dso_hidden const fptr_t __aligned(sizeof(void *)) __DTOR_LIST__[] __section(".dtors") = {
 	(fptr_t) -1,
@@ -132,7 +128,7 @@ __do_global_dtors_aux(void)
 #endif
 
 #if !defined(HAVE_INITFINI_ARRAY)
-	for (const fptr_t *p = &__DTOR_LIST__start + 1; p < &__DTOR_LIST__end; ) {
+	for (const fptr_t *p = &__DTOR_LIST__start + 1; p < __DTOR_LIST_END__; ) {
 		(*(*p++))();
 	}
 #endif



CVS commit: src/lib/csu/common

2016-06-04 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Jun  5 00:43:39 UTC 2016

Modified Files:
src/lib/csu/common: crtbegin.c

Log Message:
Make older GCC and Clang happy and use weak references to the elements,
not declared as arrays.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/csu/common/crtbegin.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/crtbegin.c
diff -u src/lib/csu/common/crtbegin.c:1.10 src/lib/csu/common/crtbegin.c:1.11
--- src/lib/csu/common/crtbegin.c:1.10	Wed Jun  1 21:21:55 2016
+++ src/lib/csu/common/crtbegin.c	Sun Jun  5 00:43:39 2016
@@ -27,7 +27,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: crtbegin.c,v 1.10 2016/06/01 21:21:55 joerg Exp $");
+__RCSID("$NetBSD: crtbegin.c,v 1.11 2016/06/05 00:43:39 joerg Exp $");
 
 #include "crtbegin.h"
 
@@ -39,9 +39,9 @@ __weakref_visible void Jv_RegisterClasse
 	__weak_reference(_Jv_RegisterClasses);
 
 #if !defined(HAVE_INITFINI_ARRAY)
-__weakref_visible const fptr_t __CTOR_LIST__start[]
+__weakref_visible const fptr_t __CTOR_LIST__start
 __weak_reference(__CTOR_LIST__);
-__weakref_visible const fptr_t __CTOR_LIST__end[]
+__weakref_visible const fptr_t __CTOR_LIST__end
 __weak_reference(__CTOR_LIST_END__);
 
 __dso_hidden const fptr_t __aligned(sizeof(void *)) __CTOR_LIST__[] __section(".ctors") = {
@@ -95,7 +95,7 @@ __do_global_ctors_aux(void)
 		Jv_RegisterClasses(__JCR_LIST__);
 
 #if !defined(HAVE_INITFINI_ARRAY)
-	for (const fptr_t *p = __CTOR_LIST__end; p > __CTOR_LIST__start + 1; ) {
+	for (const fptr_t *p = &__CTOR_LIST__end; p > &__CTOR_LIST__start + 1; ) {
 		(*(*--p))();
 	}
 #endif
@@ -103,9 +103,9 @@ __do_global_ctors_aux(void)
 
 #if !defined(__ARM_EABI__) || defined(SHARED) || defined(__ARM_DWARF_EH__)
 #if !defined(HAVE_INITFINI_ARRAY)
-__weakref_visible const fptr_t __DTOR_LIST__start[]
+__weakref_visible const fptr_t __DTOR_LIST__start
 __weak_reference(__DTOR_LIST__);
-__weakref_visible const fptr_t __DTOR_LIST__end[]
+__weakref_visible const fptr_t __DTOR_LIST__end
 __weak_reference(__DTOR_LIST_END__);
 
 __dso_hidden const fptr_t __aligned(sizeof(void *)) __DTOR_LIST__[] __section(".dtors") = {
@@ -132,7 +132,7 @@ __do_global_dtors_aux(void)
 #endif
 
 #if !defined(HAVE_INITFINI_ARRAY)
-	for (const fptr_t *p = __DTOR_LIST__start + 1; p < __DTOR_LIST__end; ) {
+	for (const fptr_t *p = &__DTOR_LIST__start + 1; p < &__DTOR_LIST__end; ) {
 		(*(*p++))();
 	}
 #endif



CVS commit: src/lib/csu/common

2016-06-01 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Jun  1 21:21:55 UTC 2016

Modified Files:
src/lib/csu/common: crtbegin.c

Log Message:
PR toolchain/51121:
__CTOR_LIST__ and __CTOR_LIST_END__ are logically the same object, but
due to the start marker, the former has to be declared as array of fixed
size. Newer GCC versions take the liberty of exploiting the UB of
accessing global objects past the end to unconditionally load zero
values in that case. Two fixes are possible:
(1) Pruning via inline assembler as done by GCC's own CRT copy.
(2) Pruning via weak references as done for linker sets.
Since the second part is known and required to work anyway, prefer this
approach. In theory, the labels could be replaced completely, except
that GNU as doesn't provide start/end symbols for sections containing
dots.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/csu/common/crtbegin.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/crtbegin.c
diff -u src/lib/csu/common/crtbegin.c:1.9 src/lib/csu/common/crtbegin.c:1.10
--- src/lib/csu/common/crtbegin.c:1.9	Tue May  6 16:02:10 2014
+++ src/lib/csu/common/crtbegin.c	Wed Jun  1 21:21:55 2016
@@ -27,7 +27,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: crtbegin.c,v 1.9 2014/05/06 16:02:10 joerg Exp $");
+__RCSID("$NetBSD: crtbegin.c,v 1.10 2016/06/01 21:21:55 joerg Exp $");
 
 #include "crtbegin.h"
 
@@ -39,6 +39,11 @@ __weakref_visible void Jv_RegisterClasse
 	__weak_reference(_Jv_RegisterClasses);
 
 #if !defined(HAVE_INITFINI_ARRAY)
+__weakref_visible const fptr_t __CTOR_LIST__start[]
+__weak_reference(__CTOR_LIST__);
+__weakref_visible const fptr_t __CTOR_LIST__end[]
+__weak_reference(__CTOR_LIST_END__);
+
 __dso_hidden const fptr_t __aligned(sizeof(void *)) __CTOR_LIST__[] __section(".ctors") = {
 	(fptr_t) -1,
 };
@@ -90,7 +95,7 @@ __do_global_ctors_aux(void)
 		Jv_RegisterClasses(__JCR_LIST__);
 
 #if !defined(HAVE_INITFINI_ARRAY)
-	for (const fptr_t *p = __CTOR_LIST_END__; p > __CTOR_LIST__ + 1; ) {
+	for (const fptr_t *p = __CTOR_LIST__end; p > __CTOR_LIST__start + 1; ) {
 		(*(*--p))();
 	}
 #endif
@@ -98,6 +103,11 @@ __do_global_ctors_aux(void)
 
 #if !defined(__ARM_EABI__) || defined(SHARED) || defined(__ARM_DWARF_EH__)
 #if !defined(HAVE_INITFINI_ARRAY)
+__weakref_visible const fptr_t __DTOR_LIST__start[]
+__weak_reference(__DTOR_LIST__);
+__weakref_visible const fptr_t __DTOR_LIST__end[]
+__weak_reference(__DTOR_LIST_END__);
+
 __dso_hidden const fptr_t __aligned(sizeof(void *)) __DTOR_LIST__[] __section(".dtors") = {
 	(fptr_t) -1,
 };
@@ -122,7 +132,7 @@ __do_global_dtors_aux(void)
 #endif
 
 #if !defined(HAVE_INITFINI_ARRAY)
-	for (const fptr_t *p = __DTOR_LIST__ + 1; p < __DTOR_LIST_END__; ) {
+	for (const fptr_t *p = __DTOR_LIST__start + 1; p < __DTOR_LIST__end; ) {
 		(*(*p++))();
 	}
 #endif



CVS commit: src/lib/csu/common

2016-06-01 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Jun  1 21:24:55 UTC 2016

Modified Files:
src/lib/csu/common: Makefile.inc

Log Message:
Revert -O1 hack for GCC 5.3, replaced by workaround in the code.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/lib/csu/common/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/Makefile.inc
diff -u src/lib/csu/common/Makefile.inc:1.31 src/lib/csu/common/Makefile.inc:1.32
--- src/lib/csu/common/Makefile.inc:1.31	Tue May 10 10:23:09 2016
+++ src/lib/csu/common/Makefile.inc	Wed Jun  1 21:24:55 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.31 2016/05/10 10:23:09 martin Exp $
+#	$NetBSD: Makefile.inc,v 1.32 2016/06/01 21:24:55 joerg Exp $
 
 .include 
 
@@ -17,14 +17,6 @@ OBJS+=		sysident.o
 .if ${MKPIC} == "yes"
 OBJS+=		crtbeginS.o
 CFLAGS.crtbegin.c+= -fPIE
-# XXXGCC5 - GCC 5 miscompiles crtbeginS.c on many platforms.  on SPARC it
-# XXXGCC5   emits "clr %g1; call %g1", which is effectively jumping to zero.
-. if defined(HAVE_GCC) && ${HAVE_GCC} == 53 && \
- !exists(${ARCHDIR}/crtbegin.S)
-CFLAGS.crt0-common.c+=	-O1
-CFLAGS.crtbeginS.c+=	-O1
-CFLAGS.crtbegin.c+=	-O1
-. endif
 .endif
 
 .if ${MACHINE_ARCH} == "alpha"



CVS commit: src/lib/csu/common

2016-05-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 10 10:23:09 UTC 2016

Modified Files:
src/lib/csu/common: Makefile.inc

Log Message:
We need the -O1 hack (for gcc 5.3) for crtbegin.c as well.
Works around PR toolchain/51121.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/lib/csu/common/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/Makefile.inc
diff -u src/lib/csu/common/Makefile.inc:1.30 src/lib/csu/common/Makefile.inc:1.31
--- src/lib/csu/common/Makefile.inc:1.30	Sun May  1 07:25:46 2016
+++ src/lib/csu/common/Makefile.inc	Tue May 10 10:23:09 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.30 2016/05/01 07:25:46 martin Exp $
+#	$NetBSD: Makefile.inc,v 1.31 2016/05/10 10:23:09 martin Exp $
 
 .include 
 
@@ -23,6 +23,7 @@ CFLAGS.crtbegin.c+= -fPIE
  !exists(${ARCHDIR}/crtbegin.S)
 CFLAGS.crt0-common.c+=	-O1
 CFLAGS.crtbeginS.c+=	-O1
+CFLAGS.crtbegin.c+=	-O1
 . endif
 .endif
 



CVS commit: src/lib/csu/common

2016-05-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May  1 08:33:14 UTC 2016

Modified Files:
src/lib/csu/common: compident.S

Log Message:
Change section flags to "MG" and put it into comdat.
Makes new binutils happy.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/csu/common/compident.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/compident.S
diff -u src/lib/csu/common/compident.S:1.3 src/lib/csu/common/compident.S:1.4
--- src/lib/csu/common/compident.S:1.3	Wed May 14 14:59:14 2014
+++ src/lib/csu/common/compident.S	Sun May  1 08:33:14 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: compident.S,v 1.3 2014/05/14 14:59:14 joerg Exp $ */
+/* $NetBSD: compident.S,v 1.4 2016/05/01 08:33:14 martin Exp $ */
 
 /*-
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -55,7 +55,7 @@
 
 #include "sysident_assym.h"
 
-	.section .note.netbsd.mcmodel,"aM",@note,3*4+CONTENTLENGTH+ELF_NOTE_MCMODEL_NAMESZ+1
+	.section .note.netbsd.mcmodel,"MG",@note,3*4+CONTENTLENGTH+ELF_NOTE_MCMODEL_NAMESZ+1,comdat
 	.p2align 2
 
 	.long	ELF_NOTE_MCMODEL_NAMESZ



CVS commit: src/lib/csu/common

2016-05-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May  1 07:25:46 UTC 2016

Modified Files:
src/lib/csu/common: Makefile.inc

Log Message:
Revert previous (fallout is more subtle but there).
Rework the conditionon so it depends on .S existence instead of an arch
list.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/lib/csu/common/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/Makefile.inc
diff -u src/lib/csu/common/Makefile.inc:1.29 src/lib/csu/common/Makefile.inc:1.30
--- src/lib/csu/common/Makefile.inc:1.29	Sat Apr 30 13:12:13 2016
+++ src/lib/csu/common/Makefile.inc	Sun May  1 07:25:46 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.29 2016/04/30 13:12:13 martin Exp $
+#	$NetBSD: Makefile.inc,v 1.30 2016/05/01 07:25:46 martin Exp $
 
 .include 
 
@@ -20,8 +20,7 @@ CFLAGS.crtbegin.c+= -fPIE
 # XXXGCC5 - GCC 5 miscompiles crtbeginS.c on many platforms.  on SPARC it
 # XXXGCC5   emits "clr %g1; call %g1", which is effectively jumping to zero.
 . if defined(HAVE_GCC) && ${HAVE_GCC} == 53 && \
- ${CSU_MACHINE_ARCH} != "i386" && ${CSU_MACHINE_ARCH} != "amd64" && \
- ${CSU_MACHINE_ARCH} != "sparc64"
+ !exists(${ARCHDIR}/crtbegin.S)
 CFLAGS.crt0-common.c+=	-O1
 CFLAGS.crtbeginS.c+=	-O1
 . endif



CVS commit: src/lib/csu/common

2016-04-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr 30 13:12:13 UTC 2016

Modified Files:
src/lib/csu/common: Makefile.inc

Log Message:
Gcc 5.3 seems to do fine compiling this for sparc64, so exclude it
from the -O1 hack


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/lib/csu/common/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/Makefile.inc
diff -u src/lib/csu/common/Makefile.inc:1.28 src/lib/csu/common/Makefile.inc:1.29
--- src/lib/csu/common/Makefile.inc:1.28	Mon Apr  4 18:29:07 2016
+++ src/lib/csu/common/Makefile.inc	Sat Apr 30 13:12:13 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.28 2016/04/04 18:29:07 martin Exp $
+#	$NetBSD: Makefile.inc,v 1.29 2016/04/30 13:12:13 martin Exp $
 
 .include 
 
@@ -20,7 +20,8 @@ CFLAGS.crtbegin.c+= -fPIE
 # XXXGCC5 - GCC 5 miscompiles crtbeginS.c on many platforms.  on SPARC it
 # XXXGCC5   emits "clr %g1; call %g1", which is effectively jumping to zero.
 . if defined(HAVE_GCC) && ${HAVE_GCC} == 53 && \
- ${MACHINE_ARCH} != "i386" && ${MACHINE_ARCH} != "amd64"
+ ${CSU_MACHINE_ARCH} != "i386" && ${CSU_MACHINE_ARCH} != "amd64" && \
+ ${CSU_MACHINE_ARCH} != "sparc64"
 CFLAGS.crt0-common.c+=	-O1
 CFLAGS.crtbeginS.c+=	-O1
 . endif



CVS commit: src/lib/csu/common

2016-03-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Mar 29 21:23:05 UTC 2016

Modified Files:
src/lib/csu/common: Makefile.inc

Log Message:
crt0-common.c is miscompiled by gcc 5.3 on evbarm with -O2 so use -O1.  Do
this for all non-x86 arches.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/lib/csu/common/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/Makefile.inc
diff -u src/lib/csu/common/Makefile.inc:1.26 src/lib/csu/common/Makefile.inc:1.27
--- src/lib/csu/common/Makefile.inc:1.26	Sun Mar 27 00:03:06 2016
+++ src/lib/csu/common/Makefile.inc	Tue Mar 29 21:23:05 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.26 2016/03/27 00:03:06 mrg Exp $
+#	$NetBSD: Makefile.inc,v 1.27 2016/03/29 21:23:05 skrll Exp $
 
 .include 
 
@@ -20,6 +20,7 @@ CFLAGS.crtbegin.c+= -fPIE
 # XXXGCC5   emits "clr %g1; call %g1", which is effectively jumping to zero.
 . if defined(HAVE_GCC) && ${HAVE_GCC} == 53 && \
  ${MACHINE_ARCH} != "i386" && ${MACHINE_ARCH} != "amd64"
+CFLAGS.crt0-common.c+=	-O1
 CFLAGS.crtbeginS.c+=	-O1
 . endif
 .endif
@@ -88,7 +89,7 @@ MY_PICFLAGS=
 crt0.o: crt0.S crt0-common.c
 	${_MKTARGET_COMPILE}
 	${COMPILE.S} ${ARCHDIR}/crt0.S -o ${.TARGET}.S.o
-	${COMPILE.c} ${MY_PICFLAGS} ${COMMON_DIR}/crt0-common.c -o ${.TARGET}.c.o
+	${COMPILE.c} ${CFLAGS.crt0-common.c} ${MY_PICFLAGS} ${COMMON_DIR}/crt0-common.c -o ${.TARGET}.c.o
 	${LD} -r -o ${.TARGET}.o ${.TARGET}.S.o ${.TARGET}.c.o
 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}.o ${.TARGET} 
 	rm -f ${.TARGET}.S.o ${.TARGET}.c.o ${.TARGET}.o



CVS commit: src/lib/csu/common

2016-03-26 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Mar 27 00:03:06 UTC 2016

Modified Files:
src/lib/csu/common: Makefile.inc

Log Message:
add a hack for GCC 5 and non-x86 platforms:

build crtbeginS.o with -O1 as GCC tries to be very smart with the
__DTOR_LIST__ as it believes it knows the size of the array at
compile time (which is not true until link time).  on SPARC and
MIPS, the result was emitting a call to 0.

technically, i believe that GCC isn't "wrong" to make this choice,
as the array is declared with a well-known initialiser size in the
crtbegin.c compilation unit, and we have noticed that the libgcc
version of this code has some hacks added, most likely to avoid
being bitten by this optimisation.

this makes sshd work for me on earm and sparc with GCC 5.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/lib/csu/common/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/Makefile.inc
diff -u src/lib/csu/common/Makefile.inc:1.25 src/lib/csu/common/Makefile.inc:1.26
--- src/lib/csu/common/Makefile.inc:1.25	Tue Mar  4 17:57:56 2014
+++ src/lib/csu/common/Makefile.inc	Sun Mar 27 00:03:06 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.25 2014/03/04 17:57:56 joerg Exp $
+#	$NetBSD: Makefile.inc,v 1.26 2016/03/27 00:03:06 mrg Exp $
 
 .include 
 
@@ -16,7 +16,14 @@ OBJS+=		crtbegin.o crtend.o
 .if ${MKPIC} == "yes"
 OBJS+=		crtbeginS.o
 CFLAGS.crtbegin.c+= -fPIE
+# XXXGCC5 - GCC 5 miscompiles crtbeginS.c on many platforms.  on SPARC it
+# XXXGCC5   emits "clr %g1; call %g1", which is effectively jumping to zero.
+. if defined(HAVE_GCC) && ${HAVE_GCC} == 53 && \
+ ${MACHINE_ARCH} != "i386" && ${MACHINE_ARCH} != "amd64"
+CFLAGS.crtbeginS.c+=	-O1
+. endif
 .endif
+
 .if ${MACHINE_ARCH} == "alpha"
 OBJS+=		crtfm.o
 .endif
@@ -55,7 +62,7 @@ crtbeginS.o: crtbegin.S
 .else
 crtbeginS.o: crtbegin.c crtbegin.h
 	${_MKTARGET_COMPILE}
-	${COMPILE.c} ${PICFLAGS} -DSHARED ${COMMON_DIR}/crtbegin.c -o ${.TARGET}.o
+	${COMPILE.c} ${CFLAGS.crtbeginS.c} ${PICFLAGS} -DSHARED ${COMMON_DIR}/crtbegin.c -o ${.TARGET}.o
 .endif
 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}.o ${.TARGET} 
 	rm -f ${.TARGET}.o



CVS commit: src/lib/csu/arch/alpha

2016-01-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan 24 16:27:38 UTC 2016

Modified Files:
src/lib/csu/arch/alpha: Makefile.inc

Log Message:
Alpha needs _KERNTYPES


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/alpha/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/alpha/Makefile.inc
diff -u src/lib/csu/arch/alpha/Makefile.inc:1.1 src/lib/csu/arch/alpha/Makefile.inc:1.2
--- src/lib/csu/arch/alpha/Makefile.inc:1.1	Thu Jul 11 12:40:27 2013
+++ src/lib/csu/arch/alpha/Makefile.inc	Sun Jan 24 11:27:38 2016
@@ -1,3 +1,3 @@
-#	$NetBSD: Makefile.inc,v 1.1 2013/07/11 16:40:27 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.2 2016/01/24 16:27:38 christos Exp $
 
-CPPFLAGS+=	-I${ARCHDIR} -DELFSIZE=64
+CPPFLAGS+=	-I${ARCHDIR} -DELFSIZE=64 -D_KERNTYPES



CVS commit: src/lib/csu/arch/alpha

2016-01-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan 24 16:47:32 UTC 2016

Modified Files:
src/lib/csu/arch/alpha: Makefile.inc

Log Message:
Undo previous; the lossage is more basic.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/csu/arch/alpha/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/alpha/Makefile.inc
diff -u src/lib/csu/arch/alpha/Makefile.inc:1.2 src/lib/csu/arch/alpha/Makefile.inc:1.3
--- src/lib/csu/arch/alpha/Makefile.inc:1.2	Sun Jan 24 11:27:38 2016
+++ src/lib/csu/arch/alpha/Makefile.inc	Sun Jan 24 11:47:32 2016
@@ -1,3 +1,3 @@
-#	$NetBSD: Makefile.inc,v 1.2 2016/01/24 16:27:38 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.3 2016/01/24 16:47:32 christos Exp $
 
-CPPFLAGS+=	-I${ARCHDIR} -DELFSIZE=64 -D_KERNTYPES
+CPPFLAGS+=	-I${ARCHDIR} -DELFSIZE=64



CVS commit: src/lib/csu/arch/mips

2015-05-01 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri May  1 21:35:56 UTC 2015

Modified Files:
src/lib/csu/arch/mips: crti.S

Log Message:
Make sure .init and .fini are word (4byte) aligned.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/csu/arch/mips/crti.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/mips/crti.S
diff -u src/lib/csu/arch/mips/crti.S:1.2 src/lib/csu/arch/mips/crti.S:1.3
--- src/lib/csu/arch/mips/crti.S:1.2	Sun Jun 30 08:00:34 2013
+++ src/lib/csu/arch/mips/crti.S	Fri May  1 21:35:56 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: crti.S,v 1.2 2013/06/30 08:00:34 matt Exp $ */
+/* $NetBSD: crti.S,v 1.3 2015/05/01 21:35:56 matt Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -31,11 +31,12 @@
 
 #include mips/asm.h
 
-RCSID($NetBSD: crti.S,v 1.2 2013/06/30 08:00:34 matt Exp $)
+RCSID($NetBSD: crti.S,v 1.3 2015/05/01 21:35:56 matt Exp $)
 
 #include sysident.S
 
 	.section .init, ax, @progbits
+	.p2align 2
 NESTED_NOPROFILE(_init, CALLFRAME_SIZ, ra)
 SETUP_GP
 PTR_SUBU sp, sp, CALLFRAME_SIZ	# allocate stack frame
@@ -48,6 +49,7 @@ NESTED_NOPROFILE(_init, CALLFRAME_SIZ, r
 END(_init)
 
 	.section .fini, ax, @progbits
+	.p2align 2
 NESTED_NOPROFILE(_fini, CALLFRAME_SIZ, ra)
 SETUP_GP
 PTR_SUBU sp, sp, CALLFRAME_SIZ	# allocate stack frame



CVS commit: src/lib/csu/common

2014-05-14 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed May 14 14:59:14 UTC 2014

Modified Files:
src/lib/csu/common: compident.S sysident.S

Log Message:
Ensure notes are properly padded to 32bit length.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/csu/common/compident.S \
src/lib/csu/common/sysident.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/compident.S
diff -u src/lib/csu/common/compident.S:1.2 src/lib/csu/common/compident.S:1.3
--- src/lib/csu/common/compident.S:1.2	Wed Feb 26 14:54:50 2014
+++ src/lib/csu/common/compident.S	Wed May 14 14:59:14 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: compident.S,v 1.2 2014/02/26 14:54:50 martin Exp $ */
+/* $NetBSD: compident.S,v 1.3 2014/05/14 14:59:14 joerg Exp $ */
 
 /*-
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -63,3 +63,4 @@
 	.long	ELF_NOTE_TYPE_MCMODEL_TAG
 	.ascii	NetBSD\0\0
 	.ascii	CONTENT
+	.p2align 2
Index: src/lib/csu/common/sysident.S
diff -u src/lib/csu/common/sysident.S:1.2 src/lib/csu/common/sysident.S:1.3
--- src/lib/csu/common/sysident.S:1.2	Tue Sep 10 16:45:33 2013
+++ src/lib/csu/common/sysident.S	Wed May 14 14:59:14 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: sysident.S,v 1.2 2013/09/10 16:45:33 matt Exp $ */
+/* $NetBSD: sysident.S,v 1.3 2014/05/14 14:59:14 joerg Exp $ */
 
 /*
  * Copyright (c) 1997 Christopher G. Demetriou
@@ -85,4 +85,5 @@
 	.long	ELF_NOTE_TYPE_MARCH_TAG
 	.ascii	NetBSD\0\0
 	.asciz	ELF_NOTE_MARCH_DESC
+	.p2align 2
 #endif



CVS commit: src/lib/csu/arch/vax

2014-03-16 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Mar 16 11:41:30 UTC 2014

Modified Files:
src/lib/csu/arch/vax: crtbegin.S

Log Message:
__do_global_ctors_aux and __do_global_ctors_aux must be used locally, so
mark them as hidden.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/csu/arch/vax/crtbegin.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/vax/crtbegin.S
diff -u src/lib/csu/arch/vax/crtbegin.S:1.6 src/lib/csu/arch/vax/crtbegin.S:1.7
--- src/lib/csu/arch/vax/crtbegin.S:1.6	Wed Jul 10 23:30:45 2013
+++ src/lib/csu/arch/vax/crtbegin.S	Sun Mar 16 11:41:30 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: crtbegin.S,v 1.6 2013/07/10 23:30:45 matt Exp $	*/
+/*	$NetBSD: crtbegin.S,v 1.7 2014/03/16 11:41:30 joerg Exp $	*/
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,7 +30,7 @@
 
 #include vax/asm.h
 
-RCSID($NetBSD: crtbegin.S,v 1.6 2013/07/10 23:30:45 matt Exp $)
+RCSID($NetBSD: crtbegin.S,v 1.7 2014/03/16 11:41:30 joerg Exp $)
 
 	.section	.ctors, aw, @progbits
 	.p2align 2
@@ -80,6 +80,8 @@ __dso_handle:
  * needed.
  */
 
+	.hidden __do_global_dtors_aux
+
 _ENTRY(__do_global_dtors_aux, 0x0100)		/* save r8 */
 	tstb	__finished			/* done this already? */
 	bneq	4f
@@ -128,6 +130,8 @@ END(__do_global_dtors_aux)
 	.weak	__register_frame_info
 	.weak	_Jv_RegisterClasses
 
+	.hidden __do_global_ctors_aux
+
 _ENTRY(__do_global_ctors_aux, 0x0800)
 	tstb	__initialized
 	bneq	4f



CVS commit: src/lib/csu/arch/ia64

2014-03-14 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Fri Mar 14 18:15:02 UTC 2014

Added Files:
src/lib/csu/arch/ia64: Makefile.inc crt0.S crtbegin.h crtend.S crti.S
crtn.S

Log Message:
Add crtstuff for ia64. Compile tested only


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/lib/csu/arch/ia64/Makefile.inc \
src/lib/csu/arch/ia64/crt0.S src/lib/csu/arch/ia64/crtbegin.h \
src/lib/csu/arch/ia64/crtend.S src/lib/csu/arch/ia64/crti.S \
src/lib/csu/arch/ia64/crtn.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/lib/csu/arch/ia64/Makefile.inc
diff -u /dev/null src/lib/csu/arch/ia64/Makefile.inc:1.1
--- /dev/null	Fri Mar 14 18:15:02 2014
+++ src/lib/csu/arch/ia64/Makefile.inc	Fri Mar 14 18:15:02 2014
@@ -0,0 +1,3 @@
+#	$NetBSD: Makefile.inc,v 1.1 2014/03/14 18:15:02 cherry Exp $
+
+CPPFLAGS+=	-DELFSIZE=64 -I${ARCHDIR}
Index: src/lib/csu/arch/ia64/crt0.S
diff -u /dev/null src/lib/csu/arch/ia64/crt0.S:1.1
--- /dev/null	Fri Mar 14 18:15:02 2014
+++ src/lib/csu/arch/ia64/crt0.S	Fri Mar 14 18:15:02 2014
@@ -0,0 +1,56 @@
+/* $NetBSD: crt0.S,v 1.1 2014/03/14 18:15:02 cherry Exp $ */
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Cherry G. Mathew of Backyard Innovations, UK, Ltd.
+ *
+ * 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.
+ *
+ * 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
+
+RCSID($NetBSD: crt0.S,v 1.1 2014/03/14 18:15:02 cherry Exp $)
+
+STRONG_ALIAS(_start,__start)
+	
+.proc __start
+.global __start
+
+/*
+ * Called with:
+ * 	in0 = cleanup
+ * 	in1 = obj
+ * 	in2 = ps_strings
+ * 	in3 = sp
+ * See: sys/arch/ia64/ia64/machdep.c:setregs()
+ */
+	
+__start:
+	.regstk 4, 0, 0, 0
+
+	mov sp = in3 /* Setup Memory Stack Pointer. */
+	alloc r31 = ar.pfs, 3, 0, 0, 0 /* Adjust backingstore for ___start() */
+	br.call.sptk.many rp = ___start
+
Index: src/lib/csu/arch/ia64/crtbegin.h
diff -u /dev/null src/lib/csu/arch/ia64/crtbegin.h:1.1
--- /dev/null	Fri Mar 14 18:15:02 2014
+++ src/lib/csu/arch/ia64/crtbegin.h	Fri Mar 14 18:15:02 2014
@@ -0,0 +1,41 @@
+/*-
+ * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry and
+ * Cherry G. Mathew of Backyard Innovations, UK, Ltd.
+ *
+ * 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.
+ *
+ * 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 

CVS commit: src/lib/csu/arch/powerpc

2014-03-06 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Mar  6 19:05:59 UTC 2014

Modified Files:
src/lib/csu/arch/powerpc: crti.S

Log Message:
Use _XENTRY


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/csu/arch/powerpc/crti.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/powerpc/crti.S
diff -u src/lib/csu/arch/powerpc/crti.S:1.3 src/lib/csu/arch/powerpc/crti.S:1.4
--- src/lib/csu/arch/powerpc/crti.S:1.3	Thu Feb 27 18:11:08 2014
+++ src/lib/csu/arch/powerpc/crti.S	Thu Mar  6 19:05:59 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: crti.S,v 1.3 2014/02/27 18:11:08 matt Exp $ */
+/* $NetBSD: crti.S,v 1.4 2014/03/06 19:05:59 matt Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -31,12 +31,12 @@
 
 #include powerpc/asm.h
 
-RCSID($NetBSD: crti.S,v 1.3 2014/02/27 18:11:08 matt Exp $)
+RCSID($NetBSD: crti.S,v 1.4 2014/03/06 19:05:59 matt Exp $)
 
 #include sysident.S
 
 	.section .init, ax, @progbits
-_ENTRY(_init)
+_XENTRY(_init)
 	mflr	%r0
 #ifdef _LP64
 	stdu	%r1, -(6*SZREG)(%r1)
@@ -47,7 +47,7 @@ _ENTRY(_init)
 #endif
 
 	.section .fini, ax, @progbits
-_ENTRY(_fini)
+_XENTRY(_fini)
 	mflr	%r0
 #ifdef _LP64
 	stdu	%r1, -(6*SZREG)(%r1)



CVS commit: src/lib/csu/powerpc64

2014-03-06 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Mar  7 07:23:49 UTC 2014

Removed Files:
src/lib/csu/powerpc64: Makefile crt0.c dot_init.h

Log Message:
these are obsolete.  Now using the common powerpc files in csu/arch/powerpc.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r0 src/lib/csu/powerpc64/Makefile
cvs rdiff -u -r1.4 -r0 src/lib/csu/powerpc64/crt0.c
cvs rdiff -u -r1.7 -r0 src/lib/csu/powerpc64/dot_init.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/csu/arch/powerpc

2014-02-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 27 16:47:48 UTC 2014

Modified Files:
src/lib/csu/arch/powerpc: crt0.S crtend.S crti.S crtn.S

Log Message:
Add powerpc64 support


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/csu/arch/powerpc/crt0.S
cvs rdiff -u -r1.2 -r1.3 src/lib/csu/arch/powerpc/crtend.S
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/powerpc/crti.S \
src/lib/csu/arch/powerpc/crtn.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/powerpc/crt0.S
diff -u src/lib/csu/arch/powerpc/crt0.S:1.4 src/lib/csu/arch/powerpc/crt0.S:1.5
--- src/lib/csu/arch/powerpc/crt0.S:1.4	Sat Jul  2 20:16:09 2011
+++ src/lib/csu/arch/powerpc/crt0.S	Thu Feb 27 16:47:48 2014
@@ -29,25 +29,34 @@
 
 #include powerpc/asm.h
 
-RCSID($NetBSD: crt0.S,v 1.4 2011/07/02 20:16:09 matt Exp $)
+RCSID($NetBSD: crt0.S,v 1.5 2014/02/27 16:47:48 matt Exp $)
 
 STRONG_ALIAS(_start,__start)
 
 	.hidden ___start
 
+#ifndef _LP64
 	.weak	_SDA_BASE_
+#endif
 
 ENTRY_NOPROFILE(__start)
+#ifndef _LP64
 	bcl	20,31,1f
 1:
 	mflr	%r11
 	/* SVR4 ABI says small data is in r13 */
 	addis	%r13,%r11,_SDA_BASE_-1b@ha
 	addi	%r13,%r13,_SDA_BASE_-1b@l
+#endif
 
 	mr	%r3,%r7		/* cleanup */
 	mr	%r4,%r6		/* obj */
 	mr	%r5,%r8		/* ps_strings */
 
+#ifdef _LP64
+	b	.___start
+	nop
+#else
 	b	___start
+#endif
 END(__start)

Index: src/lib/csu/arch/powerpc/crtend.S
diff -u src/lib/csu/arch/powerpc/crtend.S:1.2 src/lib/csu/arch/powerpc/crtend.S:1.3
--- src/lib/csu/arch/powerpc/crtend.S:1.2	Thu Jun 27 21:24:39 2013
+++ src/lib/csu/arch/powerpc/crtend.S	Thu Feb 27 16:47:48 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: crtend.S,v 1.2 2013/06/27 21:24:39 matt Exp $	*/
+/*	$NetBSD: crtend.S,v 1.3 2014/02/27 16:47:48 matt Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,26 +30,42 @@
 
 #include powerpc/asm.h
 
-RCSID($NetBSD: crtend.S,v 1.2 2013/06/27 21:24:39 matt Exp $)
+RCSID($NetBSD: crtend.S,v 1.3 2014/02/27 16:47:48 matt Exp $)
 
 	.section	.ctors, aw, @progbits
-	.p2align 2
+	.p2align P2SZREG
 	.global		__CTOR_LIST_END__
 	.hidden 	__CTOR_LIST_END__
 __CTOR_LIST_END__:
+#ifdef _LP64
+	.quad 0
+#else
 	.long 0
+#endif
 
 	.section	.dtors, aw, @progbits
-	.p2align 2
+	.p2align P2SZREG
 	.global		__DTOR_LIST_END__
 	.hidden 	__DTOR_LIST_END__
 __DTOR_LIST_END__:
+#ifdef _LP64
+	.quad 0
+#else
 	.long 0
+#endif
 
 	.section	.eh_frame, a, @progbits
-	.p2align 2
+	.p2align P2SZREG
+#ifdef _LP64
+	.quad 0
+#else
 	.long 0
+#endif
 
 	.section	.jcr, aw, @progbits
-	.p2align 2
+	.p2align P2SZREG
+#ifdef _LP64
+	.quad 0
+#else
 	.long 0
+#endif

Index: src/lib/csu/arch/powerpc/crti.S
diff -u src/lib/csu/arch/powerpc/crti.S:1.1 src/lib/csu/arch/powerpc/crti.S:1.2
--- src/lib/csu/arch/powerpc/crti.S:1.1	Tue Feb  8 02:02:25 2011
+++ src/lib/csu/arch/powerpc/crti.S	Thu Feb 27 16:47:48 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: crti.S,v 1.1 2011/02/08 02:02:25 matt Exp $ */
+/* $NetBSD: crti.S,v 1.2 2014/02/27 16:47:48 matt Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -31,20 +31,54 @@
 
 #include powerpc/asm.h
 
-RCSID($NetBSD: crti.S,v 1.1 2011/02/08 02:02:25 matt Exp $)
+RCSID($NetBSD: crti.S,v 1.2 2014/02/27 16:47:48 matt Exp $)
 
 #include sysident.S
 
+	.globl	_init
+	.type	_init,@function
 	.section .init, ax, @progbits
-	.align 2; .globl _init; .type _init,@function
+	.align	P2SZREG
+#ifdef _LP64
+	.globl	._init
+	.pushsection .opd, aw
+	.align	3
+_init:	.quad	._init,.TOC.@tocbase,0
+	.size	_init, (3*SZREG)
+	.popsection
+._init:
+#else
 _init:
+#endif
 	mflr	%r0
+#ifdef _LP64
+	stlongu	%r1, -(6*SZREG)(%r1)
+	stlong	%r0, (2*SZREG)(%r1)
+#else
 	stw	%r0, (1*SZREG)(%r1)
 	stwu	%r1, -(4*SZREG)(%r1)
+#endif
 
+	.globl _fini
+	.type	_fini,@function
 	.section .fini, ax, @progbits
-	.align 2; .globl _fini; .type _fini,@function
+	.align	P2SZREG
+#ifdef _LP64
+	.globl	._fini
+	.pushsection .opd, aw
+	.align	3
+_fini:	.quad	._fini,.TOC.@tocbase,0
+	.size	_fini, (3*SZREG)
+	.popsection
+._fini:
+#else
 _fini:
+#endif
 	mflr	%r0
+#ifdef _LP64
+	stlongu	%r1, -(6*SZREG)(%r1)
+	stlong	%r0, (2*SZREG)(%r1)
+#else
 	stw	%r0, (1*SZREG)(%r1)
 	stwu	%r1, -(4*SZREG)(%r1)
+#endif
Index: src/lib/csu/arch/powerpc/crtn.S
diff -u src/lib/csu/arch/powerpc/crtn.S:1.1 src/lib/csu/arch/powerpc/crtn.S:1.2
--- src/lib/csu/arch/powerpc/crtn.S:1.1	Tue Feb  8 02:02:25 2011
+++ src/lib/csu/arch/powerpc/crtn.S	Thu Feb 27 16:47:48 2014
@@ -29,16 +29,26 @@
 
 #include powerpc/asm.h
 
-RCSID($NetBSD: crtn.S,v 1.1 2011/02/08 02:02:25 matt Exp $)
+RCSID($NetBSD: crtn.S,v 1.2 2014/02/27 16:47:48 matt Exp $)
 
 	.section .init, ax, @progbits
+#ifdef _LP64
+	ldreg	%r0, (2*SZREG)(%r1)
+	addi	%r1, %r1, (6*SZREG)
+#else
 	addi	%r1, %r1, (4*SZREG)
 	lwz	%r0, (1*SZREG)(%r1)
+#endif
 	mtlr	%r0
 	blr
 
 	.section .fini, ax, @progbits
+#ifdef _LP64
+	ldreg	%r0, (2*SZREG)(%r1)
+	addi	%r1, %r1, (6*SZREG)
+#else
 	

CVS commit: src/lib/csu/arch/powerpc

2014-02-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 27 18:01:51 UTC 2014

Modified Files:
src/lib/csu/arch/powerpc: crt0.S

Log Message:
Use the CALL() macro.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/csu/arch/powerpc/crt0.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/powerpc/crt0.S
diff -u src/lib/csu/arch/powerpc/crt0.S:1.5 src/lib/csu/arch/powerpc/crt0.S:1.6
--- src/lib/csu/arch/powerpc/crt0.S:1.5	Thu Feb 27 16:47:48 2014
+++ src/lib/csu/arch/powerpc/crt0.S	Thu Feb 27 18:01:51 2014
@@ -29,7 +29,7 @@
 
 #include powerpc/asm.h
 
-RCSID($NetBSD: crt0.S,v 1.5 2014/02/27 16:47:48 matt Exp $)
+RCSID($NetBSD: crt0.S,v 1.6 2014/02/27 18:01:51 matt Exp $)
 
 STRONG_ALIAS(_start,__start)
 
@@ -53,10 +53,5 @@ ENTRY_NOPROFILE(__start)
 	mr	%r4,%r6		/* obj */
 	mr	%r5,%r8		/* ps_strings */
 
-#ifdef _LP64
-	b	.___start
-	nop
-#else
-	b	___start
-#endif
+	CALL(___start)
 END(__start)



CVS commit: src/lib/csu/arch/powerpc

2014-02-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 27 18:11:08 UTC 2014

Modified Files:
src/lib/csu/arch/powerpc: crti.S

Log Message:
Use _ENTRY


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/csu/arch/powerpc/crti.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/powerpc/crti.S
diff -u src/lib/csu/arch/powerpc/crti.S:1.2 src/lib/csu/arch/powerpc/crti.S:1.3
--- src/lib/csu/arch/powerpc/crti.S:1.2	Thu Feb 27 16:47:48 2014
+++ src/lib/csu/arch/powerpc/crti.S	Thu Feb 27 18:11:08 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: crti.S,v 1.2 2014/02/27 16:47:48 matt Exp $ */
+/* $NetBSD: crti.S,v 1.3 2014/02/27 18:11:08 matt Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -31,53 +31,27 @@
 
 #include powerpc/asm.h
 
-RCSID($NetBSD: crti.S,v 1.2 2014/02/27 16:47:48 matt Exp $)
+RCSID($NetBSD: crti.S,v 1.3 2014/02/27 18:11:08 matt Exp $)
 
 #include sysident.S
 
-	.globl	_init
-	.type	_init,@function
 	.section .init, ax, @progbits
-	.align	P2SZREG
-#ifdef _LP64
-	.globl	._init
-	.pushsection .opd, aw
-	.align	3
-_init:	.quad	._init,.TOC.@tocbase,0
-	.size	_init, (3*SZREG)
-	.popsection
-._init:
-#else
-_init:
-#endif
+_ENTRY(_init)
 	mflr	%r0
 #ifdef _LP64
-	stlongu	%r1, -(6*SZREG)(%r1)
-	stlong	%r0, (2*SZREG)(%r1)
+	stdu	%r1, -(6*SZREG)(%r1)
+	std	%r0, (2*SZREG)(%r1)
 #else
 	stw	%r0, (1*SZREG)(%r1)
 	stwu	%r1, -(4*SZREG)(%r1)
 #endif
 
-	.globl _fini
-	.type	_fini,@function
 	.section .fini, ax, @progbits
-	.align	P2SZREG
-#ifdef _LP64
-	.globl	._fini
-	.pushsection .opd, aw
-	.align	3
-_fini:	.quad	._fini,.TOC.@tocbase,0
-	.size	_fini, (3*SZREG)
-	.popsection
-._fini:
-#else
-_fini:
-#endif
+_ENTRY(_fini)
 	mflr	%r0
 #ifdef _LP64
-	stlongu	%r1, -(6*SZREG)(%r1)
-	stlong	%r0, (2*SZREG)(%r1)
+	stdu	%r1, -(6*SZREG)(%r1)
+	std	%r0, (2*SZREG)(%r1)
 #else
 	stw	%r0, (1*SZREG)(%r1)
 	stwu	%r1, -(4*SZREG)(%r1)



CVS commit: src/lib/csu/common

2014-02-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb 26 14:54:51 UTC 2014

Modified Files:
src/lib/csu/common: compident.S

Log Message:
Make the .note section mergable and set proper item length.
XXX seems to be impossible to do that with gas w/o causing a (bogus)
warning - but the resulting object file is fine.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/common/compident.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/compident.S
diff -u src/lib/csu/common/compident.S:1.1 src/lib/csu/common/compident.S:1.2
--- src/lib/csu/common/compident.S:1.1	Thu Nov 14 12:19:34 2013
+++ src/lib/csu/common/compident.S	Wed Feb 26 14:54:50 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: compident.S,v 1.1 2013/11/14 12:19:34 martin Exp $ */
+/* $NetBSD: compident.S,v 1.2 2014/02/26 14:54:50 martin Exp $ */
 
 /*-
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -55,7 +55,7 @@
 
 #include sysident_assym.h
 
-	.section .note.netbsd.mcmodel, a
+	.section .note.netbsd.mcmodel,aM,@note,3*4+CONTENTLENGTH+ELF_NOTE_MCMODEL_NAMESZ+1
 	.p2align 2
 
 	.long	ELF_NOTE_MCMODEL_NAMESZ



CVS commit: src/lib/csu/sh3_elf

2014-02-26 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Feb 27 02:14:27 UTC 2014

Removed Files:
src/lib/csu/sh3_elf: Makefile crt0.c dot_init.h

Log Message:
G/c old unused sh3 csu.  Requested by joerg@


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r0 src/lib/csu/sh3_elf/Makefile
cvs rdiff -u -r1.12 -r0 src/lib/csu/sh3_elf/crt0.c
cvs rdiff -u -r1.7 -r0 src/lib/csu/sh3_elf/dot_init.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/csu

2014-02-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  1 11:59:00 UTC 2014

Removed Files:
src/lib/csu/sparc64: Makefile crt0.c
src/lib/csu/sparc_elf: Makefile crt0.c dot_init.h

Log Message:
sparc and sparc64 have moved to new world order, remove legacy files.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r0 src/lib/csu/sparc64/Makefile
cvs rdiff -u -r1.27 -r0 src/lib/csu/sparc64/crt0.c
cvs rdiff -u -r1.7 -r0 src/lib/csu/sparc_elf/Makefile
cvs rdiff -u -r1.15 -r0 src/lib/csu/sparc_elf/crt0.c
cvs rdiff -u -r1.9 -r0 src/lib/csu/sparc_elf/dot_init.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/csu

2014-01-31 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jan 31 11:58:34 UTC 2014

Removed Files:
src/lib/csu/alpha: Makefile crt0.c crtfm.c dot_init.h
src/lib/csu/mips: Makefile crt0.c dot_init.h
src/lib/csu/powerpc: Makefile crt0.c dot_init.h
src/lib/csu/vax_elf: Makefile crt0.c dot_init.h

Log Message:
Remove old compiler based crt stuff for alpha mips powerpc and vax


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r0 src/lib/csu/alpha/Makefile
cvs rdiff -u -r1.27 -r0 src/lib/csu/alpha/crt0.c
cvs rdiff -u -r1.2 -r0 src/lib/csu/alpha/crtfm.c
cvs rdiff -u -r1.8 -r0 src/lib/csu/alpha/dot_init.h
cvs rdiff -u -r1.24 -r0 src/lib/csu/mips/Makefile
cvs rdiff -u -r1.22 -r0 src/lib/csu/mips/crt0.c
cvs rdiff -u -r1.10 -r0 src/lib/csu/mips/dot_init.h
cvs rdiff -u -r1.13 -r0 src/lib/csu/powerpc/Makefile
cvs rdiff -u -r1.30 -r0 src/lib/csu/powerpc/crt0.c
cvs rdiff -u -r1.8 -r0 src/lib/csu/powerpc/dot_init.h
cvs rdiff -u -r1.3 -r0 src/lib/csu/vax_elf/Makefile
cvs rdiff -u -r1.12 -r0 src/lib/csu/vax_elf/crt0.c
cvs rdiff -u -r1.8 -r0 src/lib/csu/vax_elf/dot_init.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/csu/common

2014-01-29 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Wed Jan 29 20:57:49 UTC 2014

Modified Files:
src/lib/csu/common: crtbegin.c

Log Message:
Also make sure the __CTOR_LIST__ is just aligned to a pointer boundary.
By default, mips N32 will aligned to a 64-bit boundary not 32-bit
which causes an extra NULL entry to be added.
Fix segfault on exit several people have noticed on mips N32,
caused by a jr to a NULL address.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/csu/common/crtbegin.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/crtbegin.c
diff -u src/lib/csu/common/crtbegin.c:1.7 src/lib/csu/common/crtbegin.c:1.8
--- src/lib/csu/common/crtbegin.c:1.7	Wed Dec 11 06:55:24 2013
+++ src/lib/csu/common/crtbegin.c	Wed Jan 29 20:57:49 2014
@@ -27,7 +27,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: crtbegin.c,v 1.7 2013/12/11 06:55:24 matt Exp $);
+__RCSID($NetBSD: crtbegin.c,v 1.8 2014/01/29 20:57:49 bouyer Exp $);
 
 #include crtbegin.h
 
@@ -98,7 +98,7 @@ __do_global_ctors_aux(void)
 
 #if !defined(__ARM_EABI__) || defined(SHARED)
 #if !defined(HAVE_INITFINI_ARRAY)
-__dso_hidden const fptr_t __DTOR_LIST__[] __section(.dtors) = {
+__dso_hidden const fptr_t __aligned(sizeof(void *)) __DTOR_LIST__[] __section(.dtors) = {
 	(fptr_t) -1,
 };
 __dso_hidden extern const fptr_t __DTOR_LIST_END__[];



CVS commit: src/lib/csu/common

2014-01-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jan 11 00:18:15 UTC 2014

Modified Files:
src/lib/csu/common: Makefile.inc

Log Message:
Using ${LD} -x screws up BE arm.  Use ${OBJCOPY} ${OBJCOPYLIBFLAGS} instead
so the $a/$t/$d symbols are preserved.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/lib/csu/common/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/Makefile.inc
diff -u src/lib/csu/common/Makefile.inc:1.23 src/lib/csu/common/Makefile.inc:1.24
--- src/lib/csu/common/Makefile.inc:1.23	Sun Nov 17 11:16:09 2013
+++ src/lib/csu/common/Makefile.inc	Sat Jan 11 00:18:15 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.23 2013/11/17 11:16:09 martin Exp $
+#	$NetBSD: Makefile.inc,v 1.24 2014/01/11 00:18:15 matt Exp $
 
 .include bsd.own.mk
 
@@ -42,7 +42,7 @@ crtbegin.o: crtbegin.c crtbegin.h
 	${_MKTARGET_COMPILE}
 	${COMPILE.c} ${CFLAGS.crtbegin.c} ${COMMON_DIR}/crtbegin.c -o ${.TARGET}.o
 .endif
-	${LD} -x -r -o ${.TARGET} ${.TARGET}.o
+	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}.o ${.TARGET} 
 	rm -f ${.TARGET}.o
 .if ${MKSTRIPIDENT} != no
 	${OBJCOPY} -R .ident ${.TARGET}
@@ -57,7 +57,7 @@ crtbeginS.o: crtbegin.c crtbegin.h
 	${_MKTARGET_COMPILE}
 	${COMPILE.c} ${PICFLAGS} -DSHARED ${COMMON_DIR}/crtbegin.c -o ${.TARGET}.o
 .endif
-	${LD} -x -r -o ${.TARGET} ${.TARGET}.o
+	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}.o ${.TARGET} 
 	rm -f ${.TARGET}.o
 .if ${MKSTRIPIDENT} != no
 	${OBJCOPY} -R .ident ${.TARGET}
@@ -66,7 +66,7 @@ crtbeginS.o: crtbegin.c crtbegin.h
 crtend.o: crtend.S
 	${_MKTARGET_COMPILE}
 	${COMPILE.S} ${ARCHDIR}/crtend.S -o ${.TARGET}.o
-	${LD} -x -r -o ${.TARGET} ${.TARGET}.o
+	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}.o ${.TARGET} 
 	rm -f ${.TARGET}.o
 .if ${MKSTRIPIDENT} != no
 	${OBJCOPY} -R .ident ${.TARGET}
@@ -82,8 +82,9 @@ crt0.o: crt0.S crt0-common.c
 	${_MKTARGET_COMPILE}
 	${COMPILE.S} ${ARCHDIR}/crt0.S -o ${.TARGET}.S.o
 	${COMPILE.c} ${MY_PICFLAGS} ${COMMON_DIR}/crt0-common.c -o ${.TARGET}.c.o
-	${LD} -x -r -o ${.TARGET} ${.TARGET}.S.o ${.TARGET}.c.o
-	rm -f ${.TARGET}.S.o ${.TARGET}.c.o
+	${LD} -r -o ${.TARGET}.o ${.TARGET}.S.o ${.TARGET}.c.o
+	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}.o ${.TARGET} 
+	rm -f ${.TARGET}.S.o ${.TARGET}.c.o ${.TARGET}.o
 .if ${MKSTRIPIDENT} != no
 	${OBJCOPY} -R .ident ${.TARGET}
 .endif
@@ -92,8 +93,9 @@ gcrt0.o: crt0.S crt0-common.c
 	${_MKTARGET_COMPILE}
 	${COMPILE.S} ${ARCHDIR}/crt0.S -o ${.TARGET}.S.o
 	${COMPILE.c} ${MY_PICFLAGS} -DMCRT0 ${COMMON_DIR}/crt0-common.c -o ${.TARGET}.c.o
-	${LD} -x -r -o ${.TARGET} ${.TARGET}.S.o ${.TARGET}.c.o
-	rm -f ${.TARGET}.S.o ${.TARGET}.c.o
+	${LD} -r -o ${.TARGET}.o ${.TARGET}.S.o ${.TARGET}.c.o
+	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}.o ${.TARGET} 
+	rm -f ${.TARGET}.S.o ${.TARGET}.c.o ${.TARGET}.o
 .if ${MKSTRIPIDENT} != no
 	${OBJCOPY} -R .ident ${.TARGET}
 .endif
@@ -103,7 +105,7 @@ gcrt0.o: crt0.S crt0-common.c
 crtfm.o: crtfm.c
 	${_MKTARGET_COMPILE}
 	${COMPILE.c} ${.ALLSRC} -o ${.TARGET}.o
-	${LD} -x -r -o ${.TARGET} ${.TARGET}.o
+	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}.o ${.TARGET} 
 	rm -f ${.TARGET}.o
 .endif
 



CVS commit: src/lib/csu/arch/earm

2013-12-20 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Dec 20 15:35:48 UTC 2013

Modified Files:
src/lib/csu/arch/earm: crtend.S

Log Message:
Drop .fpu. Discussed with Matt.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/earm/crtend.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/earm/crtend.S
diff -u src/lib/csu/arch/earm/crtend.S:1.1 src/lib/csu/arch/earm/crtend.S:1.2
--- src/lib/csu/arch/earm/crtend.S:1.1	Mon Aug 13 02:49:04 2012
+++ src/lib/csu/arch/earm/crtend.S	Fri Dec 20 15:35:48 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: crtend.S,v 1.1 2012/08/13 02:49:04 matt Exp $	*/
+/*	$NetBSD: crtend.S,v 1.2 2013/12/20 15:35:48 joerg Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,9 +30,8 @@
 
 #include arm/asm.h
 
-RCSID($NetBSD: crtend.S,v 1.1 2012/08/13 02:49:04 matt Exp $)
+RCSID($NetBSD: crtend.S,v 1.2 2013/12/20 15:35:48 joerg Exp $)
 
-	.fpu softvfp
 	.eabi_attribute 18, 4		/* sizeof(wchar_t) */
 	.eabi_attribute 23, 0		/* doesn't use floating point */
 	.eabi_attribute 24, 1		/* 8 byte alignment permitted */



CVS commit: src/lib/csu/common

2013-12-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Dec 11 06:55:25 UTC 2013

Modified Files:
src/lib/csu/common: crtbegin.c

Log Message:
Make sure the __CTOR_LIST__ is just aligned to a pointer boundary.
By default, mips N32 will aligned to a 64-bit boundary not 32-bit
which causes an extra NULL entry to be added.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/csu/common/crtbegin.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/crtbegin.c
diff -u src/lib/csu/common/crtbegin.c:1.6 src/lib/csu/common/crtbegin.c:1.7
--- src/lib/csu/common/crtbegin.c:1.6	Fri Nov 29 23:00:48 2013
+++ src/lib/csu/common/crtbegin.c	Wed Dec 11 06:55:24 2013
@@ -27,7 +27,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: crtbegin.c,v 1.6 2013/11/29 23:00:48 joerg Exp $);
+__RCSID($NetBSD: crtbegin.c,v 1.7 2013/12/11 06:55:24 matt Exp $);
 
 #include crtbegin.h
 
@@ -39,7 +39,7 @@ __weakref_visible void Jv_RegisterClasse
 	__weak_reference(_Jv_RegisterClasses);
 
 #if !defined(HAVE_INITFINI_ARRAY)
-__dso_hidden const fptr_t __CTOR_LIST__[] __section(.ctors) = {
+__dso_hidden const fptr_t __aligned(sizeof(void *)) __CTOR_LIST__[] __section(.ctors) = {
 	(fptr_t) -1,
 };
 __dso_hidden extern const fptr_t __CTOR_LIST_END__[];



CVS commit: src/lib/csu/arch/mips

2013-12-07 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Dec  8 06:32:36 UTC 2013

Modified Files:
src/lib/csu/arch/mips: crt0.S

Log Message:
Make sure t9 ($25) is properly set before calling ___start


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/csu/arch/mips/crt0.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/mips/crt0.S
diff -u src/lib/csu/arch/mips/crt0.S:1.2 src/lib/csu/arch/mips/crt0.S:1.3
--- src/lib/csu/arch/mips/crt0.S:1.2	Tue Jun 25 16:47:47 2013
+++ src/lib/csu/arch/mips/crt0.S	Sun Dec  8 06:32:36 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.S,v 1.2 2013/06/25 16:47:47 matt Exp $ */
+/* $NetBSD: crt0.S,v 1.3 2013/12/08 06:32:36 matt Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include mips/asm.h
 
-RCSID($NetBSD: crt0.S,v 1.2 2013/06/25 16:47:47 matt Exp $)
+RCSID($NetBSD: crt0.S,v 1.3 2013/12/08 06:32:36 matt Exp $)
 
 STRONG_ALIAS(_start,__start)
 
@@ -53,6 +53,8 @@ NESTED_NOPROFILE(__start, CALLFRAME_SIZ,
 	SETUP_GP64(t3, __start)
 	move	a0, a1		/* cleanup */
 	move	a1, a2		/* Obj_Entry */
-	move	a2, a3		/* ps_strings */
-	j	_C_LABEL(___start)
+	PTR_L	t9,%call16(_C_LABEL(___start))(gp)
+	 move	a2, a3		/* ps_strings */
+	.reloc  1f,R_MIPS_JALR,___start
+1:	jr	t9
 END(__start)



CVS commit: src/lib/csu/common

2013-11-29 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Nov 29 23:00:49 UTC 2013

Modified Files:
src/lib/csu/common: crtbegin.c

Log Message:
Include crtbegin.h first to make it possible to build with the stricter
attribute consistency checks in clang.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/csu/common/crtbegin.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/crtbegin.c
diff -u src/lib/csu/common/crtbegin.c:1.5 src/lib/csu/common/crtbegin.c:1.6
--- src/lib/csu/common/crtbegin.c:1.5	Mon Aug 26 14:20:53 2013
+++ src/lib/csu/common/crtbegin.c	Fri Nov 29 23:00:48 2013
@@ -27,7 +27,9 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: crtbegin.c,v 1.5 2013/08/26 14:20:53 matt Exp $);
+__RCSID($NetBSD: crtbegin.c,v 1.6 2013/11/29 23:00:48 joerg Exp $);
+
+#include crtbegin.h
 
 typedef void (*fptr_t)(void);
 
@@ -131,5 +133,3 @@ __do_global_dtors_aux(void)
 #endif
 }
 #endif /* !__ARM_EABI__ || SHARED */
-
-#include crtbegin.h



CVS commit: src/lib/csu/common

2013-11-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov 17 11:16:09 UTC 2013

Modified Files:
src/lib/csu/common: Makefile.inc

Log Message:
Simplify previous by using CSU_MACHINE_ARCH. Hint from Takeshi Nakayama.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/lib/csu/common/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/Makefile.inc
diff -u src/lib/csu/common/Makefile.inc:1.22 src/lib/csu/common/Makefile.inc:1.23
--- src/lib/csu/common/Makefile.inc:1.22	Sat Nov 16 10:50:43 2013
+++ src/lib/csu/common/Makefile.inc	Sun Nov 17 11:16:09 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.22 2013/11/16 10:50:43 martin Exp $
+#	$NetBSD: Makefile.inc,v 1.23 2013/11/17 11:16:09 martin Exp $
 
 .include bsd.own.mk
 
@@ -21,7 +21,7 @@ CFLAGS.crtbegin.c+= -fPIE
 OBJS+=		crtfm.o
 .endif
 
-.if ${MACHINE_ARCH} == sparc64  ${COPTS:M-m32} == 
+.if ${CSU_MACHINE_ARCH} == sparc64
 # create helper objects for the compiler to mark compiler memory models
 .for m in medlow medmid medany
 sparc_mc${m}.o:	compident.S sysident_assym.h



CVS commit: src/lib/csu/common

2013-11-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Nov 16 10:50:43 UTC 2013

Modified Files:
src/lib/csu/common: Makefile.inc

Log Message:
We do not want to build the code model markes when creating the 32bit
compat libs for sparc64


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/lib/csu/common/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/Makefile.inc
diff -u src/lib/csu/common/Makefile.inc:1.21 src/lib/csu/common/Makefile.inc:1.22
--- src/lib/csu/common/Makefile.inc:1.21	Thu Nov 14 12:19:34 2013
+++ src/lib/csu/common/Makefile.inc	Sat Nov 16 10:50:43 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.21 2013/11/14 12:19:34 martin Exp $
+#	$NetBSD: Makefile.inc,v 1.22 2013/11/16 10:50:43 martin Exp $
 
 .include bsd.own.mk
 
@@ -21,7 +21,7 @@ CFLAGS.crtbegin.c+= -fPIE
 OBJS+=		crtfm.o
 .endif
 
-.if ${MACHINE_ARCH} == sparc64
+.if ${MACHINE_ARCH} == sparc64  ${COPTS:M-m32} == 
 # create helper objects for the compiler to mark compiler memory models
 .for m in medlow medmid medany
 sparc_mc${m}.o:	compident.S sysident_assym.h



CVS commit: src/lib/csu/common

2013-11-11 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Nov 11 10:24:27 UTC 2013

Modified Files:
src/lib/csu/common: Makefile.inc

Log Message:
Explicitly depend on sys/param.h to pick up __NetBSD_Version changes.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/lib/csu/common/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/Makefile.inc
diff -u src/lib/csu/common/Makefile.inc:1.19 src/lib/csu/common/Makefile.inc:1.20
--- src/lib/csu/common/Makefile.inc:1.19	Wed Sep 18 22:53:39 2013
+++ src/lib/csu/common/Makefile.inc	Mon Nov 11 10:24:27 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.19 2013/09/18 22:53:39 uwe Exp $
+#	$NetBSD: Makefile.inc,v 1.20 2013/11/11 10:24:27 joerg Exp $
 
 .include bsd.own.mk
 
@@ -98,7 +98,7 @@ crtfm.o: crtfm.c
 .endif
 
 GENASSYM_CONF=	${COMMON_DIR}/sysident_assym.cf 
-sysident_assym.h: ${GENASSYM_CONF} ${GENASSYM_EXTRAS}
+sysident_assym.h: ${GENASSYM_CONF} ${GENASSYM_EXTRAS} ${NETBSDSRCDIR}/sys/sys/param.h
 	${_MKTARGET_CREATE}
 	cat ${COMMON_DIR}/sysident_assym.cf | \
 	${TOOL_GENASSYM} -- ${CC} ${CFLAGS:N-Wa,*} ${CPPFLAGS} ${PROF} \



CVS commit: src/lib/csu/common

2013-09-18 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed Sep 18 22:53:39 UTC 2013

Modified Files:
src/lib/csu/common: Makefile.inc

Log Message:
Fix previous: use PICFLAGS for crtbeginS.o
Should unbreak sh3 builds.

XXX: PICFLAGS is defined in bsd.lib.mk which lib/csu does not use.
For now supply a local definition.  joerg@, please fix appropriately.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/lib/csu/common/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/Makefile.inc
diff -u src/lib/csu/common/Makefile.inc:1.18 src/lib/csu/common/Makefile.inc:1.19
--- src/lib/csu/common/Makefile.inc:1.18	Thu Sep 12 15:36:15 2013
+++ src/lib/csu/common/Makefile.inc	Wed Sep 18 22:53:39 2013
@@ -1,7 +1,10 @@
-#	$NetBSD: Makefile.inc,v 1.18 2013/09/12 15:36:15 joerg Exp $
+#	$NetBSD: Makefile.inc,v 1.19 2013/09/18 22:53:39 uwe Exp $
 
 .include bsd.own.mk
 
+# XXX: FIXME: This is defined in bsd.lib.mk
+PICFLAGS ?= -fPIC
+
 COMMON_DIR:=	${.CURDIR}/common
 .PATH:		${COMMON_DIR}
 
@@ -38,11 +41,11 @@ crtbegin.o: crtbegin.c crtbegin.h
 .if exists(${ARCHDIR}/crtbegin.S)
 crtbeginS.o: crtbegin.S
 	${_MKTARGET_COMPILE}
-	${COMPILE.S} -DPIC -DSHARED ${ARCHDIR}/crtbegin.S -o ${.TARGET}.o
+	${COMPILE.S} ${PICFLAGS} -DSHARED ${ARCHDIR}/crtbegin.S -o ${.TARGET}.o
 .else
 crtbeginS.o: crtbegin.c crtbegin.h
 	${_MKTARGET_COMPILE}
-	${COMPILE.c} -fPIC -DPIC -DSHARED ${COMMON_DIR}/crtbegin.c -o ${.TARGET}.o
+	${COMPILE.c} ${PICFLAGS} -DSHARED ${COMMON_DIR}/crtbegin.c -o ${.TARGET}.o
 .endif
 	${LD} -x -r -o ${.TARGET} ${.TARGET}.o
 	rm -f ${.TARGET}.o



CVS commit: src/lib/csu

2013-09-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Sep 10 16:45:33 UTC 2013

Modified Files:
src/lib/csu: Makefile
src/lib/csu/arch/earm: Makefile.inc
src/lib/csu/common: Makefile.inc sysident.S sysident_assym.cf

Log Message:
Add support for a NetBSD MARCH elf note to record the MACHINE_ARCH for
which a program was compiled.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/lib/csu/Makefile
cvs rdiff -u -r1.2 -r1.3 src/lib/csu/arch/earm/Makefile.inc
cvs rdiff -u -r1.16 -r1.17 src/lib/csu/common/Makefile.inc
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/common/sysident.S \
src/lib/csu/common/sysident_assym.cf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/Makefile
diff -u src/lib/csu/Makefile:1.32 src/lib/csu/Makefile:1.33
--- src/lib/csu/Makefile:1.32	Sun Apr 28 06:09:52 2013
+++ src/lib/csu/Makefile	Tue Sep 10 16:45:33 2013
@@ -1,24 +1,21 @@
-#	$NetBSD: Makefile,v 1.32 2013/04/28 06:09:52 matt Exp $
+#	$NetBSD: Makefile,v 1.33 2013/09/10 16:45:33 matt Exp $
 
 .include bsd.own.mk
 
 .if ${USE_COMPILERCRTSTUFF} != yes
 
-.if defined(CSU_MACHINE_ARCH)
-.  if !exists(${.CURDIR}/arch/${CSU_MACHINE_ARCH}/Makefile.inc)
-.  error CSU_MACHINE_ARCH (${CSU_MACHINE_ARCH}) is unsupported
-.  endif
-.elif !empty(MACHINE_ARCH:Mearm*)
-CSU_MACHINE_ARCH=	earm
-.elif exists(${.CURDIR}/arch/${MACHINE_ARCH}/Makefile.inc)
-CSU_MACHINE_ARCH=	${MACHINE_ARCH}
+CSU_MACHINE_ARCH?=	${MACHINE_ARCH}
+
+.if !empty(CSU_MACHINE_ARCH:Mearm*)
+ARCHDIR:=	${.CURDIR}/arch/earm
+.elif exists(${.CURDIR}/arch/${CSU_MACHINE_ARCH}/Makefile.inc)
+ARCHDIR:=	${.CURDIR}/arch/${CSU_MACHINE_ARCH}
 .elif exists(${.CURDIR}/arch/${MACHINE_CPU}/Makefile.inc)
-CSU_MACHINE_ARCH=	${MACHINE_CPU}
+ARCHDIR:=	${.CURDIR}/arch/${MACHINE_CPU}
 .else
-.error Architecture (${MACHINE_ARCH} or ${MACHINE_CPU}) unsupported
+.error Architecture (${CSU_MACHINE_ARCH} or ${MACHINE_CPU}) unsupported
 .endif
 
-ARCHDIR:=	${.CURDIR}/arch/${CSU_MACHINE_ARCH}
 
 .PATH:	${ARCHDIR}
 .  include ${ARCHDIR}/Makefile.inc

Index: src/lib/csu/arch/earm/Makefile.inc
diff -u src/lib/csu/arch/earm/Makefile.inc:1.2 src/lib/csu/arch/earm/Makefile.inc:1.3
--- src/lib/csu/arch/earm/Makefile.inc:1.2	Thu Jun 27 21:24:39 2013
+++ src/lib/csu/arch/earm/Makefile.inc	Tue Sep 10 16:45:33 2013
@@ -1,5 +1,5 @@
-# $NetBSD: Makefile.inc,v 1.2 2013/06/27 21:24:39 matt Exp $
+# $NetBSD: Makefile.inc,v 1.3 2013/09/10 16:45:33 matt Exp $
 
 CPPFLAGS+=	-I${ARCHDIR}
 CPPFLAGS+=	-DHAVE_INITFINI_ARRAY
-
+CPPFLAGS+=	-DELF_NOTE_MARCH_DESC=\${CSU_MACHINE_ARCH}\

Index: src/lib/csu/common/Makefile.inc
diff -u src/lib/csu/common/Makefile.inc:1.16 src/lib/csu/common/Makefile.inc:1.17
--- src/lib/csu/common/Makefile.inc:1.16	Mon Aug  5 13:38:35 2013
+++ src/lib/csu/common/Makefile.inc	Tue Sep 10 16:45:33 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.16 2013/08/05 13:38:35 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.17 2013/09/10 16:45:33 matt Exp $
 
 .include bsd.own.mk
 
@@ -94,6 +94,7 @@ crtfm.o: crtfm.c
 	rm -f ${.TARGET}.o
 .endif
 
+GENASSYM_CONF=	${COMMON_DIR}/sysident_assym.cf 
 sysident_assym.h: ${GENASSYM_CONF} ${GENASSYM_EXTRAS}
 	${_MKTARGET_CREATE}
 	cat ${COMMON_DIR}/sysident_assym.cf | \
@@ -103,7 +104,7 @@ sysident_assym.h: ${GENASSYM_CONF} ${GEN
 
 CLEANFILES+=	sysident_assym.h
 
-crti.o: crti.S sysident_assym.h
+crti.o: crti.S sysident_assym.h sysident.S
 crtn.o: crtn.S
 
 FILES=${OBJS}

Index: src/lib/csu/common/sysident.S
diff -u src/lib/csu/common/sysident.S:1.1 src/lib/csu/common/sysident.S:1.2
--- src/lib/csu/common/sysident.S:1.1	Sat Aug  7 18:01:33 2010
+++ src/lib/csu/common/sysident.S	Tue Sep 10 16:45:33 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: sysident.S,v 1.1 2010/08/07 18:01:33 joerg Exp $ */
+/* $NetBSD: sysident.S,v 1.2 2013/09/10 16:45:33 matt Exp $ */
 
 /*
  * Copyright (c) 1997 Christopher G. Demetriou
@@ -59,7 +59,7 @@
 #include sysident_assym.h
 
 	.section .note.netbsd.ident, a
-	.align 4
+	.p2align 2
 
 	.long	ELF_NOTE_NETBSD_NAMESZ
 	.long	ELF_NOTE_NETBSD_DESCSZ
@@ -68,10 +68,21 @@
 	.long	__NetBSD_Version__
 
 	.section .note.netbsd.pax, a
-	.align 4
+	.p2align 2
 
 	.long	ELF_NOTE_PAX_NAMESZ
 	.long	ELF_NOTE_PAX_DESCSZ
 	.long	ELF_NOTE_TYPE_PAX_TAG
 	.ascii	PaX\0		/* ELF_NOTE_PAX_NAME */
 	.long	0
+
+#ifdef ELF_NOTE_MARCH_DESC
+	.section .note.netbsd.march, a
+	.p2align 2
+
+	.long	ELF_NOTE_MARCH_NAMESZ
+	.long	ELF_NOTE_MARCH_DESCSZ
+	.long	ELF_NOTE_TYPE_MARCH_TAG
+	.ascii	NetBSD\0\0
+	.asciz	ELF_NOTE_MARCH_DESC
+#endif
Index: src/lib/csu/common/sysident_assym.cf
diff -u src/lib/csu/common/sysident_assym.cf:1.1 src/lib/csu/common/sysident_assym.cf:1.2
--- src/lib/csu/common/sysident_assym.cf:1.1	Sat Aug  7 18:01:33 2010
+++ src/lib/csu/common/sysident_assym.cf	Tue Sep 10 16:45:33 2013
@@ -10,3 +10,9 @@ define	ELF_NOTE_PAX_NAMESZ		ELF_NOTE_PAX
 define	ELF_NOTE_PAX_DESCSZ		ELF_NOTE_PAX_DESCSZ
 define	ELF_NOTE_TYPE_PAX_TAG		

CVS commit: src/lib/csu/common

2013-09-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Sep 10 17:23:55 UTC 2013

Modified Files:
src/lib/csu/common: sysident_assym.cf

Log Message:
MARCH note is conditional


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/csu/common/sysident_assym.cf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/sysident_assym.cf
diff -u src/lib/csu/common/sysident_assym.cf:1.2 src/lib/csu/common/sysident_assym.cf:1.3
--- src/lib/csu/common/sysident_assym.cf:1.2	Tue Sep 10 16:45:33 2013
+++ src/lib/csu/common/sysident_assym.cf	Tue Sep 10 17:23:55 2013
@@ -11,8 +11,10 @@ define	ELF_NOTE_PAX_DESCSZ		ELF_NOTE_PAX
 define	ELF_NOTE_TYPE_PAX_TAG		ELF_NOTE_TYPE_PAX_TAG
 #define	ELF_NOTE_PAX_NAME		ELF_NOTE_PAX_NAME
 
+ifdef ELF_NOTE_MARCH_DESC
 define	ELF_NOTE_MARCH_NAMESZ		ELF_NOTE_MARCH_NAMESZ
 define	ELF_NOTE_MARCH_DESCSZ		sizeof(ELF_NOTE_MARCH_DESC)
 define	ELF_NOTE_TYPE_MARCH_TAG		ELF_NOTE_TYPE_MARCH_TAG
 #define	ELF_NOTE_MARCH_NAME		ELF_NOTE_MARCH_NAME
 #define	ELF_NOTE_MARCH_DESC		ELF_NOTE_MARCH_DESC
+endif



CVS commit: src/lib/csu/arch/arm

2013-09-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Sep 10 22:00:01 UTC 2013

Modified Files:
src/lib/csu/arch/arm: Makefile.inc

Log Message:
Define ELF_NOTE_MARCH_DESC for when running non-eabi in compat_netbsd32


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/csu/arch/arm/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/arm/Makefile.inc
diff -u src/lib/csu/arch/arm/Makefile.inc:1.6 src/lib/csu/arch/arm/Makefile.inc:1.7
--- src/lib/csu/arch/arm/Makefile.inc:1.6	Thu Jun 27 21:24:39 2013
+++ src/lib/csu/arch/arm/Makefile.inc	Tue Sep 10 22:00:01 2013
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile.inc,v 1.6 2013/06/27 21:24:39 matt Exp $
+# $NetBSD: Makefile.inc,v 1.7 2013/09/10 22:00:01 matt Exp $
 
 CPPFLAGS+=	-I${ARCHDIR}
 .if (!empty(CPUFLAGS)  ${CPUFLAGS:M-mabi=aapcs*} != )
 CPPFLAGS+=  -DHAVE_INITFINI_ARRAY
 .endif
+CPPFLAGS+=	-DELF_NOTE_MARCH_DESC=\${CSU_MACHINE_ARCH}\



CVS commit: src/lib/csu/arch/earm

2013-09-04 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Sep  5 00:27:38 UTC 2013

Modified Files:
src/lib/csu/arch/earm: crt0.S

Log Message:
bic sp not allowed in thumb (even with thumb2)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/csu/arch/earm/crt0.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/earm/crt0.S
diff -u src/lib/csu/arch/earm/crt0.S:1.2 src/lib/csu/arch/earm/crt0.S:1.3
--- src/lib/csu/arch/earm/crt0.S:1.2	Wed Aug 21 03:03:02 2013
+++ src/lib/csu/arch/earm/crt0.S	Thu Sep  5 00:27:38 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: crt0.S,v 1.2 2013/08/21 03:03:02 matt Exp $	*/
+/*	$NetBSD: crt0.S,v 1.3 2013/09/05 00:27:38 matt Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include arm/asm.h
 
-RCSID($NetBSD: crt0.S,v 1.2 2013/08/21 03:03:02 matt Exp $)
+RCSID($NetBSD: crt0.S,v 1.3 2013/09/05 00:27:38 matt Exp $)
 
 STRONG_ALIAS(_start,__start)
 
@@ -44,7 +44,7 @@ _ENTRY(__start)
 	mov	r2, ip		/* tmp - ps_strings */
 
 	/* Ensure the stack is properly aligned before calling C code. */
-#if !defined(__thumb__) || defined(_ARM_ARCH_T2)
+#if !defined(__thumb__)
 	bic	sp, sp, #7
 #else
 	movs	r6, #7



CVS commit: src/lib/csu/arch/mips

2013-09-04 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Sep  5 00:28:11 UTC 2013

Modified Files:
src/lib/csu/arch/mips: crtend.S

Log Message:
mips .eh_frame is writable


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/csu/arch/mips/crtend.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/mips/crtend.S
diff -u src/lib/csu/arch/mips/crtend.S:1.2 src/lib/csu/arch/mips/crtend.S:1.3
--- src/lib/csu/arch/mips/crtend.S:1.2	Thu Jul 11 16:23:40 2013
+++ src/lib/csu/arch/mips/crtend.S	Thu Sep  5 00:28:11 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: crtend.S,v 1.2 2013/07/11 16:23:40 matt Exp $	*/
+/*	$NetBSD: crtend.S,v 1.3 2013/09/05 00:28:11 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,7 +30,7 @@
 
 #include mips/asm.h
 
-RCSID($NetBSD: crtend.S,v 1.2 2013/07/11 16:23:40 matt Exp $)
+RCSID($NetBSD: crtend.S,v 1.3 2013/09/05 00:28:11 matt Exp $)
 
 	.section	.ctors, aw, @progbits
 	.p2align 	PTR_SCALESHIFT
@@ -46,7 +46,7 @@ __CTOR_LIST_END__:
 __DTOR_LIST_END__:
 	.word		0
 
-	.section	.eh_frame, a, @progbits
+	.section	.eh_frame, aw, @progbits
 	.p2align	 PTR_SCALESHIFT
 	.space		_MIPS_SZPTR / 8
 



CVS commit: src/lib/csu/common

2013-08-26 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Aug 26 14:20:53 UTC 2013

Modified Files:
src/lib/csu/common: crtbegin.c

Log Message:
MIPS wants a read/write eh_frame.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/csu/common/crtbegin.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/crtbegin.c
diff -u src/lib/csu/common/crtbegin.c:1.4 src/lib/csu/common/crtbegin.c:1.5
--- src/lib/csu/common/crtbegin.c:1.4	Mon Aug 19 22:15:13 2013
+++ src/lib/csu/common/crtbegin.c	Mon Aug 26 14:20:53 2013
@@ -27,7 +27,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: crtbegin.c,v 1.4 2013/08/19 22:15:13 matt Exp $);
+__RCSID($NetBSD: crtbegin.c,v 1.5 2013/08/26 14:20:53 matt Exp $);
 
 typedef void (*fptr_t)(void);
 
@@ -53,7 +53,11 @@ __dso_hidden void *__dso_handle;
 #endif
 
 #if !defined(__ARM_EABI__)
-__dso_hidden const long __EH_FRAME_LIST__[0] __section(.eh_frame);
+__dso_hidden
+#if !defined(__mips__)
+	const
+#endif
+	long __EH_FRAME_LIST__[0] __section(.eh_frame);
 
 __weakref_visible void register_frame_info(const void *, const void *)
 	__weak_reference(__register_frame_info);



CVS commit: src/lib/csu/arch/earm

2013-08-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 21 03:03:02 UTC 2013

Modified Files:
src/lib/csu/arch/earm: crt0.S

Log Message:
Thumbify


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/earm/crt0.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/earm/crt0.S
diff -u src/lib/csu/arch/earm/crt0.S:1.1 src/lib/csu/arch/earm/crt0.S:1.2
--- src/lib/csu/arch/earm/crt0.S:1.1	Mon Aug 13 02:49:04 2012
+++ src/lib/csu/arch/earm/crt0.S	Wed Aug 21 03:03:02 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: crt0.S,v 1.1 2012/08/13 02:49:04 matt Exp $	*/
+/*	$NetBSD: crt0.S,v 1.2 2013/08/21 03:03:02 matt Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include arm/asm.h
 
-RCSID($NetBSD: crt0.S,v 1.1 2012/08/13 02:49:04 matt Exp $)
+RCSID($NetBSD: crt0.S,v 1.2 2013/08/21 03:03:02 matt Exp $)
 
 STRONG_ALIAS(_start,__start)
 
@@ -44,7 +44,14 @@ _ENTRY(__start)
 	mov	r2, ip		/* tmp - ps_strings */
 
 	/* Ensure the stack is properly aligned before calling C code. */
+#if !defined(__thumb__) || defined(_ARM_ARCH_T2)
 	bic	sp, sp, #7
+#else
+	movs	r6, #7
+	mov	r7, sp
+	bics	r7, r7, r6
+	mov	sp, r7
+#endif
 
 	/*
 	 * void ___start(void (*cleanup)(void),



CVS commit: src/lib/csu/arm_elf

2013-08-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Aug 19 06:56:15 UTC 2013

Removed Files:
src/lib/csu/arm_elf: Makefile crt0.c dot_init.h

Log Message:
G/C arm COMPILERCRTSTUFF


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r0 src/lib/csu/arm_elf/Makefile
cvs rdiff -u -r1.10 -r0 src/lib/csu/arm_elf/crt0.c
cvs rdiff -u -r1.9 -r0 src/lib/csu/arm_elf/dot_init.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/csu/common

2013-08-19 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Aug 19 22:15:13 UTC 2013

Modified Files:
src/lib/csu/common: crtbegin.c

Log Message:
Put the ctors code in .text.startup and dtors code in .text.exit


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/csu/common/crtbegin.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/crtbegin.c
diff -u src/lib/csu/common/crtbegin.c:1.3 src/lib/csu/common/crtbegin.c:1.4
--- src/lib/csu/common/crtbegin.c:1.3	Thu Jun 27 21:24:39 2013
+++ src/lib/csu/common/crtbegin.c	Mon Aug 19 22:15:13 2013
@@ -27,7 +27,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: crtbegin.c,v 1.3 2013/06/27 21:24:39 matt Exp $);
+__RCSID($NetBSD: crtbegin.c,v 1.4 2013/08/19 22:15:13 matt Exp $);
 
 typedef void (*fptr_t)(void);
 
@@ -65,7 +65,7 @@ static long dwarf_eh_object[8];
 
 static void __do_global_ctors_aux(void) __used;
 
-static void
+static void __section(.text.startup)
 __do_global_ctors_aux(void)
 {
 	static unsigned char __initialized;
@@ -100,7 +100,7 @@ __dso_hidden extern const fptr_t __DTOR_
 
 static void __do_global_dtors_aux(void) __used;
 
-static void
+static void __section(.text.exit)
 __do_global_dtors_aux(void)
 {
 	static unsigned char __finished;



CVS commit: src/lib/csu

2013-08-05 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Aug  5 13:38:35 UTC 2013

Modified Files:
src/lib/csu/common: Makefile.inc
Added Files:
src/lib/csu/arch/alpha: crtfm.c

Log Message:
Alpha needs crtfm.o for USE_COMPILERCRTSTUFF=no


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/lib/csu/arch/alpha/crtfm.c
cvs rdiff -u -r1.15 -r1.16 src/lib/csu/common/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/Makefile.inc
diff -u src/lib/csu/common/Makefile.inc:1.15 src/lib/csu/common/Makefile.inc:1.16
--- src/lib/csu/common/Makefile.inc:1.15	Thu Jul 18 18:43:56 2013
+++ src/lib/csu/common/Makefile.inc	Mon Aug  5 13:38:35 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.15 2013/07/18 18:43:56 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.16 2013/08/05 13:38:35 matt Exp $
 
 .include bsd.own.mk
 
@@ -14,6 +14,9 @@ OBJS+=		crtbegin.o crtend.o
 OBJS+=		crtbeginS.o
 CFLAGS.crtbegin.c+= -fPIE
 .endif
+.if ${MACHINE_ARCH} == alpha
+OBJS+=		crtfm.o
+.endif
 
 realall: ${OBJS}
 
@@ -82,6 +85,15 @@ gcrt0.o: crt0.S crt0-common.c
 	${OBJCOPY} -R .ident ${.TARGET}
 .endif
 
+.if ${MACHINE_ARCH} == alpha
+# can't do this in Makefile.inc otherwise it will before realall:
+crtfm.o: crtfm.c
+	${_MKTARGET_COMPILE}
+	${COMPILE.c} ${.ALLSRC} -o ${.TARGET}.o
+	${LD} -x -r -o ${.TARGET} ${.TARGET}.o
+	rm -f ${.TARGET}.o
+.endif
+
 sysident_assym.h: ${GENASSYM_CONF} ${GENASSYM_EXTRAS}
 	${_MKTARGET_CREATE}
 	cat ${COMMON_DIR}/sysident_assym.cf | \

Added files:

Index: src/lib/csu/arch/alpha/crtfm.c
diff -u /dev/null src/lib/csu/arch/alpha/crtfm.c:1.1
--- /dev/null	Mon Aug  5 13:38:35 2013
+++ src/lib/csu/arch/alpha/crtfm.c	Mon Aug  5 13:38:35 2013
@@ -0,0 +1,68 @@
+/*	$NetBSD: crtfm.c,v 1.1 2013/08/05 13:38:35 matt Exp $	*/
+
+/*
+ * Copyright (c) 2002 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Jason R. Thorpe 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.
+ */
+
+/*
+ * Support for the GCC -ffast-math option on the Alpha.
+ */
+
+#include sys/types.h
+
+#include machine/fpu.h
+#include machine/sysarch.h
+
+/*
+ * Must provide this wrapper around sysarch(2) so that statically-linked
+ * programs work properly.
+ */
+
+extern void __alpha_sysarch(int, void *);
+
+__asm(.ent __alpha_sysarch 0	;\n
+__alpha_sysarch:		;\n
+	ldiq	$0, 165		;\n /* v0 = SYS_sysarch */
+	call_pal 0x0083		;\n /* PAL_OSF1_callsys */
+	ret	$31,($26),1	;\n
+.end __alpha_sysarch);
+
+static void __attribute__((__constructor__))
+__alpha_set_fast_math(void)
+{
+	struct alpha_fp_c_args args;
+
+	args.fp_c = IEEE_MAP_DMZ|IEEE_MAP_UMZ;
+	__alpha_sysarch(ALPHA_SET_FP_C, args);
+}



CVS commit: src/lib/csu/hppa

2013-08-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug  4 17:35:10 UTC 2013

Removed Files:
src/lib/csu/hppa: Makefile crt0.c dot_init.h

Log Message:
G/C old csu stuff for hppa.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r0 src/lib/csu/hppa/Makefile
cvs rdiff -u -r1.10 -r0 src/lib/csu/hppa/crt0.c
cvs rdiff -u -r1.8 -r0 src/lib/csu/hppa/dot_init.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/csu/arch/m68k

2013-07-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jul 27 13:07:06 UTC 2013

Modified Files:
src/lib/csu/arch/m68k: crtbegin.h

Log Message:
In .fini invoke destructors (fix copy  pasto)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/csu/arch/m68k/crtbegin.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/m68k/crtbegin.h
diff -u src/lib/csu/arch/m68k/crtbegin.h:1.3 src/lib/csu/arch/m68k/crtbegin.h:1.4
--- src/lib/csu/arch/m68k/crtbegin.h:1.3	Fri Jul 19 06:26:41 2013
+++ src/lib/csu/arch/m68k/crtbegin.h	Sat Jul 27 13:07:06 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: crtbegin.h,v 1.3 2013/07/19 06:26:41 matt Exp $ */
+/* $NetBSD: crtbegin.h,v 1.4 2013/07/27 13:07:06 martin Exp $ */
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -38,7 +38,7 @@ __asm(	.pushsection .init
 
 __asm(	.pushsection .fini
 #ifdef __pic__
-\n\t	bsrl	__do_global_ctors_aux
+\n\t	bsrl	__do_global_dtors_aux
 #else
 \n\t	jsr	__do_global_dtors_aux
 #endif



CVS commit: src/lib/csu/arch/m68k

2013-07-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jul 26 18:47:23 UTC 2013

Modified Files:
src/lib/csu/arch/m68k: crt0.S

Log Message:
Simplify to new ___start() signature.
Seems to fix PR port-m68k/48076.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/csu/arch/m68k/crt0.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/m68k/crt0.S
diff -u src/lib/csu/arch/m68k/crt0.S:1.2 src/lib/csu/arch/m68k/crt0.S:1.3
--- src/lib/csu/arch/m68k/crt0.S:1.2	Thu Jul 11 17:07:35 2013
+++ src/lib/csu/arch/m68k/crt0.S	Fri Jul 26 18:47:23 2013
@@ -35,18 +35,13 @@
  * Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp
  */
 
-RCSID($NetBSD: crt0.S,v 1.2 2013/07/11 17:07:35 matt Exp $)
+RCSID($NetBSD: crt0.S,v 1.3 2013/07/26 18:47:23 martin Exp $)
 
 STRONG_ALIAS(_start,__start)
 
 _ENTRY(__start)
-	movl	(%sp),%d0
 	movl	%a2,-(%sp)		| ps_strings
 	movl	%a0,-(%sp)		| obj
 	movl	%a1,-(%sp)		| cleanup
-	movl	%d0,%d1
-	lsll	#2,%d1
-	pea	(16+4)(%sp,%d1.l)	| envp = argv[argc + 1]
-	pea	20(%sp)			| argv
-	movl	%d0,-(%sp)		| argc
+	| call: ___start(cleanup, obj, ps_strings)
 	bsr	___start



CVS commit: src/lib/csu/arch/m68k

2013-07-26 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jul 26 19:49:19 UTC 2013

Modified Files:
src/lib/csu/arch/m68k: crt0.S

Log Message:
Use jbsr and add END(__start)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/csu/arch/m68k/crt0.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/m68k/crt0.S
diff -u src/lib/csu/arch/m68k/crt0.S:1.3 src/lib/csu/arch/m68k/crt0.S:1.4
--- src/lib/csu/arch/m68k/crt0.S:1.3	Fri Jul 26 18:47:23 2013
+++ src/lib/csu/arch/m68k/crt0.S	Fri Jul 26 19:49:19 2013
@@ -35,7 +35,7 @@
  * Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp
  */
 
-RCSID($NetBSD: crt0.S,v 1.3 2013/07/26 18:47:23 martin Exp $)
+RCSID($NetBSD: crt0.S,v 1.4 2013/07/26 19:49:19 matt Exp $)
 
 STRONG_ALIAS(_start,__start)
 
@@ -44,4 +44,5 @@ _ENTRY(__start)
 	movl	%a0,-(%sp)		| obj
 	movl	%a1,-(%sp)		| cleanup
 	| call: ___start(cleanup, obj, ps_strings)
-	bsr	___start
+	jbsr	___start
+END(__start)



CVS commit: src/lib/csu/arch/m68k

2013-07-19 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jul 19 06:26:41 UTC 2013

Modified Files:
src/lib/csu/arch/m68k: crtbegin.h

Log Message:
Deal with m68010 not having bsrl so usr jsr on !__pic__


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/csu/arch/m68k/crtbegin.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/m68k/crtbegin.h
diff -u src/lib/csu/arch/m68k/crtbegin.h:1.2 src/lib/csu/arch/m68k/crtbegin.h:1.3
--- src/lib/csu/arch/m68k/crtbegin.h:1.2	Thu Jul 18 18:43:04 2013
+++ src/lib/csu/arch/m68k/crtbegin.h	Fri Jul 19 06:26:41 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: crtbegin.h,v 1.2 2013/07/18 18:43:04 matt Exp $ */
+/* $NetBSD: crtbegin.h,v 1.3 2013/07/19 06:26:41 matt Exp $ */
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,9 +29,17 @@
  */
 
 __asm(	.pushsection .init
+#ifdef __pic__
+\n\t	bsrl	__do_global_ctors_aux
+#else
 \n\t	jsr	__do_global_ctors_aux
+#endif
 \n\t	.popsection);
 
 __asm(	.pushsection .fini
+#ifdef __pic__
+\n\t	bsrl	__do_global_ctors_aux
+#else
 \n\t	jsr	__do_global_dtors_aux
+#endif
 \n\t	.popsection);



CVS commit: src/lib/csu/arch/m68k

2013-07-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jul 18 18:43:04 UTC 2013

Modified Files:
src/lib/csu/arch/m68k: crtbegin.h

Log Message:
s/bsrl/jsr/ and let gas figure it out


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/m68k/crtbegin.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/m68k/crtbegin.h
diff -u src/lib/csu/arch/m68k/crtbegin.h:1.1 src/lib/csu/arch/m68k/crtbegin.h:1.2
--- src/lib/csu/arch/m68k/crtbegin.h:1.1	Thu Jul 11 17:07:35 2013
+++ src/lib/csu/arch/m68k/crtbegin.h	Thu Jul 18 18:43:04 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: crtbegin.h,v 1.1 2013/07/11 17:07:35 matt Exp $ */
+/* $NetBSD: crtbegin.h,v 1.2 2013/07/18 18:43:04 matt Exp $ */
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,9 +29,9 @@
  */
 
 __asm(	.pushsection .init
-\n\t	bsrl	__do_global_ctors_aux
+\n\t	jsr	__do_global_ctors_aux
 \n\t	.popsection);
 
 __asm(	.pushsection .fini
-\n\t	bsrl	__do_global_dtors_aux
+\n\t	jsr	__do_global_dtors_aux
 \n\t	.popsection);



CVS commit: src/lib/csu/common

2013-07-18 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jul 18 18:43:56 UTC 2013

Modified Files:
src/lib/csu/common: Makefile.inc

Log Message:
Only supplie -fPIE to crtbegin.c if MKPIC is yes.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/csu/common/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/Makefile.inc
diff -u src/lib/csu/common/Makefile.inc:1.14 src/lib/csu/common/Makefile.inc:1.15
--- src/lib/csu/common/Makefile.inc:1.14	Wed Jul 17 14:23:45 2013
+++ src/lib/csu/common/Makefile.inc	Thu Jul 18 18:43:56 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.14 2013/07/17 14:23:45 martin Exp $
+#	$NetBSD: Makefile.inc,v 1.15 2013/07/18 18:43:56 matt Exp $
 
 .include bsd.own.mk
 
@@ -12,6 +12,7 @@ OBJS+=		crtbegin.o crtend.o
 
 .if ${MKPIC} == yes
 OBJS+=		crtbeginS.o
+CFLAGS.crtbegin.c+= -fPIE
 .endif
 
 realall: ${OBJS}
@@ -23,7 +24,7 @@ crtbegin.o: crtbegin.S
 .else
 crtbegin.o: crtbegin.c crtbegin.h
 	${_MKTARGET_COMPILE}
-	${COMPILE.c} -fPIE ${COMMON_DIR}/crtbegin.c -o ${.TARGET}.o
+	${COMPILE.c} ${CFLAGS.crtbegin.c} ${COMMON_DIR}/crtbegin.c -o ${.TARGET}.o
 .endif
 	${LD} -x -r -o ${.TARGET} ${.TARGET}.o
 	rm -f ${.TARGET}.o



CVS commit: src/lib/csu

2013-07-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jul 13 09:48:26 UTC 2013

Modified Files:
src/lib/csu: README

Log Message:
crt0 actually calls ___start


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/csu/README

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/README
diff -u src/lib/csu/README:1.4 src/lib/csu/README:1.5
--- src/lib/csu/README:1.4	Wed Jul 10 09:41:16 2013
+++ src/lib/csu/README	Sat Jul 13 09:48:26 2013
@@ -14,7 +14,7 @@ arch/${MACHINE_ARCH} or arch/${MACHINE_C
 - Makefile.inc: provides ELFSIZE corresponding to 32/64bit file format.
   If using the common C code instead of crtbegin.S also provide a -I option
   to find crtbegin.h in your arch subdir.
-- crt0.S: provides setup code and the call to __start.
+- crt0.S: provides setup code and the call to ___start.
 - crtbegin.S or crtbegin.h: see below
 - crtend.S: see below, most likely just a copy of an existing architecture
 - crti.S: prefix part of .init/.fini sections, i.e. to ensure stack alignment



CVS commit: src/lib/csu/arch/hppa

2013-07-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jul 13 18:52:35 UTC 2013

Added Files:
src/lib/csu/arch/hppa: Makefile.inc crt0.S crtbegin.h crtend.S crti.S
crtn.S

Log Message:
Add crtstuff for hppa. Lightly tested.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/lib/csu/arch/hppa/Makefile.inc \
src/lib/csu/arch/hppa/crt0.S src/lib/csu/arch/hppa/crtbegin.h \
src/lib/csu/arch/hppa/crtend.S src/lib/csu/arch/hppa/crti.S \
src/lib/csu/arch/hppa/crtn.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/lib/csu/arch/hppa/Makefile.inc
diff -u /dev/null src/lib/csu/arch/hppa/Makefile.inc:1.1
--- /dev/null	Sat Jul 13 18:52:35 2013
+++ src/lib/csu/arch/hppa/Makefile.inc	Sat Jul 13 18:52:35 2013
@@ -0,0 +1,3 @@
+#	$NetBSD: Makefile.inc,v 1.1 2013/07/13 18:52:35 skrll Exp $
+
+CPPFLAGS+=	-DELFSIZE=32 -I${ARCHDIR}
Index: src/lib/csu/arch/hppa/crt0.S
diff -u /dev/null src/lib/csu/arch/hppa/crt0.S:1.1
--- /dev/null	Sat Jul 13 18:52:35 2013
+++ src/lib/csu/arch/hppa/crt0.S	Sat Jul 13 18:52:35 2013
@@ -0,0 +1,67 @@
+/*	$NetBSD: crt0.S,v 1.1 2013/07/13 18:52:35 skrll Exp $	*/
+
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Nick Hudson
+ *
+ * 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.
+ *
+ * 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
+
+RCSID($NetBSD: crt0.S,v 1.1 2013/07/13 18:52:35 skrll Exp $)
+
+	.import	_GLOBAL_OFFSET_TABLE_
+	.hidden	___start
+
+STRONG_ALIAS(__start,_start)
+
+/*
+ * void _start(struct ps_strings *ps_strings,
+ *void (*cleanup)(void),
+ *const Obj_Entry *obj);
+ */
+_ENTRY(_start)
+	.callinfo frame=0, calls
+	.entry
+
+	bl  L$lpc, %r27
+	depi0, 31, 2, %r27
+L$lpc:	addil   L'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 8), %r27
+	ldo R'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 12)(%r1),%r27
+	copy	%r27, %r19
+
+	/*
+	 * void ___start(void (*cleanup)(void),
+	 *const Obj_Entry *obj,
+	 *struct ps_strings *ps_strings);
+	 */
+	copy	%arg0, %arg3		; ps_strings - tmp
+	copy	%arg1, %arg0		; cleanup - arg0
+	copy	%arg2, %arg1		; obj - arg1
+	b	___start
+	copy	%arg3, %arg2		; ps_strings (tmp) - arg2
+
+EXIT(_start)
Index: src/lib/csu/arch/hppa/crtbegin.h
diff -u /dev/null src/lib/csu/arch/hppa/crtbegin.h:1.1
--- /dev/null	Sat Jul 13 18:52:35 2013
+++ src/lib/csu/arch/hppa/crtbegin.h	Sat Jul 13 18:52:35 2013
@@ -0,0 +1,43 @@
+/*	$NetBSD*/
+
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Nick Hudson
+ *
+ * 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.
+ *
+ * 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
+ 

CVS commit: src/lib/csu/arch

2013-07-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jul 11 06:57:16 UTC 2013

Modified Files:
src/lib/csu/arch/sparc: Makefile.inc crt0.S
Added Files:
src/lib/csu/arch/sparc: crtbegin.h crtend.S
src/lib/csu/arch/sparc64: Makefile.inc crt0.S crtbegin.h crtend.S
crti.S crtn.S

Log Message:
Add support for sparc and sparc64


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/sparc/Makefile.inc \
src/lib/csu/arch/sparc/crt0.S
cvs rdiff -u -r0 -r1.1 src/lib/csu/arch/sparc/crtbegin.h \
src/lib/csu/arch/sparc/crtend.S
cvs rdiff -u -r0 -r1.1 src/lib/csu/arch/sparc64/Makefile.inc \
src/lib/csu/arch/sparc64/crt0.S src/lib/csu/arch/sparc64/crtbegin.h \
src/lib/csu/arch/sparc64/crtend.S src/lib/csu/arch/sparc64/crti.S \
src/lib/csu/arch/sparc64/crtn.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/sparc/Makefile.inc
diff -u src/lib/csu/arch/sparc/Makefile.inc:1.1 src/lib/csu/arch/sparc/Makefile.inc:1.2
--- src/lib/csu/arch/sparc/Makefile.inc:1.1	Sat Aug  7 18:01:34 2010
+++ src/lib/csu/arch/sparc/Makefile.inc	Thu Jul 11 06:57:15 2013
@@ -1,5 +1,5 @@
-# $NetBSD: Makefile.inc,v 1.1 2010/08/07 18:01:34 joerg Exp $
+# $NetBSD: Makefile.inc,v 1.2 2013/07/11 06:57:15 martin Exp $
 
-CPPFLAGS+=	-DELFSIZE=32
+CPPFLAGS+=	-DELFSIZE=32 -I${ARCHDIR}
 
 
Index: src/lib/csu/arch/sparc/crt0.S
diff -u src/lib/csu/arch/sparc/crt0.S:1.1 src/lib/csu/arch/sparc/crt0.S:1.2
--- src/lib/csu/arch/sparc/crt0.S:1.1	Sat Aug  7 18:01:34 2010
+++ src/lib/csu/arch/sparc/crt0.S	Thu Jul 11 06:57:15 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.S,v 1.1 2010/08/07 18:01:34 joerg Exp $ */
+/* $NetBSD: crt0.S,v 1.2 2013/07/11 06:57:15 martin Exp $ */
 
 /*
  * Copyright (c) 1998 Christos Zoulas
@@ -37,20 +37,21 @@
 
 #include machine/asm.h
 
-RCSID($NetBSD: crt0.S,v 1.1 2010/08/07 18:01:34 joerg Exp $)
+RCSID($NetBSD: crt0.S,v 1.2 2013/07/11 06:57:15 martin Exp $)
 
 STRONG_ALIAS(_start,__start)
 
+	! called with:
+	!  %g3 = cleanup
+	!  %g2 = obj
+	!  %g1 = ps_strings
+	! call: ___start(cleanup, obj, ps_strings)
 _ENTRY(__start)
 	mov	0, %fp
-	ld	[%sp + 64], %o0		! get argc
-	add	%sp, 68, %o1		! get argv
-	sll	%o0, 2,	%o2		!
-	add	%o2, 4,	%o2		! envp = argv + (argc  2) + 4
-	add	%o1, %o2, %o2		!
-	andn	%sp, 7,	%sp		! align
+	andn	%sp, 7,	%sp		! align stack
 	sub	%sp, 24, %sp		! expand to standard stack frame size
-	mov	%g3, %o3
-	mov	%g2, %o4
+	mov	%g3, %o0
+	mov	%g2, %o1
 	call	___start
-	 mov	%g1, %o5
+	 mov	%g1, %o2
+

Added files:

Index: src/lib/csu/arch/sparc/crtbegin.h
diff -u /dev/null src/lib/csu/arch/sparc/crtbegin.h:1.1
--- /dev/null	Thu Jul 11 06:57:16 2013
+++ src/lib/csu/arch/sparc/crtbegin.h	Thu Jul 11 06:57:15 2013
@@ -0,0 +1,40 @@
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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.
+ *
+ * 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.
+ */
+
+__asm(	\n\t
+	.pushsection .init, \ax\, @progbits			\n\t
+	call	__do_global_ctors_aux\n\t
+	 nop			\n\t
+	.popsection);
+
+__asm(	\n\t
+	.pushsection .fini, \ax\, @progbits \n\t
+	call	__do_global_dtors_aux\n\t
+	 nop			\n\t
+	.popsection);
Index: src/lib/csu/arch/sparc/crtend.S
diff -u /dev/null src/lib/csu/arch/sparc/crtend.S:1.1
--- /dev/null	Thu Jul 11 06:57:16 2013
+++ src/lib/csu/arch/sparc/crtend.S	Thu Jul 11 06:57:15 2013
@@ -0,0 +1,55 @@
+/*	$NetBSD: crtend.S,v 1.1 2013/07/11 06:57:15 martin Exp $	*/
+/*-
+ * Copyright (c) 2010 Joerg Sonnenberger jo...@netbsd.org
+ * All rights 

CVS commit: src/lib/csu/arch/mips

2013-07-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jul 11 16:23:40 UTC 2013

Modified Files:
src/lib/csu/arch/mips: crtend.S

Log Message:
Make this work for N64 as well.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/mips/crtend.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/mips/crtend.S
diff -u src/lib/csu/arch/mips/crtend.S:1.1 src/lib/csu/arch/mips/crtend.S:1.2
--- src/lib/csu/arch/mips/crtend.S:1.1	Sat Jun 22 02:37:09 2013
+++ src/lib/csu/arch/mips/crtend.S	Thu Jul 11 16:23:40 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: crtend.S,v 1.1 2013/06/22 02:37:09 matt Exp $	*/
+/*	$NetBSD: crtend.S,v 1.2 2013/07/11 16:23:40 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,26 +30,26 @@
 
 #include mips/asm.h
 
-RCSID($NetBSD: crtend.S,v 1.1 2013/06/22 02:37:09 matt Exp $)
+RCSID($NetBSD: crtend.S,v 1.2 2013/07/11 16:23:40 matt Exp $)
 
 	.section	.ctors, aw, @progbits
-	.p2align 2
+	.p2align 	PTR_SCALESHIFT
 	.global		__CTOR_LIST_END__
 	.hidden 	__CTOR_LIST_END__
 __CTOR_LIST_END__:
 	.word		0
 
 	.section	.dtors, aw, @progbits
-	.p2align 2
+	.p2align 	PTR_SCALESHIFT
 	.global		__DTOR_LIST_END__
 	.hidden 	__DTOR_LIST_END__
 __DTOR_LIST_END__:
 	.word		0
 
 	.section	.eh_frame, a, @progbits
-	.p2align 2
-	.space	4
+	.p2align	 PTR_SCALESHIFT
+	.space		_MIPS_SZPTR / 8
 
 	.section	.jcr, aw, @progbits
-	.p2align 2
-	.space	4
+	.p2align	 PTR_SCALESHIFT
+	.space		_MIPS_SZPTR / 8



CVS commit: src/lib/csu/arch/alpha

2013-07-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jul 11 16:40:28 UTC 2013

Added Files:
src/lib/csu/arch/alpha: Makefile.inc crt0.S crtbegin.h crtend.S crti.S
crtn.S

Log Message:
Add crtstuff for alpha.  Compile tested only.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/lib/csu/arch/alpha/Makefile.inc \
src/lib/csu/arch/alpha/crt0.S src/lib/csu/arch/alpha/crtbegin.h \
src/lib/csu/arch/alpha/crtend.S src/lib/csu/arch/alpha/crti.S \
src/lib/csu/arch/alpha/crtn.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/lib/csu/arch/alpha/Makefile.inc
diff -u /dev/null src/lib/csu/arch/alpha/Makefile.inc:1.1
--- /dev/null	Thu Jul 11 16:40:28 2013
+++ src/lib/csu/arch/alpha/Makefile.inc	Thu Jul 11 16:40:27 2013
@@ -0,0 +1,3 @@
+#	$NetBSD: Makefile.inc,v 1.1 2013/07/11 16:40:27 matt Exp $
+
+CPPFLAGS+=	-I${ARCHDIR} -DELFSIZE=64
Index: src/lib/csu/arch/alpha/crt0.S
diff -u /dev/null src/lib/csu/arch/alpha/crt0.S:1.1
--- /dev/null	Thu Jul 11 16:40:28 2013
+++ src/lib/csu/arch/alpha/crt0.S	Thu Jul 11 16:40:27 2013
@@ -0,0 +1,54 @@
+/* $NetBSD: crt0.S,v 1.1 2013/07/11 16:40:27 matt Exp $ */
+
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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.
+ *
+ * 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 alpha/asm.h
+
+RCSID($NetBSD: crt0.S,v 1.1 2013/07/11 16:40:27 matt Exp $)
+
+STRONG_ALIAS(_start,__start)
+
+/*
+ *	Assumes kernel (or ld_elf.so) passes the following parameters to
+ *	user-space in registers:
+ *
+ *	a0  stack pointer
+ *	a1  cleanup
+ *	a2  Obj_Entry
+ *	a3  ps_strings
+ */
+
+LEAF(__start, 4)
+	LDGP(pv)
+	mov	a1, a0		/* cleanup */
+	mov	a2, a1		/* Obj_Entry */
+	mov	a3, a2		/* ps_strings */
+	CALL(___start)
+END(__start)
Index: src/lib/csu/arch/alpha/crtbegin.h
diff -u /dev/null src/lib/csu/arch/alpha/crtbegin.h:1.1
--- /dev/null	Thu Jul 11 16:40:28 2013
+++ src/lib/csu/arch/alpha/crtbegin.h	Thu Jul 11 16:40:27 2013
@@ -0,0 +1,50 @@
+/* $NetBSD: crtbegin.h,v 1.1 2013/07/11 16:40:27 matt Exp $ */
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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.
+ *
+ * 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 

CVS commit: src/lib/csu/arch/m68k

2013-07-11 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jul 11 17:07:35 UTC 2013

Modified Files:
src/lib/csu/arch/m68k: Makefile.inc crt0.S
Added Files:
src/lib/csu/arch/m68k: crtbegin.h crtend.S

Log Message:
Use pc-relative branch in crt0.S
Add crtend.S and crtbegin.h (uses pc-relative branches as well).


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/m68k/Makefile.inc \
src/lib/csu/arch/m68k/crt0.S
cvs rdiff -u -r0 -r1.1 src/lib/csu/arch/m68k/crtbegin.h \
src/lib/csu/arch/m68k/crtend.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/m68k/Makefile.inc
diff -u src/lib/csu/arch/m68k/Makefile.inc:1.1 src/lib/csu/arch/m68k/Makefile.inc:1.2
--- src/lib/csu/arch/m68k/Makefile.inc:1.1	Sat Aug  7 18:01:34 2010
+++ src/lib/csu/arch/m68k/Makefile.inc	Thu Jul 11 17:07:35 2013
@@ -1,5 +1,5 @@
-# $NetBSD: Makefile.inc,v 1.1 2010/08/07 18:01:34 joerg Exp $
+# $NetBSD: Makefile.inc,v 1.2 2013/07/11 17:07:35 matt Exp $
 
-CPPFLAGS+=	-DELFSIZE=32
+CPPFLAGS+=	-I${ARCHDIR} -DELFSIZE=32
 
 
Index: src/lib/csu/arch/m68k/crt0.S
diff -u src/lib/csu/arch/m68k/crt0.S:1.1 src/lib/csu/arch/m68k/crt0.S:1.2
--- src/lib/csu/arch/m68k/crt0.S:1.1	Sat Aug  7 18:01:34 2010
+++ src/lib/csu/arch/m68k/crt0.S	Thu Jul 11 17:07:35 2013
@@ -35,7 +35,7 @@
  * Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp
  */
 
-RCSID($NetBSD: crt0.S,v 1.1 2010/08/07 18:01:34 joerg Exp $)
+RCSID($NetBSD: crt0.S,v 1.2 2013/07/11 17:07:35 matt Exp $)
 
 STRONG_ALIAS(_start,__start)
 
@@ -49,4 +49,4 @@ _ENTRY(__start)
 	pea	(16+4)(%sp,%d1.l)	| envp = argv[argc + 1]
 	pea	20(%sp)			| argv
 	movl	%d0,-(%sp)		| argc
-	jsr	___start
+	bsr	___start

Added files:

Index: src/lib/csu/arch/m68k/crtbegin.h
diff -u /dev/null src/lib/csu/arch/m68k/crtbegin.h:1.1
--- /dev/null	Thu Jul 11 17:07:35 2013
+++ src/lib/csu/arch/m68k/crtbegin.h	Thu Jul 11 17:07:35 2013
@@ -0,0 +1,37 @@
+/* $NetBSD: crtbegin.h,v 1.1 2013/07/11 17:07:35 matt Exp $ */
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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.
+ *
+ * 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.
+ */
+
+__asm(	.pushsection .init
+\n\t	bsrl	__do_global_ctors_aux
+\n\t	.popsection);
+
+__asm(	.pushsection .fini
+\n\t	bsrl	__do_global_dtors_aux
+\n\t	.popsection);
Index: src/lib/csu/arch/m68k/crtend.S
diff -u /dev/null src/lib/csu/arch/m68k/crtend.S:1.1
--- /dev/null	Thu Jul 11 17:07:35 2013
+++ src/lib/csu/arch/m68k/crtend.S	Thu Jul 11 17:07:35 2013
@@ -0,0 +1,55 @@
+/*	$NetBSD: crtend.S,v 1.1 2013/07/11 17:07:35 matt Exp $	*/
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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.
+ *
+ * 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 

CVS commit: src/lib/csu

2013-07-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 10 09:32:49 UTC 2013

Modified Files:
src/lib/csu: README

Log Message:
Fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/csu/README

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/README
diff -u src/lib/csu/README:1.2 src/lib/csu/README:1.3
--- src/lib/csu/README:1.2	Mon Jun 24 14:27:35 2013
+++ src/lib/csu/README	Wed Jul 10 09:32:49 2013
@@ -16,7 +16,7 @@ arch/${MACHINE_ARCH} or arch/${MACHINE_C
 - crtbegin.S: see below
 - crtend.S: see below, most likely just a copy of an existing architecture
 - crti.S: prefix part of .init/.fini sections, i.e. to ensure stack alignment
-- crte.S: suffix part of the .init/.fini sections, i.e. return to caller.
+- crtn.S: suffix part of the .init/.fini sections, i.e. return to caller.
 
 
 Overview of the common runtime support



CVS commit: src/lib/csu

2013-07-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 10 09:41:16 UTC 2013

Modified Files:
src/lib/csu: README

Log Message:
Try to also document the variant using common C code - Matt, please review!


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/csu/README

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/README
diff -u src/lib/csu/README:1.3 src/lib/csu/README:1.4
--- src/lib/csu/README:1.3	Wed Jul 10 09:32:49 2013
+++ src/lib/csu/README	Wed Jul 10 09:41:16 2013
@@ -11,9 +11,11 @@ compiler logic.
 
 A new platform should provide the following content in
 arch/${MACHINE_ARCH} or arch/${MACHINE_CPU}:
-- Makefile.inc: provides ELFSIZE corresponding to 32/64bit file format
+- Makefile.inc: provides ELFSIZE corresponding to 32/64bit file format.
+  If using the common C code instead of crtbegin.S also provide a -I option
+  to find crtbegin.h in your arch subdir.
 - crt0.S: provides setup code and the call to __start.
-- crtbegin.S: see below
+- crtbegin.S or crtbegin.h: see below
 - crtend.S: see below, most likely just a copy of an existing architecture
 - crti.S: prefix part of .init/.fini sections, i.e. to ensure stack alignment
 - crtn.S: suffix part of the .init/.fini sections, i.e. return to caller.
@@ -82,3 +84,10 @@ Deinitialisation (called from .fini):
 Call the pointers as void (*)(void) functions.
 5.  If __deregister_frame_info is NULL, return.
 6.  Call __deregister_frame_info with the start of .eh_frame as the argument.
+
+
+Since most of this can easily be done in C code, instead of providing a
+crtbegin.S you can also chose to use the generic C implementation. Provide
+a crtbegin.h file instead of crtbegin.S. In there put inline assembler
+stubs (mostly copied from some other arch) and implement calls to the
+helper functions __do_global_ctors_aux/__do_global_dtors_aux.



CVS commit: src/lib/csu/arch/vax

2013-07-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jul 10 14:27:02 UTC 2013

Modified Files:
src/lib/csu/arch/vax: crtbegin.S

Log Message:
Fix logic inversion.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/csu/arch/vax/crtbegin.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/vax/crtbegin.S
diff -u src/lib/csu/arch/vax/crtbegin.S:1.3 src/lib/csu/arch/vax/crtbegin.S:1.4
--- src/lib/csu/arch/vax/crtbegin.S:1.3	Tue Jun 25 00:30:07 2013
+++ src/lib/csu/arch/vax/crtbegin.S	Wed Jul 10 14:27:01 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: crtbegin.S,v 1.3 2013/06/25 00:30:07 matt Exp $	*/
+/*	$NetBSD: crtbegin.S,v 1.4 2013/07/10 14:27:01 matt Exp $	*/
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,7 +30,7 @@
 
 #include vax/asm.h
 
-RCSID($NetBSD: crtbegin.S,v 1.3 2013/06/25 00:30:07 matt Exp $)
+RCSID($NetBSD: crtbegin.S,v 1.4 2013/07/10 14:27:01 matt Exp $)
 
 	.section	.ctors, aw, @progbits
 	.p2align 2
@@ -91,7 +91,7 @@ _ENTRY(__do_global_dtors_aux, 0x0100)		/
 	 *	__cxa_finalize(__dso_handle);
 	 */
 	movab	__cxa_finalize, %r0
-	bneq	1f
+	beql	1f
 	pushal	__dso_handle	
 	calls	$0, (%r0)
 1:



CVS commit: src/lib/csu/arch/mips

2013-07-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jul 10 15:05:46 UTC 2013

Modified Files:
src/lib/csu/arch/mips: Makefile.inc

Log Message:
Add a ELFSIZE define


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/mips/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/mips/Makefile.inc
diff -u src/lib/csu/arch/mips/Makefile.inc:1.1 src/lib/csu/arch/mips/Makefile.inc:1.2
--- src/lib/csu/arch/mips/Makefile.inc:1.1	Sat Jun 22 02:37:09 2013
+++ src/lib/csu/arch/mips/Makefile.inc	Wed Jul 10 15:05:46 2013
@@ -1,3 +1,3 @@
-#	$NetBSD: Makefile.inc,v 1.1 2013/06/22 02:37:09 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.2 2013/07/10 15:05:46 matt Exp $
 
-CPPFLAGS+=	-I${ARCHDIR}
+CPPFLAGS+=	-I${ARCHDIR} -DELFSIZE=_MIPS_SZPTR



CVS commit: src/lib/csu/arch/vax

2013-07-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jul 10 22:55:40 UTC 2013

Modified Files:
src/lib/csu/arch/vax: crtbegin.S

Log Message:
Fix another bneq - beql botch


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/csu/arch/vax/crtbegin.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/vax/crtbegin.S
diff -u src/lib/csu/arch/vax/crtbegin.S:1.4 src/lib/csu/arch/vax/crtbegin.S:1.5
--- src/lib/csu/arch/vax/crtbegin.S:1.4	Wed Jul 10 14:27:01 2013
+++ src/lib/csu/arch/vax/crtbegin.S	Wed Jul 10 22:55:40 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: crtbegin.S,v 1.4 2013/07/10 14:27:01 matt Exp $	*/
+/*	$NetBSD: crtbegin.S,v 1.5 2013/07/10 22:55:40 matt Exp $	*/
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,7 +30,7 @@
 
 #include vax/asm.h
 
-RCSID($NetBSD: crtbegin.S,v 1.4 2013/07/10 14:27:01 matt Exp $)
+RCSID($NetBSD: crtbegin.S,v 1.5 2013/07/10 22:55:40 matt Exp $)
 
 	.section	.ctors, aw, @progbits
 	.p2align 2
@@ -114,7 +114,7 @@ _ENTRY(__do_global_dtors_aux, 0x0100)		/
 	 * __deregister_frame_info(__EH_FRAME_LIST__[0]);
 	 */
 	moval	__deregister_frame_info, %r0
-	bneq	4f
+	beql	4f
 	pushal	__EH_FRAME_LIST__
 	calls	$0, (%r0)
 #endif /* SHARED */



CVS commit: src/lib/csu/arch/vax

2013-07-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jul 10 23:30:45 UTC 2013

Modified Files:
src/lib/csu/arch/vax: crtbegin.S

Log Message:
Add END(func) so gdb doesn't get so confused.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/csu/arch/vax/crtbegin.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/vax/crtbegin.S
diff -u src/lib/csu/arch/vax/crtbegin.S:1.5 src/lib/csu/arch/vax/crtbegin.S:1.6
--- src/lib/csu/arch/vax/crtbegin.S:1.5	Wed Jul 10 22:55:40 2013
+++ src/lib/csu/arch/vax/crtbegin.S	Wed Jul 10 23:30:45 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: crtbegin.S,v 1.5 2013/07/10 22:55:40 matt Exp $	*/
+/*	$NetBSD: crtbegin.S,v 1.6 2013/07/10 23:30:45 matt Exp $	*/
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,7 +30,7 @@
 
 #include vax/asm.h
 
-RCSID($NetBSD: crtbegin.S,v 1.5 2013/07/10 22:55:40 matt Exp $)
+RCSID($NetBSD: crtbegin.S,v 1.6 2013/07/10 23:30:45 matt Exp $)
 
 	.section	.ctors, aw, @progbits
 	.p2align 2
@@ -120,6 +120,7 @@ _ENTRY(__do_global_dtors_aux, 0x0100)		/
 #endif /* SHARED */
 
 4:	ret
+END(__do_global_dtors_aux)
 
 	.weak	__deregister_frame_info
 	.weak	__cxa_finalize
@@ -167,6 +168,7 @@ _ENTRY(__do_global_ctors_aux, 0x0800)
 	brb	3b			/* get next one */
 
 4:	ret
+END(__do_global_ctors_aux)
 
 	.hidden	_C_LABEL(__CTOR_LIST_END__)
 



CVS commit: src/lib/csu/common

2013-07-04 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Jul  5 02:06:49 UTC 2013

Modified Files:
src/lib/csu/common: Makefile.inc

Log Message:
Only install crtbeginS.o, crtbeginT.o and crtendS.o when MKPIC=yes.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/lib/csu/common/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/Makefile.inc
diff -u src/lib/csu/common/Makefile.inc:1.12 src/lib/csu/common/Makefile.inc:1.13
--- src/lib/csu/common/Makefile.inc:1.12	Thu Jun 27 21:24:39 2013
+++ src/lib/csu/common/Makefile.inc	Fri Jul  5 02:06:49 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.12 2013/06/27 21:24:39 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.13 2013/07/05 02:06:49 joerg Exp $
 
 .include bsd.own.mk
 
@@ -8,7 +8,11 @@ COMMON_DIR:=	${.CURDIR}/common
 CPPFLAGS+=	-I${NETBSDSRCDIR}/libexec/ld.elf_so -I${COMMON_DIR} -I.
 
 OBJS+=		crt0.o gcrt0.o crti.o crtn.o
-OBJS+=		crtbegin.o crtbeginS.o crtend.o
+OBJS+=		crtbegin.o crtend.o
+
+.if ${MKPIC} == yes
+OBJS+=		crtbeginS.o
+.endif
 
 realall: ${OBJS}
 
@@ -92,7 +96,10 @@ crtn.o: crtn.S
 FILES=${OBJS}
 FILESDIR=${LIBDIR}
 CLEANFILES+=${OBJS}
+
+.if ${MKPIC} == yes
 SYMLINKS+=	crtbegin.o ${LIBDIR}/crtbeginT.o
 SYMLINKS+=	crtend.o ${LIBDIR}/crtendS.o
+.endif
 
 .include bsd.prog.mk



CVS commit: src/lib/csu/arch/mips

2013-06-30 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Jun 30 08:00:35 UTC 2013

Modified Files:
src/lib/csu/arch/mips: crtbegin.h crti.S crtn.S

Log Message:
For O32, don't save $gp on the stack, save $s0 instead and just keep $gp
in $s0.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/csu/arch/mips/crtbegin.h
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/mips/crti.S \
src/lib/csu/arch/mips/crtn.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/mips/crtbegin.h
diff -u src/lib/csu/arch/mips/crtbegin.h:1.2 src/lib/csu/arch/mips/crtbegin.h:1.3
--- src/lib/csu/arch/mips/crtbegin.h:1.2	Tue Jun 25 16:51:14 2013
+++ src/lib/csu/arch/mips/crtbegin.h	Sun Jun 30 08:00:34 2013
@@ -32,8 +32,7 @@ __asm(	\n\t
 #ifdef __mips_o32
 	.set noreorder	\n\t
 	.set nomacro		\n\t
-	lw	$28,16($sp) 	\n\t
-	nop			\n\t
+	move	$28,$16 	\n\t
 	lw	$25,%got(__do_global_ctors_aux)($28)		\n\t
 	nop			\n\t
 	addiu   $25,$25,%lo(__do_global_ctors_aux)		\n\t
@@ -52,8 +51,7 @@ __asm(	\n\t
 #ifdef __mips_o32
 	.set noreorder	\n\t
 	.set nomacro		\n\t
-	lw	$28,16($sp) 	\n\t
-	nop			\n\t
+	move	$28,$16 	\n\t
 	lw	$25,%got(__do_global_dtors_aux)($28)		\n\t
 	nop			\n\t
 	addiu   $25,$25,%lo(__do_global_dtors_aux)		\n\t

Index: src/lib/csu/arch/mips/crti.S
diff -u src/lib/csu/arch/mips/crti.S:1.1 src/lib/csu/arch/mips/crti.S:1.2
--- src/lib/csu/arch/mips/crti.S:1.1	Sat Jun 22 02:37:09 2013
+++ src/lib/csu/arch/mips/crti.S	Sun Jun 30 08:00:34 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: crti.S,v 1.1 2013/06/22 02:37:09 matt Exp $ */
+/* $NetBSD: crti.S,v 1.2 2013/06/30 08:00:34 matt Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include mips/asm.h
 
-RCSID($NetBSD: crti.S,v 1.1 2013/06/22 02:37:09 matt Exp $)
+RCSID($NetBSD: crti.S,v 1.2 2013/06/30 08:00:34 matt Exp $)
 
 #include sysident.S
 
@@ -39,16 +39,22 @@ RCSID($NetBSD: crti.S,v 1.1 2013/06/22 
 NESTED_NOPROFILE(_init, CALLFRAME_SIZ, ra)
 SETUP_GP
 PTR_SUBU sp, sp, CALLFRAME_SIZ	# allocate stack frame
-SAVE_GP(CALLFRAME_GP)
-SETUP_GP64(CALLFRAME_GP, _init)
 	REG_S	ra, CALLFRAME_RA(sp)	# save RA
+#ifdef __mips_o32
+	REG_S	s0, CALLFRAME_S0(sp)	# save s0
+	move	s0, gp 
+#endif
+SETUP_GP64(CALLFRAME_GP, _init)
 END(_init)
 
 	.section .fini, ax, @progbits
 NESTED_NOPROFILE(_fini, CALLFRAME_SIZ, ra)
 SETUP_GP
 PTR_SUBU sp, sp, CALLFRAME_SIZ	# allocate stack frame
-SAVE_GP(CALLFRAME_GP)
-SETUP_GP64(CALLFRAME_GP, _fini)
 	REG_S	ra, CALLFRAME_RA(sp)	# save RA
+#ifdef __mips_o32
+	REG_S	s0, CALLFRAME_S0(sp)	# save s0
+	move	s0, gp 
+#endif
+SETUP_GP64(CALLFRAME_GP, _fini)
 END(_fini)
Index: src/lib/csu/arch/mips/crtn.S
diff -u src/lib/csu/arch/mips/crtn.S:1.1 src/lib/csu/arch/mips/crtn.S:1.2
--- src/lib/csu/arch/mips/crtn.S:1.1	Sat Jun 22 02:37:09 2013
+++ src/lib/csu/arch/mips/crtn.S	Sun Jun 30 08:00:34 2013
@@ -29,16 +29,24 @@
 
 #include mips/asm.h
 
-RCSID($NetBSD: crtn.S,v 1.1 2013/06/22 02:37:09 matt Exp $)
+RCSID($NetBSD: crtn.S,v 1.2 2013/06/30 08:00:34 matt Exp $)
 
 	.section .init, ax, @progbits
-	RESTORE_GP64
 	REG_L	ra, CALLFRAME_RA(sp)
+#if defined(__mips_o32) || defined(__mips_o64)
+	REG_L	s0, CALLFRAME_S0(sp)
+#else
+	REG_L	gp, CALLFRAME_GP(sp)
+#endif
 	PTR_ADDU sp, sp, CALLFRAME_SIZ
 	jr	ra
 
 	.section .fini, ax, @progbits
-	RESTORE_GP64
 	REG_L	ra, CALLFRAME_RA(sp)
+#ifdef __mips_o32
+	REG_L	s0, CALLFRAME_S0(sp)
+#else
+	REG_L	gp, CALLFRAME_GP(sp)
+#endif
 	PTR_ADDU sp, sp, CALLFRAME_SIZ
 	jr	ra



CVS commit: src/lib/csu

2013-06-27 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jun 27 21:24:39 UTC 2013

Modified Files:
src/lib/csu/arch/arm: Makefile.inc
src/lib/csu/arch/earm: Makefile.inc
src/lib/csu/arch/powerpc: Makefile.inc crtend.S
src/lib/csu/common: Makefile.inc crtbegin.c
Added Files:
src/lib/csu/arch/arm: crtbegin.h
src/lib/csu/arch/earm: crtbegin.h
src/lib/csu/arch/powerpc: crtbegin.h
src/lib/csu/arch/vax: crtbegin.h
Removed Files:
src/lib/csu/arch/arm: crtbegin.S
src/lib/csu/arch/earm: crtbegin.S
src/lib/csu/arch/powerpc: crtbegin.S

Log Message:
Switch arm, earm, powerpc to use crtbegin.c
Use -fpie for crtbegin.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/csu/arch/arm/Makefile.inc
cvs rdiff -u -r1.6 -r0 src/lib/csu/arch/arm/crtbegin.S
cvs rdiff -u -r0 -r1.1 src/lib/csu/arch/arm/crtbegin.h
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/earm/Makefile.inc
cvs rdiff -u -r1.4 -r0 src/lib/csu/arch/earm/crtbegin.S
cvs rdiff -u -r0 -r1.1 src/lib/csu/arch/earm/crtbegin.h
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/powerpc/Makefile.inc \
src/lib/csu/arch/powerpc/crtend.S
cvs rdiff -u -r1.2 -r0 src/lib/csu/arch/powerpc/crtbegin.S
cvs rdiff -u -r0 -r1.1 src/lib/csu/arch/powerpc/crtbegin.h
cvs rdiff -u -r0 -r1.1 src/lib/csu/arch/vax/crtbegin.h
cvs rdiff -u -r1.11 -r1.12 src/lib/csu/common/Makefile.inc
cvs rdiff -u -r1.2 -r1.3 src/lib/csu/common/crtbegin.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/arm/Makefile.inc
diff -u src/lib/csu/arch/arm/Makefile.inc:1.5 src/lib/csu/arch/arm/Makefile.inc:1.6
--- src/lib/csu/arch/arm/Makefile.inc:1.5	Mon Apr 29 07:21:59 2013
+++ src/lib/csu/arch/arm/Makefile.inc	Thu Jun 27 21:24:39 2013
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile.inc,v 1.5 2013/04/29 07:21:59 skrll Exp $
+# $NetBSD: Makefile.inc,v 1.6 2013/06/27 21:24:39 matt Exp $
 
-CPPFLAGS+=	-DELFSIZE=32
+CPPFLAGS+=	-I${ARCHDIR}
 .if (!empty(CPUFLAGS)  ${CPUFLAGS:M-mabi=aapcs*} != )
 CPPFLAGS+=  -DHAVE_INITFINI_ARRAY
 .endif

Index: src/lib/csu/arch/earm/Makefile.inc
diff -u src/lib/csu/arch/earm/Makefile.inc:1.1 src/lib/csu/arch/earm/Makefile.inc:1.2
--- src/lib/csu/arch/earm/Makefile.inc:1.1	Mon Aug 13 02:49:04 2012
+++ src/lib/csu/arch/earm/Makefile.inc	Thu Jun 27 21:24:39 2013
@@ -1,5 +1,5 @@
-# $NetBSD: Makefile.inc,v 1.1 2012/08/13 02:49:04 matt Exp $
+# $NetBSD: Makefile.inc,v 1.2 2013/06/27 21:24:39 matt Exp $
 
-CPPFLAGS+=	-DELFSIZE=32
+CPPFLAGS+=	-I${ARCHDIR}
 CPPFLAGS+=	-DHAVE_INITFINI_ARRAY
 

Index: src/lib/csu/arch/powerpc/Makefile.inc
diff -u src/lib/csu/arch/powerpc/Makefile.inc:1.1 src/lib/csu/arch/powerpc/Makefile.inc:1.2
--- src/lib/csu/arch/powerpc/Makefile.inc:1.1	Tue Feb  8 02:02:25 2011
+++ src/lib/csu/arch/powerpc/Makefile.inc	Thu Jun 27 21:24:39 2013
@@ -1,5 +1,3 @@
-# $NetBSD: Makefile.inc,v 1.1 2011/02/08 02:02:25 matt Exp $
-
-CPPFLAGS+=	-DELFSIZE=32
-
+# $NetBSD: Makefile.inc,v 1.2 2013/06/27 21:24:39 matt Exp $
 
+CPPFLAGS+=	-I${ARCHDIR}
Index: src/lib/csu/arch/powerpc/crtend.S
diff -u src/lib/csu/arch/powerpc/crtend.S:1.1 src/lib/csu/arch/powerpc/crtend.S:1.2
--- src/lib/csu/arch/powerpc/crtend.S:1.1	Tue Feb  8 02:02:25 2011
+++ src/lib/csu/arch/powerpc/crtend.S	Thu Jun 27 21:24:39 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: crtend.S,v 1.1 2011/02/08 02:02:25 matt Exp $	*/
+/*	$NetBSD: crtend.S,v 1.2 2013/06/27 21:24:39 matt Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,7 +30,7 @@
 
 #include powerpc/asm.h
 
-RCSID($NetBSD: crtend.S,v 1.1 2011/02/08 02:02:25 matt Exp $)
+RCSID($NetBSD: crtend.S,v 1.2 2013/06/27 21:24:39 matt Exp $)
 
 	.section	.ctors, aw, @progbits
 	.p2align 2
@@ -41,6 +41,9 @@ __CTOR_LIST_END__:
 
 	.section	.dtors, aw, @progbits
 	.p2align 2
+	.global		__DTOR_LIST_END__
+	.hidden 	__DTOR_LIST_END__
+__DTOR_LIST_END__:
 	.long 0
 
 	.section	.eh_frame, a, @progbits

Index: src/lib/csu/common/Makefile.inc
diff -u src/lib/csu/common/Makefile.inc:1.11 src/lib/csu/common/Makefile.inc:1.12
--- src/lib/csu/common/Makefile.inc:1.11	Thu Jun 27 03:37:21 2013
+++ src/lib/csu/common/Makefile.inc	Thu Jun 27 21:24:39 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.11 2013/06/27 03:37:21 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.12 2013/06/27 21:24:39 matt Exp $
 
 .include bsd.own.mk
 
@@ -19,7 +19,7 @@ crtbegin.o: crtbegin.S
 .else
 crtbegin.o: crtbegin.c crtbegin.h
 	${_MKTARGET_COMPILE}
-	${COMPILE.c} ${COMMON_DIR}/crtbegin.c -o ${.TARGET}.o
+	${COMPILE.c} -fpie ${COMMON_DIR}/crtbegin.c -o ${.TARGET}.o
 .endif
 	${LD} -x -r -o ${.TARGET} ${.TARGET}.o
 	rm -f ${.TARGET}.o

Index: src/lib/csu/common/crtbegin.c
diff -u src/lib/csu/common/crtbegin.c:1.2 src/lib/csu/common/crtbegin.c:1.3
--- src/lib/csu/common/crtbegin.c:1.2	Mon Jun 24 14:49:13 2013
+++ src/lib/csu/common/crtbegin.c	Thu Jun 27 21:24:39 2013
@@ -27,79 +27,105 @@
  * 

CVS commit: src/lib/csu/common

2013-06-26 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Jun 27 03:37:21 UTC 2013

Modified Files:
src/lib/csu/common: Makefile.inc

Log Message:
Add -fPIC to compile of crtbeginS.o


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/csu/common/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/Makefile.inc
diff -u src/lib/csu/common/Makefile.inc:1.10 src/lib/csu/common/Makefile.inc:1.11
--- src/lib/csu/common/Makefile.inc:1.10	Tue Jun 25 07:18:02 2013
+++ src/lib/csu/common/Makefile.inc	Thu Jun 27 03:37:21 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.10 2013/06/25 07:18:02 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.11 2013/06/27 03:37:21 matt Exp $
 
 .include bsd.own.mk
 
@@ -34,7 +34,7 @@ crtbeginS.o: crtbegin.S
 .else
 crtbeginS.o: crtbegin.c crtbegin.h
 	${_MKTARGET_COMPILE}
-	${COMPILE.c} -DPIC -DSHARED ${COMMON_DIR}/crtbegin.c -o ${.TARGET}.o
+	${COMPILE.c} -fPIC -DPIC -DSHARED ${COMMON_DIR}/crtbegin.c -o ${.TARGET}.o
 .endif
 	${LD} -x -r -o ${.TARGET} ${.TARGET}.o
 	rm -f ${.TARGET}.o



CVS commit: src/lib/csu/arch/mips

2013-06-25 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jun 25 16:47:47 UTC 2013

Modified Files:
src/lib/csu/arch/mips: crt0.S

Log Message:
Initialize $gp


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/mips/crt0.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/mips/crt0.S
diff -u src/lib/csu/arch/mips/crt0.S:1.1 src/lib/csu/arch/mips/crt0.S:1.2
--- src/lib/csu/arch/mips/crt0.S:1.1	Sat Jun 22 02:37:09 2013
+++ src/lib/csu/arch/mips/crt0.S	Tue Jun 25 16:47:47 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.S,v 1.1 2013/06/22 02:37:09 matt Exp $ */
+/* $NetBSD: crt0.S,v 1.2 2013/06/25 16:47:47 matt Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include mips/asm.h
 
-RCSID($NetBSD: crt0.S,v 1.1 2013/06/22 02:37:09 matt Exp $)
+RCSID($NetBSD: crt0.S,v 1.2 2013/06/25 16:47:47 matt Exp $)
 
 STRONG_ALIAS(_start,__start)
 
@@ -49,6 +49,8 @@ STRONG_ALIAS(_start,__start)
  */
 
 NESTED_NOPROFILE(__start, CALLFRAME_SIZ, ra)
+	SETUP_GP
+	SETUP_GP64(t3, __start)
 	move	a0, a1		/* cleanup */
 	move	a1, a2		/* Obj_Entry */
 	move	a2, a3		/* ps_strings */



CVS commit: src/lib/csu/arch/mips

2013-06-25 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jun 25 16:51:14 UTC 2013

Modified Files:
src/lib/csu/arch/mips: crtbegin.h

Log Message:
Deal with O32 callling sequences.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/mips/crtbegin.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/mips/crtbegin.h
diff -u src/lib/csu/arch/mips/crtbegin.h:1.1 src/lib/csu/arch/mips/crtbegin.h:1.2
--- src/lib/csu/arch/mips/crtbegin.h:1.1	Sat Jun 22 02:37:09 2013
+++ src/lib/csu/arch/mips/crtbegin.h	Tue Jun 25 16:51:14 2013
@@ -28,10 +28,41 @@
  */
 
 __asm(	\n\t
-	.pushsection .init, \ax\, @progbits \n\t
-	jal	__do_global_ctors_aux		\n\t
+	.pushsection .init, \ax\, @progbits			\n\t
+#ifdef __mips_o32
+	.set noreorder	\n\t
+	.set nomacro		\n\t
+	lw	$28,16($sp) 	\n\t
+	nop			\n\t
+	lw	$25,%got(__do_global_ctors_aux)($28)		\n\t
+	nop			\n\t
+	addiu   $25,$25,%lo(__do_global_ctors_aux)		\n\t
+	.reloc	1f,R_MIPS_JALR,__do_global_ctors_aux		\n\t
+	1:	jalr	$25	\n\t
+nop			\n\t
+	.set macro		\n\t
+	.set reorder		\n\t
+#else
+	jal	__do_global_ctors_aux\n\t
+#endif
 	.popsection);
+
 __asm(	\n\t
 	.pushsection .fini, \ax\, @progbits \n\t
-	jal	__do_global_dtors_aux		\n\t
+#ifdef __mips_o32
+	.set noreorder	\n\t
+	.set nomacro		\n\t
+	lw	$28,16($sp) 	\n\t
+	nop			\n\t
+	lw	$25,%got(__do_global_dtors_aux)($28)		\n\t
+	nop			\n\t
+	addiu   $25,$25,%lo(__do_global_dtors_aux)		\n\t
+	.reloc	1f,R_MIPS_JALR,__do_global_dtors_aux		\n\t
+	1:	jalr	$25	\n\t
+nop			\n\t
+	.set macro		\n\t
+	.set reorder		\n\t
+#else
+	jal	__do_global_dtors_aux\n\t
+#endif
 	.popsection);



CVS commit: src/lib/csu/common

2013-06-25 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jun 25 07:18:02 UTC 2013

Modified Files:
src/lib/csu/common: Makefile.inc

Log Message:
Reorder to avoid !exists
Add a crtbegin.h dependency


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/csu/common/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/Makefile.inc
diff -u src/lib/csu/common/Makefile.inc:1.9 src/lib/csu/common/Makefile.inc:1.10
--- src/lib/csu/common/Makefile.inc:1.9	Sat Jun 22 02:37:09 2013
+++ src/lib/csu/common/Makefile.inc	Tue Jun 25 07:18:02 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.9 2013/06/22 02:37:09 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.10 2013/06/25 07:18:02 matt Exp $
 
 .include bsd.own.mk
 
@@ -12,14 +12,14 @@ OBJS+=		crtbegin.o crtbeginS.o crtend.o
 
 realall: ${OBJS}
 
-.if !exists(${ARCHDIR}/crtbegin.S)
-crtbegin.o: crtbegin.c
-	${_MKTARGET_COMPILE}
-	${COMPILE.c} ${COMMON_DIR}/crtbegin.c -o ${.TARGET}.o
-.else
+.if exists(${ARCHDIR}/crtbegin.S)
 crtbegin.o: crtbegin.S
 	${_MKTARGET_COMPILE}
 	${COMPILE.S} ${ARCHDIR}/crtbegin.S -o ${.TARGET}.o
+.else
+crtbegin.o: crtbegin.c crtbegin.h
+	${_MKTARGET_COMPILE}
+	${COMPILE.c} ${COMMON_DIR}/crtbegin.c -o ${.TARGET}.o
 .endif
 	${LD} -x -r -o ${.TARGET} ${.TARGET}.o
 	rm -f ${.TARGET}.o
@@ -27,14 +27,14 @@ crtbegin.o: crtbegin.S
 	${OBJCOPY} -R .ident ${.TARGET}
 .endif
 
-.if !exists(${ARCHDIR}/crtbegin.S)
-crtbeginS.o: crtbegin.c
-	${_MKTARGET_COMPILE}
-	${COMPILE.c} -DPIC -DSHARED ${COMMON_DIR}/crtbegin.c -o ${.TARGET}.o
-.else
+.if exists(${ARCHDIR}/crtbegin.S)
 crtbeginS.o: crtbegin.S
 	${_MKTARGET_COMPILE}
 	${COMPILE.S} -DPIC -DSHARED ${ARCHDIR}/crtbegin.S -o ${.TARGET}.o
+.else
+crtbeginS.o: crtbegin.c crtbegin.h
+	${_MKTARGET_COMPILE}
+	${COMPILE.c} -DPIC -DSHARED ${COMMON_DIR}/crtbegin.c -o ${.TARGET}.o
 .endif
 	${LD} -x -r -o ${.TARGET} ${.TARGET}.o
 	rm -f ${.TARGET}.o



CVS commit: src/lib/csu

2013-06-24 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Jun 24 14:27:35 UTC 2013

Modified Files:
src/lib/csu: README

Log Message:
Add some more clues on what is needed to add a new platform.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/README

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/README
diff -u src/lib/csu/README:1.1 src/lib/csu/README:1.2
--- src/lib/csu/README:1.1	Sat Aug  7 18:01:32 2010
+++ src/lib/csu/README	Mon Jun 24 14:27:35 2013
@@ -1,3 +1,24 @@
+Introduction
+
+This document covers the native NetBSD compiler runtime. The full support
+for the native runtime is enabled by setting USE_COMPILERCRTSTUFF to no
+in bsd.own.mk.
+
+Machine independent sources can be found in common. The crtbegin.c in
+that directory is a useful template for deriving compact assembler
+versions. That is preferable to decouple the result from changes in the
+compiler logic.
+
+A new platform should provide the following content in
+arch/${MACHINE_ARCH} or arch/${MACHINE_CPU}:
+- Makefile.inc: provides ELFSIZE corresponding to 32/64bit file format
+- crt0.S: provides setup code and the call to __start.
+- crtbegin.S: see below
+- crtend.S: see below, most likely just a copy of an existing architecture
+- crti.S: prefix part of .init/.fini sections, i.e. to ensure stack alignment
+- crte.S: suffix part of the .init/.fini sections, i.e. return to caller.
+
+
 Overview of the common runtime support
 
 The common runtime support contains two modules, crtbegin and crtend.



CVS commit: src/lib/csu

2013-06-24 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jun 24 14:49:13 UTC 2013

Modified Files:
src/lib/csu/arch/arm: crtbegin.S
src/lib/csu/common: crtbegin.c

Log Message:
Make dwarf_eh_object is 8 words long


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/csu/arch/arm/crtbegin.S
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/common/crtbegin.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/arm/crtbegin.S
diff -u src/lib/csu/arch/arm/crtbegin.S:1.5 src/lib/csu/arch/arm/crtbegin.S:1.6
--- src/lib/csu/arch/arm/crtbegin.S:1.5	Sun May  5 10:26:57 2013
+++ src/lib/csu/arch/arm/crtbegin.S	Mon Jun 24 14:49:13 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: crtbegin.S,v 1.5 2013/05/05 10:26:57 skrll Exp $	*/
+/*	$NetBSD: crtbegin.S,v 1.6 2013/06/24 14:49:13 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,7 +30,7 @@
 
 #include arm/asm.h
 
-RCSID($NetBSD: crtbegin.S,v 1.5 2013/05/05 10:26:57 skrll Exp $)
+RCSID($NetBSD: crtbegin.S,v 1.6 2013/06/24 14:49:13 matt Exp $)
 
 	.section	.ctors, aw, %progbits
 	.p2align 2
@@ -64,7 +64,7 @@ __dso_handle:
 #endif
 
 	.local	__dwarf_eh_object
-	.comm	__dwarf_eh_object,24
+	.comm	__dwarf_eh_object,32
 	.local	__initialized
 	.comm	__initialized,1
 	.local	__finished

Index: src/lib/csu/common/crtbegin.c
diff -u src/lib/csu/common/crtbegin.c:1.1 src/lib/csu/common/crtbegin.c:1.2
--- src/lib/csu/common/crtbegin.c:1.1	Sat Jun 22 02:37:09 2013
+++ src/lib/csu/common/crtbegin.c	Mon Jun 24 14:49:13 2013
@@ -27,7 +27,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: crtbegin.c,v 1.1 2013/06/22 02:37:09 matt Exp $);
+__RCSID($NetBSD: crtbegin.c,v 1.2 2013/06/24 14:49:13 matt Exp $);
 
 typedef void (*fptr_t)(void);
 
@@ -57,7 +57,7 @@ __weakref_visible void register_frame_in
 __weakref_visible void deregister_frame_info(const void *)
 	__weak_reference(__deregister_frame_info);
 
-static long dwarf_eh_object[6];
+static long dwarf_eh_object[8];
 static unsigned char __initialized;
 static unsigned char __finished;
 



CVS commit: src/lib/csu/arch/earm

2013-06-24 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jun 24 14:53:42 UTC 2013

Modified Files:
src/lib/csu/arch/earm: crtbegin.S

Log Message:
Make sure dwarf_eh_object is 8 words long.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/csu/arch/earm/crtbegin.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/earm/crtbegin.S
diff -u src/lib/csu/arch/earm/crtbegin.S:1.2 src/lib/csu/arch/earm/crtbegin.S:1.3
--- src/lib/csu/arch/earm/crtbegin.S:1.2	Sun May  5 10:26:57 2013
+++ src/lib/csu/arch/earm/crtbegin.S	Mon Jun 24 14:53:42 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: crtbegin.S,v 1.2 2013/05/05 10:26:57 skrll Exp $	*/
+/*	$NetBSD: crtbegin.S,v 1.3 2013/06/24 14:53:42 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,7 +30,7 @@
 
 #include arm/asm.h
 
-RCSID($NetBSD: crtbegin.S,v 1.2 2013/05/05 10:26:57 skrll Exp $)
+RCSID($NetBSD: crtbegin.S,v 1.3 2013/06/24 14:53:42 matt Exp $)
 
 	.section	.eh_frame, a, %progbits
 	.p2align 2
@@ -209,7 +209,7 @@ __do_global_ctors_aux:
 	.local	__initialized
 	.comm	__initialized,1,1
 	.local	__dwarf_eh_object
-	.comm	__dwarf_eh_object,24,4
+	.comm	__dwarf_eh_object,32,4
 
 	.section .init_array,aw,%init_array
 	.p2align 2



CVS commit: src/lib/csu/arch/vax

2013-06-24 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jun 24 14:49:55 UTC 2013

Modified Files:
src/lib/csu/arch/vax: crtbegin.S

Log Message:
Like the rest, make __DTOR_LIST__ start with a -1
Make sure dwarf_eh_object is 8 words long.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/vax/crtbegin.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/vax/crtbegin.S
diff -u src/lib/csu/arch/vax/crtbegin.S:1.1 src/lib/csu/arch/vax/crtbegin.S:1.2
--- src/lib/csu/arch/vax/crtbegin.S:1.1	Fri Jun 21 15:54:08 2013
+++ src/lib/csu/arch/vax/crtbegin.S	Mon Jun 24 14:49:55 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: crtbegin.S,v 1.1 2013/06/21 15:54:08 matt Exp $	*/
+/*	$NetBSD: crtbegin.S,v 1.2 2013/06/24 14:49:55 matt Exp $	*/
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,7 +30,7 @@
 
 #include vax/asm.h
 
-RCSID($NetBSD: crtbegin.S,v 1.1 2013/06/21 15:54:08 matt Exp $)
+RCSID($NetBSD: crtbegin.S,v 1.2 2013/06/24 14:49:55 matt Exp $)
 
 	.section	.ctors, aw, @progbits
 	.p2align 2
@@ -40,6 +40,7 @@ __CTOR_LIST__:		/* symbol is not used */
 	.section	.dtors, aw, @progbits
 	.p2align 2
 __DTOR_LIST__:
+	.word -1
 
 	.section	.eh_frame, a, @progbits
 	.p2align 2
@@ -63,7 +64,7 @@ __dso_handle:
 #endif
 
 	.local	__dwarf_eh_object
-	.comm	__dwarf_eh_object,24
+	.comm	__dwarf_eh_object,32
 	.local	__initialized
 	.comm	__initialized,1
 	.local	__finished
@@ -102,7 +103,7 @@ __do_global_dtors_aux:
 	 * We use load with postincrement to advance the pointer along.
 	 * We know the list ends with 0.  If we load one, we must be done.
 	 */
-	moval	__DTOR_LIST__, %r8	/* skip first entry */
+	moval	__DTOR_LIST__+4, %r8	/* skip first entry */
 2:	movl	(%r8)+, %r0		/* r0 = *r8++; */
 	beql	3f
 	calls	$0, (%r0)



CVS commit: src/lib/csu/arch/earm

2013-06-24 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Jun 24 20:56:18 UTC 2013

Modified Files:
src/lib/csu/arch/earm: crtbegin.S

Log Message:
Use (target1) for .init/fini array entries


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/csu/arch/earm/crtbegin.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/earm/crtbegin.S
diff -u src/lib/csu/arch/earm/crtbegin.S:1.3 src/lib/csu/arch/earm/crtbegin.S:1.4
--- src/lib/csu/arch/earm/crtbegin.S:1.3	Mon Jun 24 14:53:42 2013
+++ src/lib/csu/arch/earm/crtbegin.S	Mon Jun 24 20:56:18 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: crtbegin.S,v 1.3 2013/06/24 14:53:42 matt Exp $	*/
+/*	$NetBSD: crtbegin.S,v 1.4 2013/06/24 20:56:18 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,7 +30,7 @@
 
 #include arm/asm.h
 
-RCSID($NetBSD: crtbegin.S,v 1.3 2013/06/24 14:53:42 matt Exp $)
+RCSID($NetBSD: crtbegin.S,v 1.4 2013/06/24 20:56:18 matt Exp $)
 
 	.section	.eh_frame, a, %progbits
 	.p2align 2
@@ -117,7 +117,7 @@ __do_global_dtors_aux:
 
 	.pushsection .fini_array,aw,%fini_array
 	.p2align 2
-	.word	__do_global_dtors_aux
+	.word	__do_global_dtors_aux(target1)
 	.popsection
 #endif /* SHARED */
 
@@ -213,4 +213,4 @@ __do_global_ctors_aux:
 
 	.section .init_array,aw,%init_array
 	.p2align 2
-	.word	__do_global_ctors_aux
+	.word	__do_global_ctors_aux(target1)



CVS commit: src/lib/csu/arch/vax

2013-06-24 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jun 25 00:30:07 UTC 2013

Modified Files:
src/lib/csu/arch/vax: Makefile.inc crtbegin.S crtend.S

Log Message:
Use .long not .word
Use _ENTRY
[with these changes, the crtstuff passes its ATF tests.]


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/csu/arch/vax/Makefile.inc \
src/lib/csu/arch/vax/crtbegin.S
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/vax/crtend.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/vax/Makefile.inc
diff -u src/lib/csu/arch/vax/Makefile.inc:1.2 src/lib/csu/arch/vax/Makefile.inc:1.3
--- src/lib/csu/arch/vax/Makefile.inc:1.2	Fri Jun 21 15:54:08 2013
+++ src/lib/csu/arch/vax/Makefile.inc	Tue Jun 25 00:30:07 2013
@@ -1,3 +1,3 @@
-# $NetBSD: Makefile.inc,v 1.2 2013/06/21 15:54:08 matt Exp $
+# $NetBSD: Makefile.inc,v 1.3 2013/06/25 00:30:07 matt Exp $
 
-CPPFLAGS+=	-DELFSIZE=32
+CPPFLAGS+=	-I${ARCHDIR}
Index: src/lib/csu/arch/vax/crtbegin.S
diff -u src/lib/csu/arch/vax/crtbegin.S:1.2 src/lib/csu/arch/vax/crtbegin.S:1.3
--- src/lib/csu/arch/vax/crtbegin.S:1.2	Mon Jun 24 14:49:55 2013
+++ src/lib/csu/arch/vax/crtbegin.S	Tue Jun 25 00:30:07 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: crtbegin.S,v 1.2 2013/06/24 14:49:55 matt Exp $	*/
+/*	$NetBSD: crtbegin.S,v 1.3 2013/06/25 00:30:07 matt Exp $	*/
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,17 +30,17 @@
 
 #include vax/asm.h
 
-RCSID($NetBSD: crtbegin.S,v 1.2 2013/06/24 14:49:55 matt Exp $)
+RCSID($NetBSD: crtbegin.S,v 1.3 2013/06/25 00:30:07 matt Exp $)
 
 	.section	.ctors, aw, @progbits
 	.p2align 2
 __CTOR_LIST__:		/* symbol is not used */
-	.word -1
+	.long -1
 
 	.section	.dtors, aw, @progbits
 	.p2align 2
 __DTOR_LIST__:
-	.word -1
+	.long -1
 
 	.section	.eh_frame, a, @progbits
 	.p2align 2
@@ -58,9 +58,9 @@ __JCR_LIST__:
 	.hidden	__dso_handle
 __dso_handle:
 #ifdef SHARED
-	.word	__dso_handle
+	.long	__dso_handle
 #else
-	.word	0
+	.long	0
 #endif
 
 	.local	__dwarf_eh_object
@@ -80,9 +80,7 @@ __dso_handle:
  * needed.
  */
 
-	.type __do_global_dtors_aux, @function
-__do_global_dtors_aux:
-	.word	0x0100/* save r8 */
+_ENTRY(__do_global_dtors_aux, 0x0100)		/* save r8 */
 	tstb	__finished			/* done this already? */
 	bneq	4f
 	movb	$1, __finished			/* mark it as done */
@@ -129,8 +127,7 @@ __do_global_dtors_aux:
 	.weak	__register_frame_info
 	.weak	_Jv_RegisterClasses
 
-	.type __do_global_ctors_aux, @function
-__do_global_ctors_aux:
+_ENTRY(__do_global_ctors_aux, 0x0800)
 	tstb	__initialized
 	bneq	4f
 	movb	$1, __initialized

Index: src/lib/csu/arch/vax/crtend.S
diff -u src/lib/csu/arch/vax/crtend.S:1.1 src/lib/csu/arch/vax/crtend.S:1.2
--- src/lib/csu/arch/vax/crtend.S:1.1	Fri Jun 21 15:54:08 2013
+++ src/lib/csu/arch/vax/crtend.S	Tue Jun 25 00:30:07 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: crtend.S,v 1.1 2013/06/21 15:54:08 matt Exp $	*/
+/*	$NetBSD: crtend.S,v 1.2 2013/06/25 00:30:07 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,21 +30,21 @@
 
 #include vax/asm.h
 
-RCSID($NetBSD: crtend.S,v 1.1 2013/06/21 15:54:08 matt Exp $)
+RCSID($NetBSD: crtend.S,v 1.2 2013/06/25 00:30:07 matt Exp $)
 
 	.section	.ctors, aw, @progbits
 	.p2align 2
 	.global		__CTOR_LIST_END__
 	.hidden 	__CTOR_LIST_END__
 __CTOR_LIST_END__:
-	.word		0
+	.long		0
 
 	.section	.dtors, aw, @progbits
 	.p2align 2
 	.global		__DTOR_LIST_END__
 	.hidden 	__DTOR_LIST_END__
 __DTOR_LIST_END__:
-	.word		0
+	.long		0
 
 	.section	.eh_frame, a, @progbits
 	.p2align 2



CVS commit: src/lib/csu/arch/vax

2013-06-21 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Jun 21 15:54:08 UTC 2013

Modified Files:
src/lib/csu/arch/vax: Makefile.inc crt0.S
Added Files:
src/lib/csu/arch/vax: crtbegin.S crtend.S

Log Message:
USE_COMPILERCRTSTUFF=no support for vax.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/vax/Makefile.inc
cvs rdiff -u -r1.2 -r1.3 src/lib/csu/arch/vax/crt0.S
cvs rdiff -u -r0 -r1.1 src/lib/csu/arch/vax/crtbegin.S \
src/lib/csu/arch/vax/crtend.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/vax/Makefile.inc
diff -u src/lib/csu/arch/vax/Makefile.inc:1.1 src/lib/csu/arch/vax/Makefile.inc:1.2
--- src/lib/csu/arch/vax/Makefile.inc:1.1	Sat Aug  7 18:01:34 2010
+++ src/lib/csu/arch/vax/Makefile.inc	Fri Jun 21 15:54:08 2013
@@ -1,5 +1,3 @@
-# $NetBSD: Makefile.inc,v 1.1 2010/08/07 18:01:34 joerg Exp $
+# $NetBSD: Makefile.inc,v 1.2 2013/06/21 15:54:08 matt Exp $
 
 CPPFLAGS+=	-DELFSIZE=32
-
-

Index: src/lib/csu/arch/vax/crt0.S
diff -u src/lib/csu/arch/vax/crt0.S:1.2 src/lib/csu/arch/vax/crt0.S:1.3
--- src/lib/csu/arch/vax/crt0.S:1.2	Sat Jul  2 20:14:10 2011
+++ src/lib/csu/arch/vax/crt0.S	Fri Jun 21 15:54:08 2013
@@ -1,10 +1,12 @@
-/* $NetBSD: crt0.S,v 1.2 2011/07/02 20:14:10 matt Exp $ */
+/* $NetBSD: crt0.S,v 1.3 2013/06/21 15:54:08 matt Exp $ */
 
-/*
- * Copyright (c) 1999 Matt Thomas
- * Copyright (c) 1995 Christopher G. Demetriou
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
- * 
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -13,37 +15,28 @@
  * 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.  See http://www.NetBSD.org/ for
- *  information about NetBSD.
- * 4. The name of the author may not be used to endorse or promote products
- *derived from this software without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * 
- * Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp
+ *
+ * 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
+#include vax/asm.h
 
-RCSID($NetBSD: crt0.S,v 1.2 2011/07/02 20:14:10 matt Exp $)
+RCSID($NetBSD: crt0.S,v 1.3 2013/06/21 15:54:08 matt Exp $)
 
 STRONG_ALIAS(_start,__start)
 
-_ENTRY(__start)
-	.word	0x0101
-	pushl	%r9		/* ps_strings */
-	pushl	%r8		/* obj */
+_ENTRY(__start, 0x0101)
+	movq	%r8,-(%sp)	/* ps_strings / obj */
 	pushl	%r7		/* cleanup */
 	calls	$3,___start
+END(__start)

Added files:

Index: src/lib/csu/arch/vax/crtbegin.S
diff -u /dev/null src/lib/csu/arch/vax/crtbegin.S:1.1
--- /dev/null	Fri Jun 21 15:54:08 2013
+++ src/lib/csu/arch/vax/crtbegin.S	Fri Jun 21 15:54:08 2013
@@ -0,0 +1,178 @@
+/*	$NetBSD: crtbegin.S,v 1.1 2013/06/21 15:54:08 matt Exp $	*/
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code 

CVS commit: src/lib/csu/common

2013-06-21 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jun 22 02:21:58 UTC 2013

Modified Files:
src/lib/csu/common: Makefile.inc

Log Message:
Allow crtbegin to be a C file.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/csu/common/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/Makefile.inc
diff -u src/lib/csu/common/Makefile.inc:1.7 src/lib/csu/common/Makefile.inc:1.8
--- src/lib/csu/common/Makefile.inc:1.7	Sun Mar 25 06:55:19 2012
+++ src/lib/csu/common/Makefile.inc	Sat Jun 22 02:21:58 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.7 2012/03/25 06:55:19 joerg Exp $
+#	$NetBSD: Makefile.inc,v 1.8 2013/06/22 02:21:58 matt Exp $
 
 .include bsd.own.mk
 
@@ -12,18 +12,30 @@ OBJS+=		crtbegin.o crtbeginS.o crtend.o
 
 realall: ${OBJS}
 
+.if exists(${ARCHDIR}/crtbegin.c)
+crtbegin.o: crtbegin.c
+	${_MKTARGET_COMPILE}
+	${COMPILE.c} ${ARCHDIR}/crtbegin.c -o ${.TARGET}.o
+.else
 crtbegin.o: crtbegin.S
 	${_MKTARGET_COMPILE}
 	${COMPILE.S} ${ARCHDIR}/crtbegin.S -o ${.TARGET}.o
+.endif
 	${LD} -x -r -o ${.TARGET} ${.TARGET}.o
 	rm -f ${.TARGET}.o
 .if ${MKSTRIPIDENT} != no
 	${OBJCOPY} -R .ident ${.TARGET}
 .endif
 
+.if exists(${ARCHDIR}/crtbegin.c)
+crtbeginS.o: crtbegin.c
+	${_MKTARGET_COMPILE}
+	${COMPILE.c} -DPIC -DSHARED ${ARCHDIR}/crtbegin.c -o ${.TARGET}.o
+.else
 crtbeginS.o: crtbegin.S
 	${_MKTARGET_COMPILE}
 	${COMPILE.S} -DPIC -DSHARED ${ARCHDIR}/crtbegin.S -o ${.TARGET}.o
+.endif
 	${LD} -x -r -o ${.TARGET} ${.TARGET}.o
 	rm -f ${.TARGET}.o
 .if ${MKSTRIPIDENT} != no



CVS commit: src/lib/csu

2013-06-21 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jun 22 02:37:09 UTC 2013

Modified Files:
src/lib/csu/common: Makefile.inc
Added Files:
src/lib/csu/arch/mips: Makefile.inc crt0.S crtbegin.h crtend.S crti.S
crtn.S
src/lib/csu/common: crtbegin.c

Log Message:
Add a common crtbegin.c file and use a machine dependent crtbegin.h to
fill in .init/.fini.
Add mips support for USE_COMPILERCRTSTUFF=no (compiled only)


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/lib/csu/arch/mips/Makefile.inc \
src/lib/csu/arch/mips/crt0.S src/lib/csu/arch/mips/crtbegin.h \
src/lib/csu/arch/mips/crtend.S src/lib/csu/arch/mips/crti.S \
src/lib/csu/arch/mips/crtn.S
cvs rdiff -u -r1.8 -r1.9 src/lib/csu/common/Makefile.inc
cvs rdiff -u -r0 -r1.1 src/lib/csu/common/crtbegin.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/common/Makefile.inc
diff -u src/lib/csu/common/Makefile.inc:1.8 src/lib/csu/common/Makefile.inc:1.9
--- src/lib/csu/common/Makefile.inc:1.8	Sat Jun 22 02:21:58 2013
+++ src/lib/csu/common/Makefile.inc	Sat Jun 22 02:37:09 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.8 2013/06/22 02:21:58 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.9 2013/06/22 02:37:09 matt Exp $
 
 .include bsd.own.mk
 
@@ -12,10 +12,10 @@ OBJS+=		crtbegin.o crtbeginS.o crtend.o
 
 realall: ${OBJS}
 
-.if exists(${ARCHDIR}/crtbegin.c)
+.if !exists(${ARCHDIR}/crtbegin.S)
 crtbegin.o: crtbegin.c
 	${_MKTARGET_COMPILE}
-	${COMPILE.c} ${ARCHDIR}/crtbegin.c -o ${.TARGET}.o
+	${COMPILE.c} ${COMMON_DIR}/crtbegin.c -o ${.TARGET}.o
 .else
 crtbegin.o: crtbegin.S
 	${_MKTARGET_COMPILE}
@@ -27,10 +27,10 @@ crtbegin.o: crtbegin.S
 	${OBJCOPY} -R .ident ${.TARGET}
 .endif
 
-.if exists(${ARCHDIR}/crtbegin.c)
+.if !exists(${ARCHDIR}/crtbegin.S)
 crtbeginS.o: crtbegin.c
 	${_MKTARGET_COMPILE}
-	${COMPILE.c} -DPIC -DSHARED ${ARCHDIR}/crtbegin.c -o ${.TARGET}.o
+	${COMPILE.c} -DPIC -DSHARED ${COMMON_DIR}/crtbegin.c -o ${.TARGET}.o
 .else
 crtbeginS.o: crtbegin.S
 	${_MKTARGET_COMPILE}

Added files:

Index: src/lib/csu/arch/mips/Makefile.inc
diff -u /dev/null src/lib/csu/arch/mips/Makefile.inc:1.1
--- /dev/null	Sat Jun 22 02:37:09 2013
+++ src/lib/csu/arch/mips/Makefile.inc	Sat Jun 22 02:37:09 2013
@@ -0,0 +1,3 @@
+#	$NetBSD: Makefile.inc,v 1.1 2013/06/22 02:37:09 matt Exp $
+
+CPPFLAGS+=	-I${ARCHDIR}
Index: src/lib/csu/arch/mips/crt0.S
diff -u /dev/null src/lib/csu/arch/mips/crt0.S:1.1
--- /dev/null	Sat Jun 22 02:37:09 2013
+++ src/lib/csu/arch/mips/crt0.S	Sat Jun 22 02:37:09 2013
@@ -0,0 +1,56 @@
+/* $NetBSD: crt0.S,v 1.1 2013/06/22 02:37:09 matt Exp $ */
+
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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.
+ *
+ * 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/asm.h
+
+RCSID($NetBSD: crt0.S,v 1.1 2013/06/22 02:37:09 matt Exp $)
+
+STRONG_ALIAS(_start,__start)
+
+/*
+ *	Assumes kernel (or ld_elf.so) passes the following parameters to
+ *	user-space in registers:
+ *
+ *	a0  stack pointer (0 if setregs didn't fill this in)
+ *	a1  cleanup
+ *	a2  Obj_Entry
+ *	a3  ps_strings
+ *
+ *  XXX Does this violate the ABI?
+ *  as well as the usual registers (pc, sp, and t9 == pc for ABI).
+ */
+
+NESTED_NOPROFILE(__start, CALLFRAME_SIZ, ra)
+	move	a0, a1		/* cleanup */
+	move	a1, a2		/* Obj_Entry */
+	move	a2, a3		/* ps_strings */
+	j	_C_LABEL(___start)
+END(__start)
Index: src/lib/csu/arch/mips/crtbegin.h
diff -u /dev/null 

CVS commit: src/lib/csu/arch

2013-05-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun May  5 10:26:57 UTC 2013

Modified Files:
src/lib/csu/arch/arm: crtbegin.S
src/lib/csu/arch/earm: crtbegin.S

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/csu/arch/arm/crtbegin.S
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/earm/crtbegin.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/csu/arch/arm/crtbegin.S
diff -u src/lib/csu/arch/arm/crtbegin.S:1.4 src/lib/csu/arch/arm/crtbegin.S:1.5
--- src/lib/csu/arch/arm/crtbegin.S:1.4	Sat Aug 25 15:39:05 2012
+++ src/lib/csu/arch/arm/crtbegin.S	Sun May  5 10:26:57 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: crtbegin.S,v 1.4 2012/08/25 15:39:05 matt Exp $	*/
+/*	$NetBSD: crtbegin.S,v 1.5 2013/05/05 10:26:57 skrll Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,7 +30,7 @@
 
 #include arm/asm.h
 
-RCSID($NetBSD: crtbegin.S,v 1.4 2012/08/25 15:39:05 matt Exp $)
+RCSID($NetBSD: crtbegin.S,v 1.5 2013/05/05 10:26:57 skrll Exp $)
 
 	.section	.ctors, aw, %progbits
 	.p2align 2
@@ -186,7 +186,7 @@ __do_global_dtors_aux:
 
 	.type __do_global_ctors_aux, %function
 __do_global_ctors_aux:
-	GOT_INIT(r3, .Lctors_got, .Lctors) 
+	GOT_INIT(r3, .Lctors_got, .Lctors)
 	ldr	r1, .L__initialized
 #ifdef PIC
 ldrb	r0, [r1, r3]!
@@ -249,7 +249,7 @@ __do_global_ctors_aux:
 	/*
 	 * Get the start and end of the CTOR list.
 	 */
-	
+
 	ldr	r4, .L__CTOR_LIST__
 	ldr	r5, .L__CTOR_LIST_END__
 #ifdef PIC

Index: src/lib/csu/arch/earm/crtbegin.S
diff -u src/lib/csu/arch/earm/crtbegin.S:1.1 src/lib/csu/arch/earm/crtbegin.S:1.2
--- src/lib/csu/arch/earm/crtbegin.S:1.1	Mon Aug 13 02:49:04 2012
+++ src/lib/csu/arch/earm/crtbegin.S	Sun May  5 10:26:57 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: crtbegin.S,v 1.1 2012/08/13 02:49:04 matt Exp $	*/
+/*	$NetBSD: crtbegin.S,v 1.2 2013/05/05 10:26:57 skrll Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,7 +30,7 @@
 
 #include arm/asm.h
 
-RCSID($NetBSD: crtbegin.S,v 1.1 2012/08/13 02:49:04 matt Exp $)
+RCSID($NetBSD: crtbegin.S,v 1.2 2013/05/05 10:26:57 skrll Exp $)
 
 	.section	.eh_frame, a, %progbits
 	.p2align 2
@@ -129,7 +129,7 @@ __do_global_dtors_aux:
 
 	.type __do_global_ctors_aux, %function
 __do_global_ctors_aux:
-	GOT_INIT(r3, .Lctors_got, .Lctors) 
+	GOT_INIT(r3, .Lctors_got, .Lctors)
 	ldr	r1, .L__initialized		/* GOTOFF if PIC */
 #ifdef PIC
 	ldrb	r0, [r1, r3]!			/* r1 = r1 + got */



  1   2   >