[U-Boot] [PATCH] Align end of bss by 4 bytes,

Selvamuthukumar selva.muthukumar at e-coninfotech.com
Tue Oct 7 05:49:31 CEST 2008


bss initialization loop increments 4 bytes at a time.
And the loop end is checked for an 'equal' condition.
Make the bss end address aligned by 4, so that the loop
will end as expected.

Adding below lines creates bss of size not aligned to 4 bytes.

typedef struct bss_test__ {
        unsigned char a1;
        unsigned char ip1[4];
        unsigned char ip2[4];
} bss_test_t;

bss_test_t bss; /* Global variable */


$ ppc_83xx-gcc --version
ppc_83xx-gcc (GCC) 4.2.0 (MontaVista 4.2.0-4.0.7.0703741 2007-08-09)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$

$ ppc_83xx-readelf -S u-boot | grep bss
  [ 9] .bss              NOBITS          fe034000 0335dc 006c9d 00  WA  0   0  8
$

Size of bss is 6c9d bytes.

Signed-off-by: Selvamuthukumar <selva.muthukumar at e-coninfotech.com>
---
 cpu/mpc83xx/u-boot.lds |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/cpu/mpc83xx/u-boot.lds b/cpu/mpc83xx/u-boot.lds
index 99ad675..0d26937 100644
--- a/cpu/mpc83xx/u-boot.lds
+++ b/cpu/mpc83xx/u-boot.lds
@@ -117,6 +117,7 @@ SECTIONS
   *(.bss)
   *(COMMON)
  }
+  . = ALIGN(4);
  _end = . ;
  PROVIDE (end = .);
 }
--
1.5.5


More information about the U-Boot mailing list