|Some problem about the elf file while generating the code for compiler firstname.lastname@example.org (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 email@example.com (BGB) (2012-06-09)|
|From:||Jianfei Hu <firstname.lastname@example.org>|
|Date:||Thu, 7 Jun 2012 01:49:57 +0800|
|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]
Return to the
Search the comp.compilers archives again.