ARM Compiler toolchain Using the Linker - ARM Information Center
ARM Compiler toolchain Using the Linker - ARM Information Center
ARM Compiler toolchain Using the Linker - ARM Information Center
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
4.14 Demand paging<br />
4.14.1 Example<br />
4.14.2 See also<br />
Image structure and generation<br />
In operating systems that support virtual memory an ELF file can be loaded by mapping <strong>the</strong> ELF<br />
files into <strong>the</strong> address space of <strong>the</strong> process loading <strong>the</strong> file. When a virtual address in a page that<br />
is mapped to <strong>the</strong> file is accessed <strong>the</strong> operating system loads that page from disk. ELF files that<br />
are to be used this way must conform to a certain format.<br />
Use <strong>the</strong> --paged command-line option to enable demand paging mode. This helps produce ELF<br />
files that can be demand paged efficiently.<br />
Note<br />
ELF files produced with <strong>the</strong> --sysv option are already demand-paged compliant. --arm_linux<br />
also implies --sysv.<br />
The basic constraints on <strong>the</strong> ELF file are:<br />
• <strong>the</strong>re is no difference between <strong>the</strong> load and execution address for any Output Section<br />
• all PT_LOAD Program Headers have a minimum alignment, pt_align, of <strong>the</strong> page size<br />
for <strong>the</strong> operating system<br />
• all PT_LOAD Program Headers have a file offset, pt_offset, that is congruent to <strong>the</strong><br />
virtual address (pt_addr) modulo pt_align.<br />
When --paged is on:<br />
• The linker automatically generates <strong>the</strong> Program Headers from <strong>the</strong> execution region base<br />
addresses. The usual situation where one load region generates one Program Header no<br />
longer holds.<br />
• The operating system page size is controlled by <strong>the</strong> --pagesize command-line option.<br />
• The linker attempts to place <strong>the</strong> ELF Header and Program Header in <strong>the</strong> first PT_LOAD<br />
program header, if space is available.<br />
This is an example of a demand paged scatter file:<br />
LR1 GetPageSize() + SizeOfHeaders()<br />
{<br />
ER_RO +0<br />
{<br />
*(+RO)<br />
}<br />
ER_RW +GetPageSize()<br />
{<br />
*(+RW)<br />
}<br />
ER_ZI +0<br />
{<br />
*(+ZI)<br />
}<br />
}<br />
Concepts<br />
• About scatter-loading on page 8-3<br />
<strong>ARM</strong> DUI 0474C Copyright © 2010-2011 <strong>ARM</strong>. All rights reserved. 4-23<br />
ID080411 Non-Confidential