1 |
vapier 08/12/27 04:17:57 |
2 |
|
3 |
Added: 6222_all_arm-glibc-2.9-pie.patch |
4 |
Log: |
5 |
add a possible fix for arm PIE support |
6 |
|
7 |
Revision Changes Path |
8 |
1.1 src/patchsets/glibc/2.9/6222_all_arm-glibc-2.9-pie.patch |
9 |
|
10 |
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 |
11 |
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 |
12 |
|
13 |
Index: 6222_all_arm-glibc-2.9-pie.patch |
14 |
=================================================================== |
15 |
http://sources.redhat.com/bugzilla/show_bug.cgi?id=6999 |
16 |
|
17 |
From c878b71647b35c40e99a78801ccb0185cc89ff99 Mon Sep 17 00:00:00 2001 |
18 |
From: Kirill A. Shutemov <kirill@××××××××.name> |
19 |
Date: Fri, 31 Oct 2008 02:31:54 +0200 |
20 |
Subject: [PATCH] ARM: add support for PIEs |
21 |
|
22 |
It's possible to create position independent executable (PIE) on ARM |
23 |
without a TEXTREL now. |
24 |
|
25 |
Signed-off-by: Kirill A. Shutemov <kirill@××××××××.name> |
26 |
--- |
27 |
sysdeps/arm/elf/start.S | 48 ++++++++++++++++++++++++++++++++++++++-------- |
28 |
1 files changed, 39 insertions(+), 9 deletions(-) |
29 |
|
30 |
diff --git a/sysdeps/arm/elf/start.S b/sysdeps/arm/elf/start.S |
31 |
index 2e0a8b1..f63b3db 100644 |
32 |
--- ports/sysdeps/arm/elf/start.S |
33 |
+++ ports/sysdeps/arm/elf/start.S |
34 |
@@ -1,5 +1,5 @@ |
35 |
/* Startup code for ARM & ELF |
36 |
- Copyright (C) 1995, 1996, 1997, 1998, 2001, 2002, 2005 |
37 |
+ Copyright (C) 1995, 1996, 1997, 1998, 2001, 2002, 2005, 2008 |
38 |
Free Software Foundation, Inc. |
39 |
This file is part of the GNU C Library. |
40 |
|
41 |
@@ -67,11 +67,9 @@ _start: |
42 |
/* Protect against unhandled exceptions. */ |
43 |
.fnstart |
44 |
#endif |
45 |
- /* Fetch address of fini */ |
46 |
- ldr ip, =__libc_csu_fini |
47 |
- |
48 |
- /* Clear the frame pointer since this is the outermost frame. */ |
49 |
+ /* Clear the frame pointer and link register since this is the outermost frame. */ |
50 |
mov fp, #0 |
51 |
+ mov lr, #0 |
52 |
|
53 |
/* Pop argc off the stack and save a pointer to argv */ |
54 |
ldr a2, [sp], #4 |
55 |
@@ -83,21 +81,53 @@ _start: |
56 |
/* Push rtld_fini */ |
57 |
str a1, [sp, #-4]! |
58 |
|
59 |
+#ifdef SHARED |
60 |
+ ldr sl, .L_GOT |
61 |
+.L_GOT_OFF: |
62 |
+ add sl, pc, sl |
63 |
+ |
64 |
+ ldr ip, .L_GOT+4 /* __libc_csu_fini */ |
65 |
+ ldr ip, [sl, ip] |
66 |
+ |
67 |
+ str ip, [sp, #-4]! /* Push __libc_csu_fini */ |
68 |
+ |
69 |
+ ldr a4, .L_GOT+8 /* __libc_csu_init */ |
70 |
+ ldr a4, [sl, a4] |
71 |
+ |
72 |
+ ldr a1, .L_GOT+12 /* main */ |
73 |
+ ldr a1, [sl, a1] |
74 |
+ |
75 |
+ /* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */ |
76 |
+ /* Let the libc call main and exit with its return code. */ |
77 |
+ bl __libc_start_main(PLT) |
78 |
+#else |
79 |
+ /* Fetch address of __libc_csu_fini */ |
80 |
+ ldr ip, =__libc_csu_fini |
81 |
+ |
82 |
+ /* Push __libc_csu_fini */ |
83 |
+ str ip, [sp, #-4]! |
84 |
+ |
85 |
/* Set up the other arguments in registers */ |
86 |
ldr a1, =main |
87 |
ldr a4, =__libc_csu_init |
88 |
|
89 |
- /* Push fini */ |
90 |
- str ip, [sp, #-4]! |
91 |
- |
92 |
/* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */ |
93 |
- |
94 |
/* Let the libc call main and exit with its return code. */ |
95 |
bl __libc_start_main |
96 |
+#endif |
97 |
|
98 |
/* should never get here....*/ |
99 |
bl abort |
100 |
|
101 |
+#ifdef SHARED |
102 |
+.L_GOT: |
103 |
+ .word _GLOBAL_OFFSET_TABLE_-(.L_GOT_OFF+8) |
104 |
+ .word __libc_csu_fini(GOT) |
105 |
+ .word __libc_csu_init(GOT) |
106 |
+ .word main(GOT) |
107 |
+#endif |
108 |
+ |
109 |
+ |
110 |
#if !defined(__USING_SJLJ_EXCEPTIONS__) |
111 |
.cantunwind |
112 |
.fnend |
113 |
-- |
114 |
1.6.0.2.GIT |