1.1 --- a/patches/glibc/2.2.5/dl-machine-arm.patch Tue Aug 14 19:32:22 2007 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,389 +0,0 @@
1.4 -Fixes error:
1.5 -In file included from dynamic-link.h:21,
1.6 - from dl-load.c:32:
1.7 -../sysdeps/arm/dl-machine.h:124:25: missing terminating " character
1.8 -...
1.9 -make[2]: *** [/crosstool-0.22/build/arm-unknown-linux-gnu/gcc-3.3-glibc-2.2.5/build-glibc/elf/dl-load.o] Error 1
1.10 -
1.11 -The first two hunks of
1.12 -http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/arm/dl-machine.h.diff?r1=1.39&r2=1.40&cvsroot=glibc
1.13 -applied cleanly, but the third hunk didn't, so I just added the \n\'s by hand for that section.
1.14 -
1.15 ---- glibc-2.2.5/sysdeps/arm/dl-machine.h.orig Sat Sep 8 14:31:40 2001
1.16 -+++ glibc-2.2.5/sysdeps/arm/dl-machine.h Wed Aug 27 10:55:26 2003
1.17 -@@ -121,14 +121,15 @@
1.18 - and then redirect to the address it returns. */
1.19 - // macro for handling PIC situation....
1.20 - #ifdef PIC
1.21 --#define CALL_ROUTINE(x) " ldr sl,0f
1.22 -- add sl, pc, sl
1.23 --1: ldr r2, 2f
1.24 -- mov lr, pc
1.25 -- add pc, sl, r2
1.26 -- b 3f
1.27 --0: .word _GLOBAL_OFFSET_TABLE_ - 1b - 4
1.28 --2: .word " #x "(GOTOFF)
1.29 -+#define CALL_ROUTINE(x) "\
1.30 -+ ldr sl,0f\n\
1.31 -+ add sl, pc, sl\n\
1.32 -+1: ldr r2, 2f\n\
1.33 -+ mov lr, pc\n\
1.34 -+ add pc, sl, r2\n\
1.35 -+ b 3f\n\
1.36 -+0: .word _GLOBAL_OFFSET_TABLE_ - 1b - 4\n\
1.37 -+2: .word " #x "(GOTOFF)\n\
1.38 - 3: "
1.39 - #else
1.40 - #define CALL_ROUTINE(x) " bl " #x
1.41 -@@ -136,114 +137,114 @@
1.42 -
1.43 - #ifndef PROF
1.44 - # define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
1.45 -- .text
1.46 -- .globl _dl_runtime_resolve
1.47 -- .type _dl_runtime_resolve, #function
1.48 -- .align 2
1.49 --_dl_runtime_resolve:
1.50 -- @ we get called with
1.51 -- @ stack[0] contains the return address from this call
1.52 -- @ ip contains &GOT[n+3] (pointer to function)
1.53 -- @ lr points to &GOT[2]
1.54 --
1.55 -- @ save almost everything; lr is already on the stack
1.56 -- stmdb sp!,{r0-r3,sl,fp}
1.57 --
1.58 -- @ prepare to call fixup()
1.59 -- @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each
1.60 -- sub r1, ip, lr
1.61 -- sub r1, r1, #4
1.62 -- add r1, r1, r1
1.63 --
1.64 -- @ get pointer to linker struct
1.65 -- ldr r0, [lr, #-4]
1.66 --
1.67 -- @ call fixup routine
1.68 -- " CALL_ROUTINE(fixup) "
1.69 --
1.70 -- @ save the return
1.71 -- mov ip, r0
1.72 --
1.73 -- @ restore the stack
1.74 -- ldmia sp!,{r0-r3,sl,fp,lr}
1.75 --
1.76 -- @ jump to the newly found address
1.77 -- mov pc, ip
1.78 --
1.79 -- .size _dl_runtime_resolve, .-_dl_runtime_resolve
1.80 --
1.81 -- .globl _dl_runtime_profile
1.82 -- .type _dl_runtime_profile, #function
1.83 -- .align 2
1.84 --_dl_runtime_profile:
1.85 -- @ save almost everything; lr is already on the stack
1.86 -- stmdb sp!,{r0-r3,sl,fp}
1.87 --
1.88 -- @ prepare to call fixup()
1.89 -- @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each
1.90 -- sub r1, ip, lr
1.91 -- sub r1, r1, #4
1.92 -- add r1, r1, r1
1.93 --
1.94 -- @ get pointer to linker struct
1.95 -- ldr r0, [lr, #-4]
1.96 --
1.97 -- @ call profiling fixup routine
1.98 -- " CALL_ROUTINE(profile_fixup) "
1.99 --
1.100 -- @ save the return
1.101 -- mov ip, r0
1.102 --
1.103 -- @ restore the stack
1.104 -- ldmia sp!,{r0-r3,sl,fp,lr}
1.105 --
1.106 -- @ jump to the newly found address
1.107 -- mov pc, ip
1.108 --
1.109 -- .size _dl_runtime_resolve, .-_dl_runtime_resolve
1.110 -- .previous
1.111 -+ .text\n\
1.112 -+ .globl _dl_runtime_resolve\n\
1.113 -+ .type _dl_runtime_resolve, #function\n\
1.114 -+ .align 2\n\
1.115 -+_dl_runtime_resolve:\n\
1.116 -+ @ we get called with\n\
1.117 -+ @ stack[0] contains the return address from this call\n\
1.118 -+ @ ip contains &GOT[n+3] (pointer to function)\n\
1.119 -+ @ lr points to &GOT[2]\n\
1.120 -+\n\
1.121 -+ @ save almost everything; lr is already on the stack\n\
1.122 -+ stmdb sp!,{r0-r3,sl,fp}\n\
1.123 -+\n\
1.124 -+ @ prepare to call fixup()\n\
1.125 -+ @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each\n\
1.126 -+ sub r1, ip, lr\n\
1.127 -+ sub r1, r1, #4\n\
1.128 -+ add r1, r1, r1\n\
1.129 -+\n\
1.130 -+ @ get pointer to linker struct\n\
1.131 -+ ldr r0, [lr, #-4]\n\
1.132 -+\n\
1.133 -+ @ call fixup routine\n\
1.134 -+ " CALL_ROUTINE(fixup) "\n\
1.135 -+\n\
1.136 -+ @ save the return\n\
1.137 -+ mov ip, r0\n\
1.138 -+\n\
1.139 -+ @ restore the stack\n\
1.140 -+ ldmia sp!,{r0-r3,sl,fp,lr}\n\
1.141 -+\n\
1.142 -+ @ jump to the newly found address\n\
1.143 -+ mov pc, ip\n\
1.144 -+\n\
1.145 -+ .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
1.146 -+\n\
1.147 -+ .globl _dl_runtime_profile\n\
1.148 -+ .type _dl_runtime_profile, #function\n\
1.149 -+ .align 2\n\
1.150 -+_dl_runtime_profile:\n\
1.151 -+ @ save almost everything; lr is already on the stack\n\
1.152 -+ stmdb sp!,{r0-r3,sl,fp}\n\
1.153 -+\n\
1.154 -+ @ prepare to call fixup()\n\
1.155 -+ @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each\n\
1.156 -+ sub r1, ip, lr\n\
1.157 -+ sub r1, r1, #4\n\
1.158 -+ add r1, r1, r1\n\
1.159 -+\n\
1.160 -+ @ get pointer to linker struct\n\
1.161 -+ ldr r0, [lr, #-4]\n\
1.162 -+\n\
1.163 -+ @ call profiling fixup routine\n\
1.164 -+ " CALL_ROUTINE(profile_fixup) "\n\
1.165 -+\n\
1.166 -+ @ save the return\n\
1.167 -+ mov ip, r0\n\
1.168 -+\n\
1.169 -+ @ restore the stack\n\
1.170 -+ ldmia sp!,{r0-r3,sl,fp,lr}\n\
1.171 -+\n\
1.172 -+ @ jump to the newly found address\n\
1.173 -+ mov pc, ip\n\
1.174 -+\n\
1.175 -+ .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
1.176 -+ .previous\n\
1.177 - ");
1.178 - #else // PROF
1.179 - # define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
1.180 -- .text
1.181 -- .globl _dl_runtime_resolve
1.182 -- .globl _dl_runtime_profile
1.183 -- .type _dl_runtime_resolve, #function
1.184 -- .type _dl_runtime_profile, #function
1.185 -- .align 2
1.186 --_dl_runtime_resolve:
1.187 --_dl_runtime_profile:
1.188 -- @ we get called with
1.189 -- @ stack[0] contains the return address from this call
1.190 -- @ ip contains &GOT[n+3] (pointer to function)
1.191 -- @ lr points to &GOT[2]
1.192 --
1.193 -- @ save almost everything; return add is already on the stack
1.194 -- stmdb sp!,{r0-r3,sl,fp}
1.195 --
1.196 -- @ prepare to call fixup()
1.197 -- @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each
1.198 -- sub r1, ip, lr
1.199 -- sub r1, r1, #4
1.200 -- add r1, r1, r1
1.201 --
1.202 -- @ get pointer to linker struct
1.203 -- ldr r0, [lr, #-4]
1.204 --
1.205 -- @ call profiling fixup routine
1.206 -- " CALL_ROUTINE(fixup) "
1.207 --
1.208 -- @ save the return
1.209 -- mov ip, r0
1.210 --
1.211 -- @ restore the stack
1.212 -- ldmia sp!,{r0-r3,sl,fp,lr}
1.213 --
1.214 -- @ jump to the newly found address
1.215 -- mov pc, ip
1.216 --
1.217 -- .size _dl_runtime_profile, .-_dl_runtime_profile
1.218 -- .previous
1.219 -+ .text\n\
1.220 -+ .globl _dl_runtime_resolve\n\
1.221 -+ .globl _dl_runtime_profile\n\
1.222 -+ .type _dl_runtime_resolve, #function\n\
1.223 -+ .type _dl_runtime_profile, #function\n\
1.224 -+ .align 2\n\
1.225 -+_dl_runtime_resolve:\n\
1.226 -+_dl_runtime_profile:\n\
1.227 -+ @ we get called with\n\
1.228 -+ @ stack[0] contains the return address from this call\n\
1.229 -+ @ ip contains &GOT[n+3] (pointer to function)\n\
1.230 -+ @ lr points to &GOT[2]\n\
1.231 -+\n\
1.232 -+ @ save almost everything; return add is already on the stack\n\
1.233 -+ stmdb sp!,{r0-r3,sl,fp}\n\
1.234 -+\n\
1.235 -+ @ prepare to call fixup()\n\
1.236 -+ @ change &GOT[n+3] into 8*n NOTE: reloc are 8 bytes each\n\
1.237 -+ sub r1, ip, lr\n\
1.238 -+ sub r1, r1, #4\n\
1.239 -+ add r1, r1, r1\n\
1.240 -+\n\
1.241 -+ @ get pointer to linker struct\n\
1.242 -+ ldr r0, [lr, #-4]\n\
1.243 -+\n\
1.244 -+ @ call profiling fixup routine\n\
1.245 -+ " CALL_ROUTINE(fixup) "\n\
1.246 -+\n\
1.247 -+ @ save the return\n\
1.248 -+ mov ip, r0\n\
1.249 -+\n\
1.250 -+ @ restore the stack\n\
1.251 -+ ldmia sp!,{r0-r3,sl,fp,lr}\n\
1.252 -+\n\
1.253 -+ @ jump to the newly found address\n\
1.254 -+ mov pc, ip\n\
1.255 -+\n\
1.256 -+ .size _dl_runtime_profile, .-_dl_runtime_profile\n\
1.257 -+ .previous\n\
1.258 - ");
1.259 - #endif //PROF
1.260 -
1.261 -@@ -256,70 +257,70 @@
1.262 - its return value is the user program's entry point. */
1.263 -
1.264 - #define RTLD_START asm ("\
1.265 --.text
1.266 --.globl _start
1.267 --.globl _dl_start_user
1.268 --_start:
1.269 -- @ at start time, all the args are on the stack
1.270 -- mov r0, sp
1.271 -- bl _dl_start
1.272 -- @ returns user entry point in r0
1.273 --_dl_start_user:
1.274 -- mov r6, r0
1.275 -- @ we are PIC code, so get global offset table
1.276 -- ldr sl, .L_GET_GOT
1.277 -- add sl, pc, sl
1.278 --.L_GOT_GOT:
1.279 -- @ Store the highest stack address
1.280 -- ldr r1, .L_STACK_END
1.281 -- ldr r1, [sl, r1]
1.282 -- str sp, [r1]
1.283 -- @ See if we were run as a command with the executable file
1.284 -- @ name as an extra leading argument.
1.285 -- ldr r4, .L_SKIP_ARGS
1.286 -- ldr r4, [sl, r4]
1.287 -- @ get the original arg count
1.288 -- ldr r1, [sp]
1.289 -- @ subtract _dl_skip_args from it
1.290 -- sub r1, r1, r4
1.291 -- @ adjust the stack pointer to skip them
1.292 -- add sp, sp, r4, lsl #2
1.293 -- @ get the argv address
1.294 -- add r2, sp, #4
1.295 -- @ store the new argc in the new stack location
1.296 -- str r1, [sp]
1.297 -- @ compute envp
1.298 -- add r3, r2, r1, lsl #2
1.299 -- add r3, r3, #4
1.300 --
1.301 -- @ now we call _dl_init
1.302 -- ldr r0, .L_LOADED
1.303 -- ldr r0, [sl, r0]
1.304 -- ldr r0, [r0]
1.305 -- @ call _dl_init
1.306 -- bl _dl_init(PLT)
1.307 -- @ clear the startup flag
1.308 -- ldr r2, .L_STARTUP_FLAG
1.309 -- ldr r1, [sl, r2]
1.310 -- mov r0, #0
1.311 -- str r0, [r1]
1.312 -- @ load the finalizer function
1.313 -- ldr r0, .L_FINI_PROC
1.314 -- ldr r0, [sl, r0]
1.315 -- @ jump to the user_s entry point
1.316 -- mov pc, r6
1.317 --.L_GET_GOT:
1.318 -+.text\n\
1.319 -+.globl _start\n\
1.320 -+.globl _dl_start_user\n\
1.321 -+_start:\n\
1.322 -+ @ at start time, all the args are on the stack\n\
1.323 -+ mov r0, sp\n\
1.324 -+ bl _dl_start\n\
1.325 -+ @ returns user entry point in r0\n\
1.326 -+_dl_start_user:\n\
1.327 -+ mov r6, r0\n\
1.328 -+ @ we are PIC code, so get global offset table\n\
1.329 -+ ldr sl, .L_GET_GOT\n\
1.330 -+ add sl, pc, sl\n\
1.331 -+.L_GOT_GOT:\n\
1.332 -+ @ Store the highest stack address\n\
1.333 -+ ldr r1, .L_STACK_END\n\
1.334 -+ ldr r1, [sl, r1]\n\
1.335 -+ str sp, [r1]\n\
1.336 -+ @ See if we were run as a command with the executable file\n\
1.337 -+ @ name as an extra leading argument.\n\
1.338 -+ ldr r4, .L_SKIP_ARGS\n\
1.339 -+ ldr r4, [sl, r4]\n\
1.340 -+ @ get the original arg count\n\
1.341 -+ ldr r1, [sp]\n\
1.342 -+ @ subtract _dl_skip_args from it\n\
1.343 -+ sub r1, r1, r4\n\
1.344 -+ @ adjust the stack pointer to skip them\n\
1.345 -+ add sp, sp, r4, lsl #2\n\
1.346 -+ @ get the argv address\n\
1.347 -+ add r2, sp, #4\n\
1.348 -+ @ store the new argc in the new stack location\n\
1.349 -+ str r1, [sp]\n\
1.350 -+ @ compute envp\n\
1.351 -+ add r3, r2, r1, lsl #2\n\
1.352 -+ add r3, r3, #4\n\
1.353 -+\n\
1.354 -+ @ now we call _dl_init\n\
1.355 -+ ldr r0, .L_LOADED\n\
1.356 -+ ldr r0, [sl, r0]\n\
1.357 -+ ldr r0, [r0]\n\
1.358 -+ @ call _dl_init\n\
1.359 -+ bl _dl_init(PLT)\n\
1.360 -+ @ clear the startup flag\n\
1.361 -+ ldr r2, .L_STARTUP_FLAG\n\
1.362 -+ ldr r1, [sl, r2]\n\
1.363 -+ mov r0, #0\n\
1.364 -+ str r0, [r1]\n\
1.365 -+ @ load the finalizer function\n\
1.366 -+ ldr r0, .L_FINI_PROC\n\
1.367 -+ ldr r0, [sl, r0]\n\
1.368 -+ @ jump to the user_s entry point\n\
1.369 -+ mov pc, r6\n\
1.370 -+.L_GET_GOT:\n\
1.371 - .word _GLOBAL_OFFSET_TABLE_ - .L_GOT_GOT - 4 \n\
1.372 - .L_SKIP_ARGS: \n\
1.373 - .word _dl_skip_args(GOTOFF) \n\
1.374 --.L_STARTUP_FLAG:
1.375 -- .word _dl_starting_up(GOT)
1.376 --.L_FINI_PROC:
1.377 -- .word _dl_fini(GOT)
1.378 --.L_STACK_END:
1.379 -- .word __libc_stack_end(GOT)
1.380 --.L_LOADED:
1.381 -- .word _dl_loaded(GOT)
1.382 -+.L_STARTUP_FLAG:\n\
1.383 -+ .word _dl_starting_up(GOT)\n\
1.384 -+.L_FINI_PROC:\n\
1.385 -+ .word _dl_fini(GOT)\n\
1.386 -+.L_STACK_END:\n\
1.387 -+ .word __libc_stack_end(GOT)\n\
1.388 -+.L_LOADED:\n\
1.389 -+ .word _dl_loaded(GOT)\n\
1.390 - .previous\n\
1.391 - ");
1.392 -