Some problem about the elf file while generating the code for compiler

Jianfei Hu <hujianfei258@gmail.com>
Thu, 7 Jun 2012 01:49:57 +0800

          From comp.compilers

Related articles
Some problem about the elf file while generating the code for compiler hujianfei258@gmail.com (Jianfei Hu) (2012-06-07)
Re: Some problem about the elf file while generating the code for comp bobduff@shell01.TheWorld.com (Robert A Duff) (2012-06-07)
Re: Some problem about the elf file while generating the code for comp cr88192@hotmail.com (BGB) (2012-06-09)
| List of all articles for this month |

From: Jianfei Hu <hujianfei258@gmail.com>
Newsgroups: comp.compilers
Date: Thu, 7 Jun 2012 01:49:57 +0800
Organization: Compilers Central
Keywords: linker, question, comment
Posted-Date: 06 Jun 2012 17:33:20 EDT

Recently I plan to build a simple compiler by myself. When it comes to
elf file generation, I got a problem. As the elf file specification
says, the segment's virtual addr should be congruent with the offset
in the file modulo page size. Because this would be good for mmap the
elf file into memory efficiently.


But How, why with the same remainder could enhance the efficiency of
mmap file into memory? As I think, the process would map the segment
into memory twice. In the first time , the segment content would be
put right next to last segment, and then right at the tail of the
first segment content, the second content would be put once more, but
starting at another page. Draw the picture and this is matching the
requirement. Am I right?


And I feel that to implement the simple compiler, I still need some
low level knowledge. Could someone give me some suggestion or
recommend good resources?
[Yes, an ELF file can map a page twice if it's in two segments.
You might take a look at my Linkers and Loaders book, and at the old
AT&T System V references for details on using ELF. -John]


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.