<div dir="ltr"><div>bcc cfe-dev</div><div><br></div>Your question is compiler backend related, which makes it more appropriate for <a href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</a>.  The Clang mailing list is more frontend-oriented.<div>
<br></div><div>---</div><div><br></div><div>I don't fully understand your question, but I'll try to give some general ELF information.</div><div><br></div><div>If the binary is an executable (ET_EXEC), then the kernel will map memory for each PT_LOAD segment at p_vaddr.</div>
<div><br></div><div>If the binary is a shared object (ET_DYN), then the *loader* (ld.so, not the kernel) will map the memory somewhere.  Generally, all p_vaddr values for ET_DYN ELFs are essentially offsets in the file (not true virtual addresses).  The loader will find a place in memory for the image and map in the segments with the same relative positioning.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Apr 10, 2014 at 1:21 PM, TheMask <span dir="ltr"><<a href="mailto:lol.themask@gmail.com" target="_blank">lol.themask@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">What I'm trying to understand here is segment in the ELF file format that's<br>
the binary file format used in most modern UNIX as output of compilers for<br>
this platform. And It's still (very highly) compiler's back-end related.<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://clang-developers.42468.n3.nabble.com/How-does-works-the-allocation-of-a-writable-readable-segment-in-ELF-tp4038806p4038810.html" target="_blank">http://clang-developers.42468.n3.nabble.com/How-does-works-the-allocation-of-a-writable-readable-segment-in-ELF-tp4038806p4038810.html</a><br>

<div class="HOEnZb"><div class="h5">Sent from the Clang Developers mailing list archive at Nabble.com.<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</div></div></blockquote></div><br></div>