[U-Boot-Users] u-boot BOOTELF clearing SHT_NOBITS sections
Mike Frysinger
vapier at gentoo.org
Sun May 4 10:15:52 CEST 2008
On Sunday 04 May 2008, Baruch Cochavy wrote:
> u-boot's bootelf clears (memset to 0) sections of SHT_NOBITS type. This
> covers .bss sections - however, it might also includes other sections,
> not expected to be cleared as per some users expectations (stacks, for
> example).
most people dont declare sections for stacks. i dont think ive ever seen an
ELF that does it.
> I am beginning to wonder if this behavior is correct/desired: if one
> tries to bootelf an ELF file which happens to resizde somewhere inside
> the .bss section, or some other data section of the loaded code, bootelf
> clears it (or part of it...) while loading, corrupting the code to be
> loaded.
if you have overlapping sections, then your ELF is broken. if you have data
in the middle of the .bss, then it isnt a NOBITS by definition, it's
PROGBITS. you're describing invalid scenarios.
> AFAIK, .bss is normally zeroed out in crt0 (or equivalent), so there is
> no need (?) to zero it in bootelf. Bootelf may also defer all such
> actions (clearing section) to the end of the loading process.
there is no normal sense here. the only real guarantee is that when main()
starts executing, the C runtime environment is entirely valid (or any
pre-main initializers that get run). by dropping the behavior in question,
you'd be breaking things that are working today, so it's pretty hard to
change it at all.
really though, using the section headers is going to always lead to
conflicting needs. the program headers should be used instead ... perhaps a
new command (or option) can be added for it ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20080504/d2d925c3/attachment.pgp
More information about the U-Boot
mailing list