Hi Haavard<br><br>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:
<br><br><a href="http://sourceforge.net/mailarchive/message.php?msg_id=BCD6BEF0CD0AE546B84C1848C5F255A902DB40E3%40ES23SNLNT.srn.sandia.gov">http://sourceforge.net/mailarchive/message.php?msg_id=BCD6BEF0CD0AE546B84C1848C5F255A902DB40E3%40ES23SNLNT.srn.sandia.gov
</a><br><br>I haven't looked at it, but given what you wrote it may be a superior method for fixing the problem.<br><br>Best Regards<br>Ali<br><br><div class="gmail_quote">On Dec 7, 2007 1:10 AM, Haavard Skinnemoen <
<a href="mailto:hskinnemoen@atmel.com">hskinnemoen@atmel.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">
On Thu, 6 Dec 2007 14:36:57 -0800<br>"Ali Rouhi" <<a href="mailto:rouhi.ali@gmail.com">rouhi.ali@gmail.com</a>> wrote:<br><br>> if (!(shdr->sh_flags & SHF_ALLOC)<br>> || shdr->sh_addr == 0 || shdr->sh_size == 0) {
<br>> continue;<br>> }<br><br></div>This looks bogus for several reasons. First, there's nothing wrong with<br>placing a loadable section at address 0. Second, why is a _loader_<br>looking at the section header anyway? Loaders are supposed to look at
<br>the program header, while the section header is for linkers and<br>debuggers.<br><br>The latter issue isn't that serious since the section header contains<br>all the needed information, but an ELF file without a section header is
<br>still a valid ELF file that the loader should know how to deal with.<br><div class="Ih2E3d"><br>> So I removed the "shdr->sh_addr == 0" check, recompiled u-boot (which<br>> for me is not based at 0x0!) and was able to boot my ELF.
<br><br></div>I think that change makes sense; care to submit a patch? Although<br>beware that when your application is loaded at address 0, NULL pointers<br>can't really be used as NULL pointers anymore since they may point to
<br>valid data.<br><font color="#888888"><br>Haavard<br></font></blockquote></div><br>