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&#39;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 &lt;
<a href="mailto:hskinnemoen@atmel.com">hskinnemoen@atmel.com</a>&gt; 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>&quot;Ali Rouhi&quot; &lt;<a href="mailto:rouhi.ali@gmail.com">rouhi.ali@gmail.com</a>&gt; wrote:<br><br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; if (!(shdr-&gt;sh_flags &amp; SHF_ALLOC)<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| shdr-&gt;sh_addr == 0 || shdr-&gt;sh_size == 0) {
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue;<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; }<br><br></div>This looks bogus for several reasons. First, there&#39;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&#39;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>&gt; So I removed the &quot;shdr-&gt;sh_addr == 0&quot; check, recompiled u-boot (which<br>&gt; 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&#39;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>