ARM: Fix __bss_start and __bss_end in linker scripts
authorAlbert ARIBAUD <albert.u.boot@aribaud.net>
Thu, 11 Apr 2013 05:43:21 +0000 (05:43 +0000)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Sat, 13 Apr 2013 20:37:20 +0000 (22:37 +0200)
Commit 3ebd1cbc introduced compiler-generated __bss_start
and __bss_end__ and commit c23561e7 rewrote all __bss_end__
as __bss_end. Their merge caused silent and harmless but
potentially bug-inducing clashes between compiler- and linker-
generated __bss_end symbols.

Make __bss_end and __bss_start compiler-only, and create
__bss_base and __bss_limit for linker-only use.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
Reported-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
arch/arm/cpu/ixp/u-boot.lds
arch/arm/cpu/u-boot.lds
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 388a67f101cf75037efe17519e2c169e883497a3..553589ca6cbcdbcce06f804ac7507c1f906153d3 100644 (file)
@@ -69,17 +69,23 @@ SECTIONS
 
        _end = .;
 
+/*
+ * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c
+ * __bss_base and __bss_limit are for linker only (overlay ordering)
+ */
+
        .bss_start __rel_dyn_start (OVERLAY) : {
                KEEP(*(.__bss_start));
+               __bss_base = .;
        }
 
-       .bss __bss_start (OVERLAY) : {
+       .bss __bss_base (OVERLAY) : {
                *(.bss*)
                 . = ALIGN(4);
-                __bss_end = .;
+                __bss_limit = .;
        }
-       .bss_end __bss_end (OVERLAY) : {
-               KEEP(*(__bss_end));
+       .bss_end __bss_limit (OVERLAY) : {
+               KEEP(*(.__bss_end));
        }
 
        /DISCARD/ : { *(.dynstr*) }
index 3a1083d9a9b65c9bd00dad2bbaabf2a7a450aae6..d5e42d3ac942a316590a56d97b3c1cddb2880f21 100644 (file)
@@ -81,18 +81,24 @@ SECTIONS
                *(.mmutable)
        }
 
+/*
+ * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c
+ * __bss_base and __bss_limit are for linker only (overlay ordering)
+ */
+
        .bss_start __rel_dyn_start (OVERLAY) : {
                KEEP(*(.__bss_start));
+               __bss_base = .;
        }
 
-       .bss __bss_start (OVERLAY) : {
+       .bss __bss_base (OVERLAY) : {
                *(.bss*)
                 . = ALIGN(4);
-                __bss_end = .;
+                __bss_limit = .;
        }
 
-       .bss_end __bss_end (OVERLAY) : {
-               KEEP(*(__bss_end));
+       .bss_end __bss_limit (OVERLAY) : {
+               KEEP(*(.__bss_end));
        }
 
        /DISCARD/ : { *(.dynstr*) }
index 52fc9fc0c66bd99225ceb1b58bd1890836e52e75..ef4a25bc3cd952f163b91f6dd83079d4eb1e892a 100644 (file)
@@ -77,17 +77,23 @@ SECTIONS
 
        _end = .;
 
+/*
+ * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c
+ * __bss_base and __bss_limit are for linker only (overlay ordering)
+ */
+
        .bss_start __rel_dyn_start (OVERLAY) : {
                KEEP(*(.__bss_start));
+               __bss_base = .;
        }
 
-       .bss __bss_start (OVERLAY) : {
+       .bss __bss_base (OVERLAY) : {
                *(.bss*)
                 . = ALIGN(4);
-                __bss_end = .;
+                __bss_limit = .;
        }
-       .bss_end __bss_end (OVERLAY) : {
-               KEEP(*(__bss_end));
+       .bss_end __bss_limit (OVERLAY) : {
+               KEEP(*(.__bss_end));
        }
 
        /DISCARD/ : { *(.dynstr*) }
index cafd3d859d493baeb97b4aed25eacfaa70afa919..00ad8b71cd065bc466611c9dfc9d145511d61952 100644 (file)
@@ -77,17 +77,23 @@ SECTIONS
 
        _end = .;
 
+/*
+ * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c
+ * __bss_base and __bss_limit are for linker only (overlay ordering)
+ */
+
        .bss_start __rel_dyn_start (OVERLAY) : {
                KEEP(*(.__bss_start));
+               __bss_base = .;
        }
 
-       .bss __bss_start (OVERLAY) : {
+       .bss __bss_base (OVERLAY) : {
                *(.bss*)
                 . = ALIGN(4);
-                __bss_end = .;
+                __bss_limit = .;
        }
-       .bss_end __bss_end (OVERLAY) : {
-               KEEP(*(__bss_end));
+       .bss_end __bss_limit (OVERLAY) : {
+               KEEP(*(.__bss_end));
        }
 
        /DISCARD/ : { *(.dynstr*) }
index 168fe171c4e10aaadbb543faf01a2470fe044a3d..44b990ee7ff5cb548aba07923e08e1a3ef6e77b4 100644 (file)
@@ -77,17 +77,23 @@ SECTIONS
 
        _end = .;
 
+/*
+ * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c
+ * __bss_base and __bss_limit are for linker only (overlay ordering)
+ */
+
        .bss_start __rel_dyn_start (OVERLAY) : {
                KEEP(*(.__bss_start));
+               __bss_base = .;
        }
 
-       .bss __bss_start (OVERLAY) : {
+       .bss __bss_base (OVERLAY) : {
                *(.bss*)
                 . = ALIGN(4);
-                __bss_end = .;
+               __bss_limit = .;
        }
-       .bss_end __bss_end (OVERLAY) : {
-               KEEP(*(__bss_end));
+       .bss_end __bss_limit (OVERLAY) : {
+               KEEP(*(.__bss_end));
        }
 
        /DISCARD/ : { *(.dynstr*) }
index dd50bdbecd7977282b2c56dd9e6df75843e88070..6d4b1875c58adb56d3b39d08438a017a632124a5 100644 (file)
@@ -77,17 +77,23 @@ SECTIONS
 
        _end = .;
 
+/*
+ * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c
+ * __bss_base and __bss_limit are for linker only (overlay ordering)
+ */
+
        .bss_start __rel_dyn_start (OVERLAY) : {
                KEEP(*(.__bss_start));
+               __bss_base = .;
        }
 
-       .bss __bss_start (OVERLAY) : {
+       .bss __bss_base (OVERLAY) : {
                *(.bss*)
                 . = ALIGN(4);
-                __bss_end = .;
+                __bss_limit = .;
        }
-       .bss_end __bss_end (OVERLAY) : {
-               KEEP(*(__bss_end));
+       .bss_end __bss_limit (OVERLAY) : {
+               KEEP(*(.__bss_end));
        }
 
        /DISCARD/ : { *(.dynstr*) }
index f48fda171f7f38fb44aa1b0731f18eca9c734776..4969960001dda9af54bf772fa448c45250c61e1e 100644 (file)
@@ -80,17 +80,23 @@ SECTIONS
 
        _end = .;
 
+/*
+ * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c
+ * __bss_base and __bss_limit are for linker only (overlay ordering)
+ */
+
        .bss_start __rel_dyn_start (OVERLAY) : {
                KEEP(*(.__bss_start));
+               __bss_base = .;
        }
 
-       .bss __bss_start (OVERLAY) : {
+       .bss __bss_base (OVERLAY) : {
                *(.bss*)
                 . = ALIGN(4);
-                __bss_end = .;
+                __bss_limit = .;
        }
-       .bss_end __bss_end (OVERLAY) : {
-               KEEP(*(__bss_end));
+       .bss_end __bss_limit (OVERLAY) : {
+               KEEP(*(.__bss_end));
        }
 
        /DISCARD/ : { *(.bss*) }