Program header
An executable or shared object file's program header table is an array of
structures, each describing a segment or other information the system needs
to prepare the program for execution. An object file segment contains one
or more sections, as
``Segment contents''
describes below. Program headers
are meaningful only for executable and shared object files. A file specifies
its own program header size with the ELF header's e_phentsize and
e_phnum members. See
for more information.
typedef struct {
Elf32_Word p_type;
Elf32_Off p_offset;
Elf32_Addr p_vaddr;
Elf32_Addr p_paddr;
Elf32_Word p_filesz;
Elf32_Word p_memsz;
Elf32_Word p_flags;
Elf32_Word p_align;
} Elf32_Phdr;
typedef struct {
Elf64_Word p_type;
Elf64_Word p_flags;
Elf64_Off p_offset;
Elf64_Addr p_vaddr;
Elf64_Addr p_paddr;
Elf64_Xword p_filesz;
Elf64_Xword p_memsz;
Elf64_Xword p_align;
} Elf64_Phdr;
Relocation types (processor-specific)
p_type
-
This member tells what kind of segment this array element describes
or how to interpret the array element's information. Type values and
their meanings appear below.
p_offset
-
This member gives the offset from the beginning of the file at
which the first byte of the segment resides.
p_vaddr
-
This member gives the virtual address at which the first byte
of the segment resides in memory.
p_paddr
-
On systems for which physical addressing is relevant, this member is
reserved for the segment's physical address. Because System V ignores
physical addressing for application programs, this member has unspecified
contents for executable files and shared objects.
p_filesz
-
This member gives the number of bytes in the file image of the
segment; it may be zero.
p_memsz
-
This member gives the number of bytes in the memory image of
the segment; it may be zero.
p_flags
-
This member gives flags relevant to the segment. Defined flag values
appear below.
p_align
-
Loadable process segments must have congruent values
for p_vaddr and p_offset, modulo the page size.
This member gives the value to which the segments are aligned in
memory and in the file. Values 0 and 1 mean no alignment is
required. Otherwise, p_align should be a positive, integral
power of 2, and p_vaddr should equal p_offset,
modulo p_align.
Some entries describe process segments; others give supplementary
information and do not contribute to the process image. Segment entries
may appear in any order, except as explicitly noted below. Defined
type values follow; other values are reserved for future use.
Name
|
Value
|
PT_NULL
|
0
|
PT_LOAD
|
1
|
PT_DYNAMIC
|
2
|
PT_INTERP
|
3
|
PT_NOTE
|
4
|
PT_SHLIB
|
5
|
PT_PHDR
|
6
|
PT_LOOS
|
0x60000000
|
PT_HIOS
|
0x6fffffff
|
PT_LOPROC
|
0x70000000
|
PT_HIPROC
|
0x7fffffff
|
Segment types, p_type table
PT_NULL-
The array element is unused; other members' values are undefined.
This type lets the program header table have ignored entries.
PT_LOAD-
The array element specifies a loadable segment, described by
p_filesz and p_memsz. The bytes from the
file are mapped to the beginning of the memory
segment. If the segment's memory size (p_memsz) is
larger than the file size (p_filesz), the ``extra''
bytes are defined to hold the value 0 and to follow the
segment's initialized area. The file size may not be larger
than the memory size. Loadable segment entries in the program
header table appear in ascending order,
sorted on the p_vaddr member.
PT_DYNAMIC-
The array element specifies dynamic linking information. See
``Dynamic section''
for more information.
PT_INTERP-
The array element specifies the location and size of a
null-terminated path name to invoke as an interpreter.
This segment type is meaningful only for executable
files (though it may occur for shared objects); it may not
occur more than once in a file. If it is present, it must
precede any loadable segment entry. See
``Program interpreter''
for more information.
PT_NOTE-
The array element specifies the location and size of
auxiliary information. See
``Note section''
for more information.
PT_SHLIB-
This segment type is reserved but has unspecified semantics. Programs
that contain an array element of this type do not conform to the
ABI.
PT_PHDR-
The array element, if present, specifies the location and size of
the program header table itself, both in the file and in the
memory image of the program. This segment type may not occur
more than once in a file. Moreover, it may occur only if the
program header table is part of the memory image of the program.
If it is present, it must precede any loadable segment entry. See
``Program interpreter''
for more information.
PT_LOOS through PT_HIOS-
Values in this inclusive range are reserved for operating
system-specific semantics.
PT_LOPROC through PT_HIPROC-
Values in this inclusive range are reserved for processor-specific
semantics. If meanings are specified, the processor supplement
explains them.
NOTE:
Unless specifically required elsewhere, all program header
segment types are optional. A file's program header table
may contain only those elements relevant to its contents.
Next topic:
Base address
Previous topic:
Relocation types (processor-specific)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005