Hi Haavard
A patch is attached. However your email jogged my memory. Before I posted my original message I did a search on the archive and it seems a patch for using program headers for loading was submitted over a year ago:
http://sourceforge.net/mailarchive/message.php?msg_id=BCD6BEF0CD0AE546B84C1848C5F255A902DB40E3%40ES23SNLNT.srn.sandia.gov
I haven't looked at it, but given what you wrote it may be a superior method for fixing the problem.
Best Regards
Ali
On Thu, 6 Dec 2007 14:36:57 -0800This looks bogus for several reasons. First, there's nothing wrong with
"Ali Rouhi" <rouhi.ali@gmail.com> wrote:
> if (!(shdr->sh_flags & SHF_ALLOC)
> || shdr->sh_addr == 0 || shdr->sh_size == 0) {
> continue;
> }
placing a loadable section at address 0. Second, why is a _loader_
looking at the section header anyway? Loaders are supposed to look at
the program header, while the section header is for linkers and
debuggers.
The latter issue isn't that serious since the section header contains
all the needed information, but an ELF file without a section header is
still a valid ELF file that the loader should know how to deal with.I think that change makes sense; care to submit a patch? Although
> So I removed the "shdr->sh_addr == 0" check, recompiled u-boot (which
> for me is not based at 0x0!) and was able to boot my ELF.
beware that when your application is loaded at address 0, NULL pointers
can't really be used as NULL pointers anymore since they may point to
valid data.
Haavard