]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - arch/arm/cpu/armv7/start.S
TX6 Release 2013-04-22
[karo-tx-uboot.git] / arch / arm / cpu / armv7 / start.S
index dcc1f831bc814a2b47fd034815091561859b7000..0eebe226905785e8e4c990050e7720d35186d873 100644 (file)
@@ -81,7 +81,7 @@ _end_vect:
 
 .globl _TEXT_BASE
 _TEXT_BASE:
-       .word   CONFIG_SYS_TEXT_BASE
+       .word   _start
 
 /*
  * These are defined in the board-specific linker script.
@@ -173,8 +173,7 @@ ENTRY(relocate_code)
        mov     r6, r2  /* save addr of destination */
 
        adr     r0, _start
-       cmp     r0, r6
-       moveq   r9, #0          /* no relocation. relocation offset(r9) = 0 */
+       subs    r9, r6, r0
        beq     relocate_done           /* skip relocation */
        mov     r1, r6                  /* r1 <- scratch for copy_loop */
        ldr     r3, _image_copy_end_ofs
@@ -189,7 +188,7 @@ copy_loop:
        /*
         * fix .rel.dyn relocations
         */
-       ldr     r0, _TEXT_BASE          /* r0 <- Text base */
+       adr     r0, _start              /* r0 <- beginning of code */
        sub     r9, r6, r0              /* r9 <- relocation offset */
        ldr     r10, _dynsym_start_ofs  /* r10 <- sym table ofs */
        add     r10, r10, r0            /* r10 <- sym table in FLASH */
@@ -197,8 +196,11 @@ copy_loop:
        add     r2, r2, r0              /* r2 <- rel dyn start in FLASH */
        ldr     r3, _rel_dyn_end_ofs    /* r3 <- rel dyn end ofs */
        add     r3, r3, r0              /* r3 <- rel dyn end in FLASH */
+       mov     r4, r0
 fixloop:
        ldr     r0, [r2]                /* r0 <- location to fix up, IN FLASH! */
+       cmp     r0, r4
+       blo     skipfix
        add     r0, r0, r9              /* r0 <- location to fix up in RAM */
        ldr     r1, [r2, #4]
        and     r7, r1, #0xff
@@ -221,6 +223,7 @@ fixrel:
        add     r1, r1, r9
 fixnext:
        str     r1, [r0]
+skipfix:
        add     r2, r2, #8              /* each rel.dyn entry is 8 bytes */
        cmp     r2, r3
        blo     fixloop