arm: make __rel_dyn_{start, end} compiler-generated
authorAlbert ARIBAUD <albert.u.boot@aribaud.net>
Tue, 11 Jun 2013 12:17:34 +0000 (14:17 +0200)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Fri, 21 Jun 2013 21:05:29 +0000 (23:05 +0200)
This change is only done where needed: some linker
scripts may contain relocation symbols yet remain
unchanged.

__rel_dyn_start and __rel_dyn_end each requires
its own output section; putting them in relocation
sections changes their flags and breaks relocation.

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/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 9141199bedb4edac358c906627c95ac256c388d6..54bafda32443f7ee64da51d4df91b135cac32ddc 100644 (file)
@@ -60,10 +60,18 @@ SECTIONS
                *(.__image_copy_end)
        }
 
+       .rel_dyn_start :
+       {
+               *(.__rel_dyn_start)
+       }
+
        .rel.dyn : {
-               __rel_dyn_start = .;
                *(.rel*)
-               __rel_dyn_end = .;
+       }
+
+       .rel_dyn_end :
+       {
+               *(.__rel_dyn_end)
        }
 
        _end = .;
index d7adf90dafd9484125e5be2e36367bcda509cb05..3037885b1270ddaa5f502bfe24fdbe3b2fe829bc 100644 (file)
@@ -62,10 +62,18 @@ SECTIONS
                *(.__image_copy_end)
        }
 
+       .rel_dyn_start :
+       {
+               *(.__rel_dyn_start)
+       }
+
        .rel.dyn : {
-               __rel_dyn_start = .;
                *(.rel*)
-               __rel_dyn_end = .;
+       }
+
+       .rel_dyn_end :
+       {
+               *(.__rel_dyn_end)
        }
 
        _end = .;
index 3767a9550c73bdeae8decab3021235a081339d3c..3f444c1d267aaa9c66505cc704f8fe57bf99bc25 100644 (file)
@@ -55,10 +55,8 @@ copy_loop:
        /*
         * fix .rel.dyn relocations
         */
-       ldr     r2, _rel_dyn_start_ofs  /* r2 <- __rel_dyn_start local ofs */
-       add     r2, r2, r7              /* r2 <- SRC &__rel_dyn_start */
-       ldr     r3, _rel_dyn_end_ofs    /* r3 <- __rel_dyn_end local ofs */
-       add     r3, r3, r7              /* r3 <- SRC &__rel_dyn_end */
+       ldr     r2, =__rel_dyn_start    /* r2 <- SRC &__rel_dyn_start */
+       ldr     r3, =__rel_dyn_end      /* r3 <- SRC &__rel_dyn_end */
 fixloop:
        ldr     r0, [r2]                /* r0 <- SRC location to fix up */
        add     r0, r0, r9              /* r0 <- DST location to fix up */
@@ -88,9 +86,4 @@ relocate_done:
         bx        lr
 #endif
 
-_rel_dyn_start_ofs:
-       .word __rel_dyn_start - relocate_code
-_rel_dyn_end_ofs:
-       .word __rel_dyn_end - relocate_code
-
 ENDPROC(relocate_code)
index 03e846fa25a1952f7428bd5af7ba0cff1a20e8cf..5921dd8d6625fcea0ef29a958a2d0b72f8f2b3cd 100644 (file)
@@ -39,3 +39,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")));
+char __rel_dyn_start[0] __attribute__((section(".__rel_dyn_start")));
+char __rel_dyn_end[0] __attribute__((section(".__rel_dyn_end")));
index 531e5986cb83b8ff66482ba9994c5019787b33d7..74aec5fbcc0df477132d4185b04939d1b993c0de 100644 (file)
@@ -68,10 +68,18 @@ SECTIONS
                *(.__image_copy_end)
        }
 
+       .rel_dyn_start :
+       {
+               *(.__rel_dyn_start)
+       }
+
        .rel.dyn : {
-               __rel_dyn_start = .;
                *(.rel*)
-               __rel_dyn_end = .;
+       }
+
+       .rel_dyn_end :
+       {
+               *(.__rel_dyn_end)
        }
 
        _end = .;
index aff773ce9c4b89baef696b51541a742bdb97080b..c276501bd7b6dc057f4936b9f01ca0c175872a2b 100644 (file)
@@ -68,10 +68,18 @@ SECTIONS
                *(.__image_copy_end)
        }
 
+       .rel_dyn_start :
+       {
+               *(.__rel_dyn_start)
+       }
+
        .rel.dyn : {
-               __rel_dyn_start = .;
                *(.rel*)
-               __rel_dyn_end = .;
+       }
+
+       .rel_dyn_end :
+       {
+               *(.__rel_dyn_end)
        }
 
        _end = .;
index 9d43e95284802d8554fd4f426ec40f7c15defbbe..5610644d79b15d968166c2eb76bca7055610637d 100644 (file)
@@ -68,10 +68,18 @@ SECTIONS
                *(.__image_copy_end)
        }
 
+       .rel_dyn_start :
+       {
+               *(.__rel_dyn_start)
+       }
+
        .rel.dyn : {
-               __rel_dyn_start = .;
                *(.rel*)
-               __rel_dyn_end = .;
+       }
+
+       .rel_dyn_end :
+       {
+               *(.__rel_dyn_end)
        }
 
        _end = .;
index ee7219f7ec5595eddc9e56140c18e455a1c182f4..f3591123230de5551a7cc0cc1236966631f115d0 100644 (file)
@@ -68,10 +68,18 @@ SECTIONS
                *(.__image_copy_end)
        }
 
+       .rel_dyn_start :
+       {
+               *(.__rel_dyn_start)
+       }
+
        .rel.dyn : {
-               __rel_dyn_start = .;
                *(.rel*)
-               __rel_dyn_end = .;
+       }
+
+       .rel_dyn_end :
+       {
+               *(.__rel_dyn_end)
        }
 
        _end = .;
index f8ef00c32d53fc95b95c9cf83850390192809d4b..963d29f2dc839cb746dc60c39edb779854684e38 100644 (file)
@@ -71,10 +71,18 @@ SECTIONS
                *(.__image_copy_end)
        }
 
+       .rel_dyn_start :
+       {
+               *(.__rel_dyn_start)
+       }
+
        .rel.dyn : {
-               __rel_dyn_start = .;
                *(.rel*)
-               __rel_dyn_end = .;
+       }
+
+       .rel_dyn_end :
+       {
+               *(.__rel_dyn_end)
        }
 
        _end = .;