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 
 
-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/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 
 
-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 
 
-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/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/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 
 
-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/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 
 
-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/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 
 
-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/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 
 
-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