Module Name:    src
Committed By:   riz
Date:           Mon Aug 13 17:09:50 UTC 2012

Modified Files:
        src/external/gpl3/gcc/dist/gcc/config [netbsd-6]: netbsd-elf.h
        src/lib/csu/sparc64 [netbsd-6]: Makefile crt0.c
        src/lib/csu/sparc_elf [netbsd-6]: Makefile crt0.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #475):
        lib/csu/sparc_elf/Makefile: revision 1.7
        external/gpl3/gcc/dist/gcc/config/netbsd-elf.h: revision 1.4
        lib/csu/sparc64/Makefile: revision 1.9
        lib/csu/sparc_elf/crt0.c: revision 1.15
        lib/csu/sparc64/crt0.c: revision 1.27
Make this position independend (for -pie executables)
Slightly simplify and make position independend.
Part of fixing PR port-sparc64/46724.
pay attention to -pie: link crt{begin,end}S.o.
this fixes -fpie on sparc and sparc64, and probably others.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.4.1 \
    src/external/gpl3/gcc/dist/gcc/config/netbsd-elf.h
cvs rdiff -u -r1.8 -r1.8.4.1 src/lib/csu/sparc64/Makefile
cvs rdiff -u -r1.26 -r1.26.6.1 src/lib/csu/sparc64/crt0.c
cvs rdiff -u -r1.6 -r1.6.44.1 src/lib/csu/sparc_elf/Makefile
cvs rdiff -u -r1.14 -r1.14.6.1 src/lib/csu/sparc_elf/crt0.c

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/config/netbsd-elf.h
diff -u src/external/gpl3/gcc/dist/gcc/config/netbsd-elf.h:1.2 src/external/gpl3/gcc/dist/gcc/config/netbsd-elf.h:1.2.4.1
--- src/external/gpl3/gcc/dist/gcc/config/netbsd-elf.h:1.2	Tue Jun 21 02:41:36 2011
+++ src/external/gpl3/gcc/dist/gcc/config/netbsd-elf.h	Mon Aug 13 17:09:49 2012
@@ -52,8 +52,11 @@ along with GCC; see the file COPYING3.  
        %{!p:crt0%O%s}}}		\
    %:if-exists(crti%O%s)	\
    %{static:%:if-exists-else(crtbeginT%O%s crtbegin%O%s)} \
-   %{!static: \
-     %{!shared:crtbegin%O%s} %{shared:crtbeginS%O%s}}"
+   %{!static:                   \
+     %{!shared:                 \
+       %{!pie:crtbegin%O%s}     \
+       %{pie:crtbeginS%O%s}}    \
+     %{shared:crtbeginS%O%s}}"
 
 #undef STARTFILE_SPEC
 #define STARTFILE_SPEC NETBSD_STARTFILE_SPEC
@@ -64,7 +67,10 @@ along with GCC; see the file COPYING3.  
    C++ file-scope static objects deconstructed after exiting "main".  */
 
 #define NETBSD_ENDFILE_SPEC	\
-  "%{!shared:crtend%O%s} %{shared:crtendS%O%s} \
+  "%{!shared:                   \
+    %{!pie:crtend%O%s}          \
+    %{pie:crtendS%O%s}}         \
+   %{shared:crtendS%O%s}        \
    %:if-exists(crtn%O%s)"
 
 #undef ENDFILE_SPEC

Index: src/lib/csu/sparc64/Makefile
diff -u src/lib/csu/sparc64/Makefile:1.8 src/lib/csu/sparc64/Makefile:1.8.4.1
--- src/lib/csu/sparc64/Makefile:1.8	Sat Jul 16 23:07:50 2011
+++ src/lib/csu/sparc64/Makefile	Mon Aug 13 17:09:49 2012
@@ -1,7 +1,7 @@
-#	$NetBSD: Makefile,v 1.8 2011/07/16 23:07:50 mrg Exp $
+#	$NetBSD: Makefile,v 1.8.4.1 2012/08/13 17:09:49 riz Exp $
 
-#Uncomment the next line to enable the new .init fallthru
 CPPFLAGS+=	-I${.CURDIR}/../sparc_elf
+CFLAGS+=	-fPIC
 
 ELFSIZE=64
 

Index: src/lib/csu/sparc64/crt0.c
diff -u src/lib/csu/sparc64/crt0.c:1.26 src/lib/csu/sparc64/crt0.c:1.26.6.1
--- src/lib/csu/sparc64/crt0.c:1.26	Mon Mar  7 05:09:11 2011
+++ src/lib/csu/sparc64/crt0.c	Mon Aug 13 17:09:50 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.c,v 1.26 2011/03/07 05:09:11 joerg Exp $ */
+/* $NetBSD: crt0.c,v 1.26.6.1 2012/08/13 17:09:50 riz Exp $ */
 
 /*
  * Copyright (c) 1995 Christopher G. Demetriou
@@ -45,8 +45,6 @@
  */
 
 __asm("\n\
-	.data\n\
-__data_start:					! Start of data section\n\
 	.text\n\
 	.align 4\n\
 	.global _start\n\
@@ -55,11 +53,9 @@ __data_start:					! Start of data sectio
 	.register %g2,#scratch\n\
 _start:\n\
 __start:\n\
-	setx	__data_start, %o0, %g4		! Point %g4 to start of data section\n\
-	clr	%g4				! egcs thinks this is zero. XXX\n\
+	clr	%g4				! XXX depends on memory model used \n\
 	clr	%fp\n\
 	add	%sp, 8*16 + 0x7ff, %o0		! start of stack\n\
-	mov	%g1, %o1			! Cleanup routine\n\
 	mov	%g3, %o1			! XXXX our rtld uses %g3\n\
 	mov	%g2, %o2			! XXXX obj from rtld.\n\
 	ba,pt	%icc, ___start			! XXXX jump over the retl egcs 2.96 inserts\n\
@@ -115,7 +111,7 @@ ___start(char **sp,
  * NOTE: Leave the RCS ID _after_ _start(), in case it gets placed in .text.
  */
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: crt0.c,v 1.26 2011/03/07 05:09:11 joerg Exp $");
+__RCSID("$NetBSD: crt0.c,v 1.26.6.1 2012/08/13 17:09:50 riz Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "common.c"

Index: src/lib/csu/sparc_elf/Makefile
diff -u src/lib/csu/sparc_elf/Makefile:1.6 src/lib/csu/sparc_elf/Makefile:1.6.44.1
--- src/lib/csu/sparc_elf/Makefile:1.6	Fri May 19 19:11:12 2006
+++ src/lib/csu/sparc_elf/Makefile	Mon Aug 13 17:09:49 2012
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile,v 1.6 2006/05/19 19:11:12 christos Exp $
+#	$NetBSD: Makefile,v 1.6.44.1 2012/08/13 17:09:49 riz Exp $
 
-#Uncomment the next line to enable the new .init fallthru
 CPPFLAGS+=	-I${.CURDIR}
+CFLAGS+=	-fPIC
 
 .include "${.CURDIR}/../common_elf/Makefile.inc"

Index: src/lib/csu/sparc_elf/crt0.c
diff -u src/lib/csu/sparc_elf/crt0.c:1.14 src/lib/csu/sparc_elf/crt0.c:1.14.6.1
--- src/lib/csu/sparc_elf/crt0.c:1.14	Mon Mar  7 05:09:11 2011
+++ src/lib/csu/sparc_elf/crt0.c	Mon Aug 13 17:09:49 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0.c,v 1.14 2011/03/07 05:09:11 joerg Exp $ */
+/* $NetBSD: crt0.c,v 1.14.6.1 2012/08/13 17:09:49 riz Exp $ */
 
 /*
  * Copyright (c) 1998 Christos Zoulas
@@ -56,7 +56,7 @@ _start:\n\
 	sub	%sp, 24, %sp		! expand to standard stack frame size\n\
 	mov	%g3, %o3\n\
 	mov	%g2, %o4\n\
-	call	___start\n\
+	ba	___start\n\
 	 mov	%g1, %o5\n\
 ");
 
@@ -100,7 +100,7 @@ ___start(int argc, char **argv, char **e
  * NOTE: Leave the RCS ID _after_ __start(), in case it gets placed in .text.
  */
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: crt0.c,v 1.14 2011/03/07 05:09:11 joerg Exp $");
+__RCSID("$NetBSD: crt0.c,v 1.14.6.1 2012/08/13 17:09:49 riz Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "common.c"

Reply via email to