
Dear Albert,
On Tue, Mar 1, 2011 at 8:22 PM, Albert ARIBAUD albert.aribaud@free.fr wrote:
Le 01/03/2011 09:31, Po-Yu Chuang a écrit :
On Fri, Feb 25, 2011 at 4:00 PM, Po-Yu Chuangratbert.chuang@gmail.com wrote:
I tried the following command and it seems work:
for f in `find * -type f`; do sed -i 's/<_end>/__bss_end/g' $f; done
but when I tried to build, I got some error in standalone example:
[snip]
libstubs.o: In function `app_startup': /home/ratbert/linux/u-boot/examples/standalone/stubs.c:206: undefined reference to `__bss_end' make[1]: *** [hello_world] Error 1 make[1]: Leaving directory `/home/ratbert/linux/u-boot/examples/standalone' make: *** [examples/standalone] Error 2
It looks like that _end as end of BSS section is a convention to GNU toolchain. Should I simply fix it by hand, or should we reconsider the whole naming thing?
Indeed, since the link command line does not mention a linker file, then the default toolchain linker file was invoked. You can see the linker script using ld --verbose (be sure to use the toolchain's ld, not your host's). Mine (ELDK4.2 and CodeSourcery 2010q1) define __bss_start and __bss_start__ before the BSS section, and _bss_end__ and __bss_end__ after it, then __end__ and _end after that. No surprise that __bss_end did not work.
But examples (ang more generally, standalone applications) are not supposed to use symbols from U-Boot linker files; so there is no reason to replace __bss_end in these.
Still, we *could* align on the ELDK/CS linkers' output and use _bss_end__ and/or __bss_end__ rather than __bss_end for U-Boot, unless some other toolchain has radically different default linker scripts. Comments anyone?
I prefer the __bss_end__ solution. Not only because it doesn't require manual fixes after sed replacement command, but it also makes the semantics of app_startup() of the standalone example program clearer. If there is no other comment, I will submit patches using __bss_end__ later.
best regards, Po-Yu Chuang