public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo commit in src/patchsets/glibc/2.9: 6222_all_arm-glibc-2.9-pie.patch
@ 2008-12-27  4:17 Mike Frysinger (vapier)
  0 siblings, 0 replies; only message in thread
From: Mike Frysinger (vapier) @ 2008-12-27  4:17 UTC (permalink / raw
  To: gentoo-commits

vapier      08/12/27 04:17:57

  Added:                6222_all_arm-glibc-2.9-pie.patch
  Log:
  add a possible fix for arm PIE support

Revision  Changes    Path
1.1                  src/patchsets/glibc/2.9/6222_all_arm-glibc-2.9-pie.patch

file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/glibc/2.9/6222_all_arm-glibc-2.9-pie.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/glibc/2.9/6222_all_arm-glibc-2.9-pie.patch?rev=1.1&content-type=text/plain

Index: 6222_all_arm-glibc-2.9-pie.patch
===================================================================
http://sources.redhat.com/bugzilla/show_bug.cgi?id=6999

From c878b71647b35c40e99a78801ccb0185cc89ff99 Mon Sep 17 00:00:00 2001
From: Kirill A. Shutemov <kirill@shutemov.name>
Date: Fri, 31 Oct 2008 02:31:54 +0200
Subject: [PATCH] ARM: add support for PIEs

It's possible to create position independent executable (PIE) on ARM
without a TEXTREL now.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
---
 sysdeps/arm/elf/start.S |   48 ++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 39 insertions(+), 9 deletions(-)

diff --git a/sysdeps/arm/elf/start.S b/sysdeps/arm/elf/start.S
index 2e0a8b1..f63b3db 100644
--- ports/sysdeps/arm/elf/start.S
+++ ports/sysdeps/arm/elf/start.S
@@ -1,5 +1,5 @@
 /* Startup code for ARM & ELF
-   Copyright (C) 1995, 1996, 1997, 1998, 2001, 2002, 2005
+   Copyright (C) 1995, 1996, 1997, 1998, 2001, 2002, 2005, 2008
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -67,11 +67,9 @@ _start:
        /* Protect against unhandled exceptions.  */
        .fnstart
 #endif
-	/* Fetch address of fini */
-	ldr ip, =__libc_csu_fini
-
-	/* Clear the frame pointer since this is the outermost frame.  */
+	/* Clear the frame pointer and link register since this is the outermost frame. */
 	mov fp, #0
+	mov lr, #0
 
 	/* Pop argc off the stack and save a pointer to argv */
 	ldr a2, [sp], #4
@@ -83,21 +81,53 @@ _start:
 	/* Push rtld_fini */
 	str a1, [sp, #-4]!
 
+#ifdef SHARED
+	ldr sl, .L_GOT
+.L_GOT_OFF:
+	add sl, pc, sl
+
+	ldr ip, .L_GOT+4	/* __libc_csu_fini */
+	ldr ip, [sl, ip]
+
+	str ip, [sp, #-4]!	/* Push __libc_csu_fini */
+
+	ldr a4, .L_GOT+8	/* __libc_csu_init */
+	ldr a4, [sl, a4]
+
+	ldr a1, .L_GOT+12	/* main */
+	ldr a1, [sl, a1]
+
+	/* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */
+	/* Let the libc call main and exit with its return code.  */
+	bl __libc_start_main(PLT)
+#else
+	/* Fetch address of __libc_csu_fini */
+	ldr ip, =__libc_csu_fini
+
+	/* Push __libc_csu_fini */
+	str ip, [sp, #-4]!
+
 	/* Set up the other arguments in registers */
 	ldr a1, =main
 	ldr a4, =__libc_csu_init
 
-	/* Push fini */
-	str ip, [sp, #-4]!
-
 	/* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */
-
 	/* Let the libc call main and exit with its return code.  */
 	bl __libc_start_main
+#endif
 
 	/* should never get here....*/
 	bl abort
 
+#ifdef SHARED
+.L_GOT:
+	.word _GLOBAL_OFFSET_TABLE_-(.L_GOT_OFF+8)
+	.word __libc_csu_fini(GOT)
+	.word __libc_csu_init(GOT)
+	.word main(GOT)
+#endif
+
+
 #if !defined(__USING_SJLJ_EXCEPTIONS__)
        .cantunwind
        .fnend
-- 
1.6.0.2.GIT







^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-12-27  4:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-27  4:17 [gentoo-commits] gentoo commit in src/patchsets/glibc/2.9: 6222_all_arm-glibc-2.9-pie.patch Mike Frysinger (vapier)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox