On Wed, 2006-06-07 at 10:38 +0100, Bert Thomas wrote: > > Of course - the headers are just that; descriptions of stuff to come > > _later_ in the file. A sane ELF file (files created by GNU ld behave > > this way) will have the various section headers first, followed by > > the actual program segments. There is no need for a loader (like > > RedBoot which is what started this discussion) to ever load the > > headers as part of the image, rather only process them to figure > > out what needs to be loaded and where. For example, a RAM program > > I aggree with you on the sanity part. However, I bet that most if not > all Linux executables have a segment that include the headers. I assume > you are working on a Linux machine. Could you try readelf on ls for > example? > > Again, it is not that I disaggree with you. It is just that I observe it > isn't the way you and I expected it to be. > > I suspect the reason that your example doesn't have a segment that > includes the headers has something to do with the linker script you > wrote to link that program.
Fair enough, but I don't care about Linux executables (at least, not in this context). RedBoot loads programs to run on embedded systems (including Linux kernels) and every one to date was organized in this [sane] fashion. All of that aside, if the program segments are not laid out in strictly one-direction (i.e. can be processed from the start of the file to the end), then RedBoot's loader can't handle them anyway since it has virtually no way to position randomly within the "file". Remember that the most common "file" is actually a stream of data (X-Modem, TFTP, etc) and RedBoot cannot afford to have an entire copy of it in memory, hence no random jumping about. -- ------------------------------------------------------------ Gary Thomas | Consulting for the MLB Associates | Embedded world ------------------------------------------------------------
