In operating systems that support virtual memory an ELF file can be loaded by mapping the ELF files into the address space of the process loading the file. When a virtual address in a page that is mapped to the file is accessed, the operating system loads that page from disk. ELF files that are to be used this way must conform to a certain format.
--paged command-line option to enable
demand paging mode. This helps produce ELF files that can be demand
ELF files produced with the
are already demand-paged compliant.
The basic constraints on the ELF file are:
there is no difference between the load and execution address for any Output Section
all PT_LOAD Program Headers have a minimum alignment,
pt_align, of the page size for the operating system
all PT_LOAD Program Headers have a file offset,
pt_offset, that is congruent to the virtual address (
--paged is on:
The linker automatically generates the Program Headers from the execution region base addresses. The usual situation where one load region generates one Program Header no longer holds.
The operating system page size is controlled by the
The linker attempts to place the ELF Header and Program Header in the first PT_LOAD program header, if space is available.