]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
arm: make __image_copy_{start, end} compiler-generated
authorAlbert ARIBAUD <albert.u.boot@aribaud.net>
Tue, 11 Jun 2013 12:17:33 +0000 (14:17 +0200)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Fri, 21 Jun 2013 21:05:05 +0000 (23:05 +0200)
This change is only done where needed: some linker
scripts may contain __image_copy_{start,end} yet
remain unchanged.

Also, __image_copy_end needs its own section; putting
it in relocation sections changes their flags and makes
relocation break.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
Tested-by: Lubomir Popov <lpopov@mm-sol.com>
Tested-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Reviewed-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
arch/arm/cpu/arm920t/ep93xx/u-boot.lds
arch/arm/cpu/ixp/u-boot.lds
arch/arm/cpu/u-boot.lds
arch/arm/lib/relocate.S
arch/arm/lib/sections.c
board/actux1/u-boot.lds
board/actux2/u-boot.lds
board/actux3/u-boot.lds
board/dvlhost/u-boot.lds
board/freescale/mx31ads/u-boot.lds

index cf55bf7d4d34675ebdb8cdc91722a718da7f1b95..367c805e385a138585fa6bec21f45ac8b7c8b642 100644 (file)
@@ -31,6 +31,7 @@ SECTIONS
        . = ALIGN(4);
        .text      :
        {
+               *(.__image_copy_start)
          arch/arm/cpu/arm920t/start.o  (.text*)
                /* the EP93xx expects to find the pattern 'CRUS' at 0x1000 */
          . = 0x1000;
@@ -56,7 +57,10 @@ SECTIONS
 
        . = ALIGN(4);
 
-       __image_copy_end = .;
+       .image_copy_end :
+       {
+               *(.__image_copy_end)
+       }
 
        __bss_start = .;
        .bss : { *(.bss*) }
index 5cfff68e0501152b47eac219b9296eb5f5952425..9141199bedb4edac358c906627c95ac256c388d6 100644 (file)
@@ -31,6 +31,7 @@ SECTIONS
        . = ALIGN(4);
        .text :
        {
+               *(.__image_copy_start)
                arch/arm/cpu/ixp/start.o(.text*)
                *(.text*)
        }
@@ -54,7 +55,10 @@ SECTIONS
 
        . = ALIGN(4);
 
-       __image_copy_end = .;
+       .image_copy_end :
+       {
+               *(.__image_copy_end)
+       }
 
        .rel.dyn : {
                __rel_dyn_start = .;
index fe2ca981769ac27f6ec3434bd5badfddd4d1416c..d7adf90dafd9484125e5be2e36367bcda509cb05 100644 (file)
@@ -33,7 +33,7 @@ SECTIONS
        . = ALIGN(4);
        .text :
        {
-               __image_copy_start = .;
+               *(.__image_copy_start)
                CPUDIR/start.o (.text*)
                *(.text*)
        }
@@ -57,7 +57,10 @@ SECTIONS
 
        . = ALIGN(4);
 
-       __image_copy_end = .;
+       .image_copy_end :
+       {
+               *(.__image_copy_end)
+       }
 
        .rel.dyn : {
                __rel_dyn_start = .;
index 7a7c4c085e272fb6c7965aaf8b2638239967d22e..3767a9550c73bdeae8decab3021235a081339d3c 100644 (file)
 ENTRY(relocate_code)
        mov     r6, r0  /* save addr of destination */
 
-       ldr     r0, =_start             /* r0 <- SRC &_start */
+       ldr     r0, =__image_copy_start /* r0 <- SRC &__image_copy_start */
        subs    r9, r6, r0              /* r9 <- relocation offset */
        beq     relocate_done           /* skip relocation */
        mov     r1, r6                  /* r1 <- scratch for copy loop */
        adr     r7, relocate_code       /* r7 <- SRC &relocate_code */
-       ldr     r3, _image_copy_end_ofs /* r3 <- __image_copy_end local ofs */
-       add     r2, r7, r3              /* r2 <- SRC &__image_copy_end */
+       ldr     r2, =__image_copy_end   /* r2 <- SRC &__image_copy_end */
 
 copy_loop:
        ldmia   r0!, {r10-r11}          /* copy from source address [r0]    */
@@ -89,8 +88,6 @@ relocate_done:
         bx        lr
 #endif
 
-_image_copy_end_ofs:
-       .word __image_copy_end - relocate_code
 _rel_dyn_start_ofs:
        .word __rel_dyn_start - relocate_code
 _rel_dyn_end_ofs:
index e52fec93331da3c0d45f20a354125e0d1b1b9c86..03e846fa25a1952f7428bd5af7ba0cff1a20e8cf 100644 (file)
@@ -37,3 +37,5 @@
 
 char __bss_start[0] __attribute__((section(".__bss_start")));
 char __bss_end[0] __attribute__((section(".__bss_end")));
+char __image_copy_start[0] __attribute__((section(".__image_copy_start")));
+char __image_copy_end[0] __attribute__((section(".__image_copy_end")));
index 989ad7121d19a519435b81ef0631ab4d1d21ade8..531e5986cb83b8ff66482ba9994c5019787b33d7 100644 (file)
@@ -30,6 +30,7 @@ SECTIONS
 
        . = ALIGN (4);
        .text : {
+               *(.__image_copy_start)
                arch/arm/cpu/ixp/start.o(.text*)
                net/libnet.o(.text*)
                board/actux1/libactux1.o(.text*)
@@ -62,7 +63,10 @@ SECTIONS
 
        . = ALIGN (4);
 
-       __image_copy_end = .;
+       .image_copy_end :
+       {
+               *(.__image_copy_end)
+       }
 
        .rel.dyn : {
                __rel_dyn_start = .;
index 0e206704ff9a8ed66cf37d0d2889dd3448ff72f7..aff773ce9c4b89baef696b51541a742bdb97080b 100644 (file)
@@ -30,6 +30,7 @@ SECTIONS
 
        . = ALIGN (4);
        .text : {
+               *(.__image_copy_start)
                arch/arm/cpu/ixp/start.o(.text*)
                net/libnet.o(.text*)
                board/actux2/libactux2.o(.text*)
@@ -62,7 +63,10 @@ SECTIONS
 
        . = ALIGN (4);
 
-       __image_copy_end = .;
+       .image_copy_end :
+       {
+               *(.__image_copy_end)
+       }
 
        .rel.dyn : {
                __rel_dyn_start = .;
index b7d29b4afa3d0e01c460fc32f576ee1ca9c63b33..9d43e95284802d8554fd4f426ec40f7c15defbbe 100644 (file)
@@ -30,6 +30,7 @@ SECTIONS
 
        . = ALIGN (4);
        .text : {
+               *(.__image_copy_start)
                arch/arm/cpu/ixp/start.o(.text*)
                net/libnet.o(.text*)
                board/actux3/libactux3.o(.text*)
@@ -62,7 +63,10 @@ SECTIONS
 
        . = ALIGN (4);
 
-       __image_copy_end = .;
+       .image_copy_end :
+       {
+               *(.__image_copy_end)
+       }
 
        .rel.dyn : {
                __rel_dyn_start = .;
index ecd9efe8fc6de038953126d56c9054cf8364eda4..ee7219f7ec5595eddc9e56140c18e455a1c182f4 100644 (file)
@@ -30,6 +30,7 @@ SECTIONS
 
        . = ALIGN (4);
        .text : {
+               *(.__image_copy_start)
                arch/arm/cpu/ixp/start.o(.text*)
                net/libnet.o(.text*)
                board/dvlhost/libdvlhost.o(.text*)
@@ -62,7 +63,10 @@ SECTIONS
 
        . = ALIGN (4);
 
-       __image_copy_end = .;
+       .image_copy_end :
+       {
+               *(.__image_copy_end)
+       }
 
        .rel.dyn : {
                __rel_dyn_start = .;
index 2197883140bbdc36fc21213590795e018d225c3e..f8ef00c32d53fc95b95c9cf83850390192809d4b 100644 (file)
@@ -34,6 +34,7 @@ SECTIONS
        . = ALIGN(4);
        .text      :
        {
+               *(.__image_copy_start)
          /* WARNING - the following is hand-optimized to fit within    */
          /* the sector layout of our flash chips!      XXX FIXME XXX   */
 
@@ -65,7 +66,10 @@ SECTIONS
 
        . = ALIGN(4);
 
-       __image_copy_end = .;
+       .image_copy_end :
+       {
+               *(.__image_copy_end)
+       }
 
        .rel.dyn : {
                __rel_dyn_start = .;