]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/glibc/glibc-2.2.5/dl-machine-arm.patch
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / glibc / glibc-2.2.5 / dl-machine-arm.patch
1
2 #
3 # Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
4 #
5
6 --- glibc-2.2.5/sysdeps/arm/dl-machine.h~dl-machine-arm.patch   2004-09-03 19:00:33.000000000 -0500
7 +++ glibc-2.2.5/sysdeps/arm/dl-machine.h        2004-09-03 19:00:37.000000000 -0500
8 @@ -121,14 +121,15 @@
9     and then redirect to the address it returns.  */
10     // macro for handling PIC situation....
11  #ifdef PIC
12 -#define CALL_ROUTINE(x) " ldr sl,0f
13 -       add     sl, pc, sl
14 -1:     ldr     r2, 2f
15 -       mov     lr, pc
16 -       add     pc, sl, r2
17 -       b       3f
18 -0:     .word   _GLOBAL_OFFSET_TABLE_ - 1b - 4
19 -2:     .word " #x "(GOTOFF)
20 +#define CALL_ROUTINE(x) "\
21 +       ldr sl,0f\n\
22 +       add     sl, pc, sl\n\
23 +1:     ldr     r2, 2f\n\
24 +       mov     lr, pc\n\
25 +       add     pc, sl, r2\n\
26 +       b       3f\n\
27 +0:     .word   _GLOBAL_OFFSET_TABLE_ - 1b - 4\n\
28 +2:     .word " #x "(GOTOFF)\n\
29  3:     "
30  #else
31  #define CALL_ROUTINE(x) " bl " #x
32 @@ -136,114 +137,114 @@
33  
34  #ifndef PROF
35  # define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
36 -       .text
37 -       .globl _dl_runtime_resolve
38 -       .type _dl_runtime_resolve, #function
39 -       .align 2
40 -_dl_runtime_resolve:
41 -       @ we get called with
42 -       @       stack[0] contains the return address from this call
43 -       @       ip contains &GOT[n+3] (pointer to function)
44 -       @       lr points to &GOT[2]
45 -
46 -       @ save almost everything; lr is already on the stack
47 -       stmdb   sp!,{r0-r3,sl,fp}
48 -
49 -       @ prepare to call fixup()
50 -       @ change &GOT[n+3] into 8*n        NOTE: reloc are 8 bytes each
51 -       sub     r1, ip, lr
52 -       sub     r1, r1, #4
53 -       add     r1, r1, r1
54 -
55 -       @ get pointer to linker struct
56 -       ldr     r0, [lr, #-4]
57 -
58 -       @ call fixup routine
59 -       " CALL_ROUTINE(fixup) "
60 -
61 -       @ save the return
62 -       mov     ip, r0
63 -
64 -       @ restore the stack
65 -       ldmia   sp!,{r0-r3,sl,fp,lr}
66 -
67 -       @ jump to the newly found address
68 -       mov     pc, ip
69 -
70 -       .size _dl_runtime_resolve, .-_dl_runtime_resolve
71 -
72 -       .globl _dl_runtime_profile
73 -       .type _dl_runtime_profile, #function
74 -       .align 2
75 -_dl_runtime_profile:
76 -       @ save almost everything; lr is already on the stack
77 -       stmdb   sp!,{r0-r3,sl,fp}
78 -
79 -       @ prepare to call fixup()
80 -       @ change &GOT[n+3] into 8*n        NOTE: reloc are 8 bytes each
81 -       sub     r1, ip, lr
82 -       sub     r1, r1, #4
83 -       add     r1, r1, r1
84 -
85 -       @ get pointer to linker struct
86 -       ldr     r0, [lr, #-4]
87 -
88 -       @ call profiling fixup routine
89 -       " CALL_ROUTINE(profile_fixup) "
90 -
91 -       @ save the return
92 -       mov     ip, r0
93 -
94 -       @ restore the stack
95 -       ldmia   sp!,{r0-r3,sl,fp,lr}
96 -
97 -       @ jump to the newly found address
98 -       mov     pc, ip
99 -
100 -       .size _dl_runtime_resolve, .-_dl_runtime_resolve
101 -       .previous
102 +       .text\n\
103 +       .globl _dl_runtime_resolve\n\
104 +       .type _dl_runtime_resolve, #function\n\
105 +       .align 2\n\
106 +_dl_runtime_resolve:\n\
107 +       @ we get called with\n\
108 +       @       stack[0] contains the return address from this call\n\
109 +       @       ip contains &GOT[n+3] (pointer to function)\n\
110 +       @       lr points to &GOT[2]\n\
111 +\n\
112 +       @ save almost everything; lr is already on the stack\n\
113 +       stmdb   sp!,{r0-r3,sl,fp}\n\
114 +\n\
115 +       @ prepare to call fixup()\n\
116 +       @ change &GOT[n+3] into 8*n        NOTE: reloc are 8 bytes each\n\
117 +       sub     r1, ip, lr\n\
118 +       sub     r1, r1, #4\n\
119 +       add     r1, r1, r1\n\
120 +\n\
121 +       @ get pointer to linker struct\n\
122 +       ldr     r0, [lr, #-4]\n\
123 +\n\
124 +       @ call fixup routine\n\
125 +       " CALL_ROUTINE(fixup) "\n\
126 +\n\
127 +       @ save the return\n\
128 +       mov     ip, r0\n\
129 +\n\
130 +       @ restore the stack\n\
131 +       ldmia   sp!,{r0-r3,sl,fp,lr}\n\
132 +\n\
133 +       @ jump to the newly found address\n\
134 +       mov     pc, ip\n\
135 +\n\
136 +       .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
137 +\n\
138 +       .globl _dl_runtime_profile\n\
139 +       .type _dl_runtime_profile, #function\n\
140 +       .align 2\n\
141 +_dl_runtime_profile:\n\
142 +       @ save almost everything; lr is already on the stack\n\
143 +       stmdb   sp!,{r0-r3,sl,fp}\n\
144 +\n\
145 +       @ prepare to call fixup()\n\
146 +       @ change &GOT[n+3] into 8*n        NOTE: reloc are 8 bytes each\n\
147 +       sub     r1, ip, lr\n\
148 +       sub     r1, r1, #4\n\
149 +       add     r1, r1, r1\n\
150 +\n\
151 +       @ get pointer to linker struct\n\
152 +       ldr     r0, [lr, #-4]\n\
153 +\n\
154 +       @ call profiling fixup routine\n\
155 +       " CALL_ROUTINE(profile_fixup) "\n\
156 +\n\
157 +       @ save the return\n\
158 +       mov     ip, r0\n\
159 +\n\
160 +       @ restore the stack\n\
161 +       ldmia   sp!,{r0-r3,sl,fp,lr}\n\
162 +\n\
163 +       @ jump to the newly found address\n\
164 +       mov     pc, ip\n\
165 +\n\
166 +       .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
167 +       .previous\n\
168  ");
169  #else // PROF
170  # define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
171 -       .text
172 -       .globl _dl_runtime_resolve
173 -       .globl _dl_runtime_profile
174 -       .type _dl_runtime_resolve, #function
175 -       .type _dl_runtime_profile, #function
176 -       .align 2
177 -_dl_runtime_resolve:
178 -_dl_runtime_profile:
179 -       @ we get called with
180 -       @       stack[0] contains the return address from this call
181 -       @       ip contains &GOT[n+3] (pointer to function)
182 -       @       lr points to &GOT[2]
183 -
184 -       @ save almost everything; return add is already on the stack
185 -       stmdb   sp!,{r0-r3,sl,fp}
186 -
187 -       @ prepare to call fixup()
188 -       @ change &GOT[n+3] into 8*n        NOTE: reloc are 8 bytes each
189 -       sub     r1, ip, lr
190 -       sub     r1, r1, #4
191 -       add     r1, r1, r1
192 -
193 -       @ get pointer to linker struct
194 -       ldr     r0, [lr, #-4]
195 -
196 -       @ call profiling fixup routine
197 -       " CALL_ROUTINE(fixup) "
198 -
199 -       @ save the return
200 -       mov     ip, r0
201 -
202 -       @ restore the stack
203 -       ldmia   sp!,{r0-r3,sl,fp,lr}
204 -
205 -       @ jump to the newly found address
206 -       mov     pc, ip
207 -
208 -       .size _dl_runtime_profile, .-_dl_runtime_profile
209 -       .previous
210 +       .text\n\
211 +       .globl _dl_runtime_resolve\n\
212 +       .globl _dl_runtime_profile\n\
213 +       .type _dl_runtime_resolve, #function\n\
214 +       .type _dl_runtime_profile, #function\n\
215 +       .align 2\n\
216 +_dl_runtime_resolve:\n\
217 +_dl_runtime_profile:\n\
218 +       @ we get called with\n\
219 +       @       stack[0] contains the return address from this call\n\
220 +       @       ip contains &GOT[n+3] (pointer to function)\n\
221 +       @       lr points to &GOT[2]\n\
222 +\n\
223 +       @ save almost everything; return add is already on the stack\n\
224 +       stmdb   sp!,{r0-r3,sl,fp}\n\
225 +\n\
226 +       @ prepare to call fixup()\n\
227 +       @ change &GOT[n+3] into 8*n        NOTE: reloc are 8 bytes each\n\
228 +       sub     r1, ip, lr\n\
229 +       sub     r1, r1, #4\n\
230 +       add     r1, r1, r1\n\
231 +\n\
232 +       @ get pointer to linker struct\n\
233 +       ldr     r0, [lr, #-4]\n\
234 +\n\
235 +       @ call profiling fixup routine\n\
236 +       " CALL_ROUTINE(fixup) "\n\
237 +\n\
238 +       @ save the return\n\
239 +       mov     ip, r0\n\
240 +\n\
241 +       @ restore the stack\n\
242 +       ldmia   sp!,{r0-r3,sl,fp,lr}\n\
243 +\n\
244 +       @ jump to the newly found address\n\
245 +       mov     pc, ip\n\
246 +\n\
247 +       .size _dl_runtime_profile, .-_dl_runtime_profile\n\
248 +       .previous\n\
249  ");
250  #endif //PROF
251  
252 @@ -256,70 +257,70 @@
253     its return value is the user program's entry point.  */
254  
255  #define RTLD_START asm ("\
256 -.text
257 -.globl _start
258 -.globl _dl_start_user
259 -_start:
260 -       @ at start time, all the args are on the stack
261 -       mov     r0, sp
262 -       bl      _dl_start
263 -       @ returns user entry point in r0
264 -_dl_start_user:
265 -       mov     r6, r0
266 -       @ we are PIC code, so get global offset table
267 -       ldr     sl, .L_GET_GOT
268 -       add     sl, pc, sl
269 -.L_GOT_GOT:
270 -       @ Store the highest stack address
271 -       ldr     r1, .L_STACK_END
272 -       ldr     r1, [sl, r1]
273 -       str     sp, [r1]
274 -       @ See if we were run as a command with the executable file
275 -       @ name as an extra leading argument.
276 -       ldr     r4, .L_SKIP_ARGS
277 -       ldr     r4, [sl, r4]
278 -       @ get the original arg count
279 -       ldr     r1, [sp]
280 -       @ subtract _dl_skip_args from it
281 -       sub     r1, r1, r4
282 -       @ adjust the stack pointer to skip them
283 -       add     sp, sp, r4, lsl #2
284 -       @ get the argv address
285 -       add     r2, sp, #4
286 -       @ store the new argc in the new stack location
287 -       str     r1, [sp]
288 -       @ compute envp
289 -       add     r3, r2, r1, lsl #2
290 -       add     r3, r3, #4
291 -
292 -       @ now we call _dl_init
293 -       ldr     r0, .L_LOADED
294 -       ldr     r0, [sl, r0]
295 -       ldr     r0, [r0]
296 -       @ call _dl_init
297 -       bl      _dl_init(PLT)
298 -       @ clear the startup flag
299 -       ldr     r2, .L_STARTUP_FLAG
300 -       ldr     r1, [sl, r2]
301 -       mov     r0, #0
302 -       str     r0, [r1]
303 -       @ load the finalizer function
304 -       ldr     r0, .L_FINI_PROC
305 -       ldr     r0, [sl, r0]
306 -       @ jump to the user_s entry point
307 -       mov     pc, r6
308 -.L_GET_GOT:
309 +.text\n\
310 +.globl _start\n\
311 +.globl _dl_start_user\n\
312 +_start:\n\
313 +       @ at start time, all the args are on the stack\n\
314 +       mov     r0, sp\n\
315 +       bl      _dl_start\n\
316 +       @ returns user entry point in r0\n\
317 +_dl_start_user:\n\
318 +       mov     r6, r0\n\
319 +       @ we are PIC code, so get global offset table\n\
320 +       ldr     sl, .L_GET_GOT\n\
321 +       add     sl, pc, sl\n\
322 +.L_GOT_GOT:\n\
323 +       @ Store the highest stack address\n\
324 +       ldr     r1, .L_STACK_END\n\
325 +       ldr     r1, [sl, r1]\n\
326 +       str     sp, [r1]\n\
327 +       @ See if we were run as a command with the executable file\n\
328 +       @ name as an extra leading argument.\n\
329 +       ldr     r4, .L_SKIP_ARGS\n\
330 +       ldr     r4, [sl, r4]\n\
331 +       @ get the original arg count\n\
332 +       ldr     r1, [sp]\n\
333 +       @ subtract _dl_skip_args from it\n\
334 +       sub     r1, r1, r4\n\
335 +       @ adjust the stack pointer to skip them\n\
336 +       add     sp, sp, r4, lsl #2\n\
337 +       @ get the argv address\n\
338 +       add     r2, sp, #4\n\
339 +       @ store the new argc in the new stack location\n\
340 +       str     r1, [sp]\n\
341 +       @ compute envp\n\
342 +       add     r3, r2, r1, lsl #2\n\
343 +       add     r3, r3, #4\n\
344 +\n\
345 +       @ now we call _dl_init\n\
346 +       ldr     r0, .L_LOADED\n\
347 +       ldr     r0, [sl, r0]\n\
348 +       ldr     r0, [r0]\n\
349 +       @ call _dl_init\n\
350 +       bl      _dl_init(PLT)\n\
351 +       @ clear the startup flag\n\
352 +       ldr     r2, .L_STARTUP_FLAG\n\
353 +       ldr     r1, [sl, r2]\n\
354 +       mov     r0, #0\n\
355 +       str     r0, [r1]\n\
356 +       @ load the finalizer function\n\
357 +       ldr     r0, .L_FINI_PROC\n\
358 +       ldr     r0, [sl, r0]\n\
359 +       @ jump to the user_s entry point\n\
360 +       mov     pc, r6\n\
361 +.L_GET_GOT:\n\
362         .word   _GLOBAL_OFFSET_TABLE_ - .L_GOT_GOT - 4  \n\
363  .L_SKIP_ARGS:                                  \n\
364         .word   _dl_skip_args(GOTOFF)           \n\
365 -.L_STARTUP_FLAG:
366 -       .word   _dl_starting_up(GOT)
367 -.L_FINI_PROC:
368 -       .word   _dl_fini(GOT)
369 -.L_STACK_END:
370 -       .word   __libc_stack_end(GOT)
371 -.L_LOADED:
372 -       .word   _dl_loaded(GOT)
373 +.L_STARTUP_FLAG:\n\
374 +       .word   _dl_starting_up(GOT)\n\
375 +.L_FINI_PROC:\n\
376 +       .word   _dl_fini(GOT)\n\
377 +.L_STACK_END:\n\
378 +       .word   __libc_stack_end(GOT)\n\
379 +.L_LOADED:\n\
380 +       .word   _dl_loaded(GOT)\n\
381  .previous\n\
382  ");
383