3 # Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
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
9 and then redirect to the address it returns. */
10 // macro for handling PIC situation....
12 -#define CALL_ROUTINE(x) " ldr sl,0f
18 -0: .word _GLOBAL_OFFSET_TABLE_ - 1b - 4
19 -2: .word " #x "(GOTOFF)
20 +#define CALL_ROUTINE(x) "\
27 +0: .word _GLOBAL_OFFSET_TABLE_ - 1b - 4\n\
28 +2: .word " #x "(GOTOFF)\n\
31 #define CALL_ROUTINE(x) " bl " #x
32 @@ -136,114 +137,114 @@
35 # define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
37 - .globl _dl_runtime_resolve
38 - .type _dl_runtime_resolve, #function
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]
46 - @ save almost everything; lr is already on the stack
47 - stmdb sp!,{r0-r3,sl,fp}
49 - @ prepare to call fixup()
50 - @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each
55 - @ get pointer to linker struct
58 - @ call fixup routine
59 - " CALL_ROUTINE(fixup) "
65 - ldmia sp!,{r0-r3,sl,fp,lr}
67 - @ jump to the newly found address
70 - .size _dl_runtime_resolve, .-_dl_runtime_resolve
72 - .globl _dl_runtime_profile
73 - .type _dl_runtime_profile, #function
76 - @ save almost everything; lr is already on the stack
77 - stmdb sp!,{r0-r3,sl,fp}
79 - @ prepare to call fixup()
80 - @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each
85 - @ get pointer to linker struct
88 - @ call profiling fixup routine
89 - " CALL_ROUTINE(profile_fixup) "
95 - ldmia sp!,{r0-r3,sl,fp,lr}
97 - @ jump to the newly found address
100 - .size _dl_runtime_resolve, .-_dl_runtime_resolve
103 + .globl _dl_runtime_resolve\n\
104 + .type _dl_runtime_resolve, #function\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\
112 + @ save almost everything; lr is already on the stack\n\
113 + stmdb sp!,{r0-r3,sl,fp}\n\
115 + @ prepare to call fixup()\n\
116 + @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each\n\
121 + @ get pointer to linker struct\n\
122 + ldr r0, [lr, #-4]\n\
124 + @ call fixup routine\n\
125 + " CALL_ROUTINE(fixup) "\n\
127 + @ save the return\n\
130 + @ restore the stack\n\
131 + ldmia sp!,{r0-r3,sl,fp,lr}\n\
133 + @ jump to the newly found address\n\
136 + .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
138 + .globl _dl_runtime_profile\n\
139 + .type _dl_runtime_profile, #function\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\
145 + @ prepare to call fixup()\n\
146 + @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each\n\
151 + @ get pointer to linker struct\n\
152 + ldr r0, [lr, #-4]\n\
154 + @ call profiling fixup routine\n\
155 + " CALL_ROUTINE(profile_fixup) "\n\
157 + @ save the return\n\
160 + @ restore the stack\n\
161 + ldmia sp!,{r0-r3,sl,fp,lr}\n\
163 + @ jump to the newly found address\n\
166 + .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
170 # define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
172 - .globl _dl_runtime_resolve
173 - .globl _dl_runtime_profile
174 - .type _dl_runtime_resolve, #function
175 - .type _dl_runtime_profile, #function
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]
184 - @ save almost everything; return add is already on the stack
185 - stmdb sp!,{r0-r3,sl,fp}
187 - @ prepare to call fixup()
188 - @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each
193 - @ get pointer to linker struct
196 - @ call profiling fixup routine
197 - " CALL_ROUTINE(fixup) "
202 - @ restore the stack
203 - ldmia sp!,{r0-r3,sl,fp,lr}
205 - @ jump to the newly found address
208 - .size _dl_runtime_profile, .-_dl_runtime_profile
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\
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\
223 + @ save almost everything; return add is already on the stack\n\
224 + stmdb sp!,{r0-r3,sl,fp}\n\
226 + @ prepare to call fixup()\n\
227 + @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each\n\
232 + @ get pointer to linker struct\n\
233 + ldr r0, [lr, #-4]\n\
235 + @ call profiling fixup routine\n\
236 + " CALL_ROUTINE(fixup) "\n\
238 + @ save the return\n\
241 + @ restore the stack\n\
242 + ldmia sp!,{r0-r3,sl,fp,lr}\n\
244 + @ jump to the newly found address\n\
247 + .size _dl_runtime_profile, .-_dl_runtime_profile\n\
252 @@ -256,70 +257,70 @@
253 its return value is the user program's entry point. */
255 #define RTLD_START asm ("\
258 -.globl _dl_start_user
260 - @ at start time, all the args are on the stack
263 - @ returns user entry point in r0
266 - @ we are PIC code, so get global offset table
270 - @ Store the highest stack address
271 - ldr r1, .L_STACK_END
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
278 - @ get the original arg count
280 - @ subtract _dl_skip_args from it
282 - @ adjust the stack pointer to skip them
283 - add sp, sp, r4, lsl #2
284 - @ get the argv address
286 - @ store the new argc in the new stack location
289 - add r3, r2, r1, lsl #2
292 - @ now we call _dl_init
298 - @ clear the startup flag
299 - ldr r2, .L_STARTUP_FLAG
303 - @ load the finalizer function
304 - ldr r0, .L_FINI_PROC
306 - @ jump to the user_s entry point
311 +.globl _dl_start_user\n\
313 + @ at start time, all the args are on the stack\n\
316 + @ returns user entry point in r0\n\
319 + @ we are PIC code, so get global offset table\n\
320 + ldr sl, .L_GET_GOT\n\
323 + @ Store the highest stack address\n\
324 + ldr r1, .L_STACK_END\n\
325 + ldr r1, [sl, 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\
333 + @ subtract _dl_skip_args from it\n\
335 + @ adjust the stack pointer to skip them\n\
336 + add sp, sp, r4, lsl #2\n\
337 + @ get the argv address\n\
339 + @ store the new argc in the new stack location\n\
342 + add r3, r2, r1, lsl #2\n\
345 + @ now we call _dl_init\n\
346 + ldr r0, .L_LOADED\n\
347 + ldr r0, [sl, r0]\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\
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\
362 .word _GLOBAL_OFFSET_TABLE_ - .L_GOT_GOT - 4 \n\
364 .word _dl_skip_args(GOTOFF) \n\
366 - .word _dl_starting_up(GOT)
368 - .word _dl_fini(GOT)
370 - .word __libc_stack_end(GOT)
372 - .word _dl_loaded(GOT)
374 + .word _dl_starting_up(GOT)\n\
376 + .word _dl_fini(GOT)\n\
378 + .word __libc_stack_end(GOT)\n\
380 + .word _dl_loaded(GOT)\n\