<div dir="ltr">This question isn't on-topic for this list (we're compiler devs, not kernel devs). If you want to look at exactly how this works you can check out the linux source code <<a href="https://github.com/torvalds/linux/blob/master/fs/binfmt_elf.c">https://github.com/torvalds/linux/blob/master/fs/binfmt_elf.c</a>> or the source code of various other kernels (*BSD, illumos, Haiku, Xv6 (might be easiest)). IIRC that is where I learned about it.<div>
<br></div><div>-- Sean Silva</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Apr 10, 2014 at 1:30 AM, 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">A segment of *PT_LOAD* type, flags *PF_write | PF_read*, *p_filesiz = x* and<br>
*p_memsiz = x+y* it's up to the kernel allocate *p_memsiz*, correct? How<br>
does this allocation actually works? the kernel allocate *p_memsiz* and put<br>
the begging of this block memory on *p_vaddr* so that the write/read memory<br>
region of this segment is from *p_vaddr* up to *p_vaddr + p_memsiz*? if so,<br>
what values(address) is the kernel expecting at *p_vaddr* at time before it<br>
does the allocation?<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-tp4038806.html" target="_blank">http://clang-developers.42468.n3.nabble.com/How-does-works-the-allocation-of-a-writable-readable-segment-in-ELF-tp4038806.html</a><br>

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>
</blockquote></div><br></div>