public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix PIEs on SPARC{,64}
@ 2004-03-04 23:14 Jakub Jelinek
  2004-03-04 23:23 ` Ulrich Drepper
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2004-03-04 23:14 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Glibc hackers, tcallawa

Hi!

2004-03-05  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/sparc/sparc32/elf/start.S: Handle PIEs.
	* sysdeps/sparc/sparc64/elf/start.S: Likewise.

--- libc/sysdeps/sparc/sparc32/elf/start.S.jj	2002-12-09 21:37:22.000000000 +0100
+++ libc/sysdeps/sparc/sparc32/elf/start.S	2004-03-05 00:00:30.907381337 +0100
@@ -1,5 +1,5 @@
 /* Startup code for elf32-sparc
-   Copyright (C) 1997, 1998, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2002, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.
 
@@ -23,10 +23,21 @@
 
 	.section ".text"
 	.align 4
+#ifdef SHARED
+.LLGETPC0:
+	retl
+	 add	%o7, %l7, %l7
+#endif
 	.global _start
 	.type _start,#function
 _start:
 
+#ifdef SHARED
+	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %l7
+	call	.LLGETPC0
+	 add	%l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7
+#endif
+
   /* Terminate the stack frame, and reserve space for functions to
      drop their arguments.  */
 	mov	%g0, %fp
@@ -44,6 +55,11 @@ _start:
 	or	%o0, %lo(main), %o0
 	or	%o3, %lo(__libc_csu_init), %o3
 	or	%o4, %lo(__libc_csu_fini), %o4
+#ifdef SHARED
+	ld	[%l7 + %o0], %o0
+	ld	[%l7 + %o3], %o3
+	ld	[%l7 + %o4], %o4
+#endif
 
   /* When starting a binary via the dynamic linker, %g1 contains the
      address of the shared library termination function, which will be
--- libc/sysdeps/sparc/sparc64/elf/start.S.jj	2002-12-09 21:37:20.000000000 +0100
+++ libc/sysdeps/sparc/sparc64/elf/start.S	2004-03-05 00:04:46.274650908 +0100
@@ -1,5 +1,5 @@
 /* Startup code for elf64-sparc
-   Copyright (C) 1997, 1998, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2002, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.
 
@@ -23,10 +23,21 @@
 
 	.section ".text"
 	.align 4
+#ifdef SHARED
+.LLGETPC0:
+	retl
+	 add	%o7, %l7, %l7
+#endif
 	.global _start
 	.type _start,#function
 _start:
 
+#ifdef SHARED
+	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %l7
+	call	.LLGETPC0
+	 add	%l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7
+#endif
+
   /* Terminate the stack frame, and reserve space for functions to
      drop their arguments.  */
 	mov	%g0, %fp
@@ -45,6 +56,11 @@ _start:
         or      %o0, %lo(main), %o0
         or      %o3, %lo(__libc_csu_init), %o3
         or      %o4, %lo(__libc_csu_fini), %o4
+#ifdef SHARED
+	ldx	[%l7 + %o0], %o0
+	ldx	[%l7 + %o3], %o3
+	ldx	[%l7 + %o4], %o4
+#endif
 
   /* When starting a binary via the dynamic linker, %g1 contains the
      address of the shared library termination function, which will be

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix PIEs on SPARC{,64}
  2004-03-04 23:14 [PATCH] Fix PIEs on SPARC{,64} Jakub Jelinek
@ 2004-03-04 23:23 ` Ulrich Drepper
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2004-03-04 23:23 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Glibc hackers, tcallawa

Applied.

-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-03-04 23:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-04 23:14 [PATCH] Fix PIEs on SPARC{,64} Jakub Jelinek
2004-03-04 23:23 ` Ulrich Drepper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).