
Le 24/02/2011 13:58, Po-Yu Chuang a écrit :
Hi Albert,
On Thu, Feb 24, 2011 at 7:58 PM, Albert ARIBAUDalbert.aribaud@free.fr wrote:
Le 24/02/2011 10:39, Wolfgang Denk a écrit :
Dear Albert ARIBAUD,
In message4D6611A7.5050802@free.fr you wrote:
> In the U-Boot image itself, knowing the image size could be achieved > in > ARM by using a general _end symbol that would be set after the last > image output section, so _end-_start would equal the image size.
we have such a "_end" in u-boot.lds files.
I *knew* this name did not pop up in my mind without a reason. :)
Apologies for not having checked.
I guess we need a __dynsym_end in all u-boot.lds files.
I'd rather go for "_end", which does not tie the solution to dynsym being the last section in the image -- imagine for some reason we move dynsym inside the image rather than at the end, end the image size will be wrong again. With _end, and a suitable comment in the LD file... this will be averted where-ever dynsym ends up.
After all, the bug you uncovered was due to using the wrong symbol, a BSS related one rather than an image-related one, in the first place; so let's try and learn from past mistakes.
I think the location of _end in the linker scripts needs to be changed
- so far it covers the maximum of dynsym and bss, but it should refer
to the end of dynsym only.
Po-Yu Chuang, can you verify Wolfgang's suggestion (and make sure no other place depends on _end) and submit a patch? As this is a fix, a quick patch could still be pulled in for the upcoming release.
I think there is a problem in Wolfgang's suggestion.
Those start.S files assume that BSS section is from __bss_start to _end. If we change _end to the end of .dynsym, then we will not clear BSS correctly.
I agree with your comment about _end is a better choice than __dynsym_end, but if we changed _end, maybe we need __bss_end? Either way, we need to modify all the u-boot.lds and/or start.S.
I still don't know what is the best solution.
Thanks for pointing this out: indeed, _end is actually used as BSS's end, not as the image's end -- I did not find any other use of it.
However, not only ARM uses _end: how do we want to handle the change overall?
best regards, Po-Yu Chuang
Amicalement,