[cfe-dev] How does works the allocation of a writable/readable segment in ELF?

Reid Kleckner rnk at google.com
Thu Apr 10 13:53:59 PDT 2014


bcc cfe-dev

Your question is compiler backend related, which makes it more appropriate
for llvmdev at cs.uiuc.edu.  The Clang mailing list is more frontend-oriented.

---

I don't fully understand your question, but I'll try to give some general
ELF information.

If the binary is an executable (ET_EXEC), then the kernel will map memory
for each PT_LOAD segment at p_vaddr.

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.


On Thu, Apr 10, 2014 at 1:21 PM, TheMask <lol.themask at gmail.com> wrote:

> What I'm trying to understand here is segment in the ELF file format that's
> the binary file format used in most modern UNIX as output of compilers for
> this platform. And It's still (very highly) compiler's back-end related.
>
>
>
> --
> View this message in context:
> http://clang-developers.42468.n3.nabble.com/How-does-works-the-allocation-of-a-writable-readable-segment-in-ELF-tp4038806p4038810.html
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140410/629c7733/attachment.html>


More information about the cfe-dev mailing list