diff options
Diffstat (limited to 'man5')
| -rw-r--r-- | man5/elf.5 | 100 |
1 files changed, 58 insertions, 42 deletions
diff --git a/man5/elf.5 b/man5/elf.5 index f2a22d5946..492aae6ff4 100644 --- a/man5/elf.5 +++ b/man5/elf.5 @@ -30,7 +30,7 @@ .\" 2007-10-11, Mike Frysinger <vapier@gentoo.org>, various fixes .\" 2007-12-08, mtk, Converted from mdoc to man macros .\" -.TH ELF 5 2007-12-08 "Linux" "Linux Programmer's Manual" +.TH ELF 5 2007-12-28 "Linux" "Linux Programmer's Manual" .SH NAME elf \- format of Executable and Linking Format (ELF) files .SH SYNOPSIS @@ -45,7 +45,7 @@ defines the format of ELF executable binary files. Amongst these files are normal executable files, relocatable object files, core files and shared libraries. -.sp +.PP An executable file using the ELF file format consists of an ELF header, followed by a program header table or a section header table, or both. The ELF header is always at offset zero of the file. @@ -54,7 +54,7 @@ table and the section header table's offset in the file are defined in the ELF header. The two tables describe the rest of the particularities of the file. -.sp +.PP .\" Applications which wish to process ELF binary files for their native .\" architecture only should include .\" .I <elf_abi.h> @@ -81,7 +81,7 @@ the file. This header file describes the above mentioned headers as C structures and also includes structures for dynamic sections, relocation sections and symbol tables. -.sp +.PP The following types are used for N-bit architectures (N=32,64, .I ElfN stands for @@ -109,7 +109,7 @@ ElfN_Xword uint64_t .\" Elf32_Size Unsigned object size .fi .in -.sp +.PP (Note: The *BSD terminology is a bit different. There .I Elf64_Half @@ -122,14 +122,14 @@ is used for .IR uint16_t . In order to avoid confusion these types are replaced by explicit ones in the below.) -.sp +.PP All data structures that the file format defines follow the "natural" size and alignment guidelines for the relevant class. If necessary, data structures contain explicit padding to ensure 4-byte alignment for 4-byte objects, to force structure sizes to a multiple of 4, etc. -.sp +.PP The ELF header is described by the type .I Elf32_Ehdr or @@ -157,7 +157,7 @@ typedef struct { } ElfN_Ehdr; .fi .in -.sp +.PP The fields have the following meanings: .\" .Bl -tag -width "e_phentsize" .TP 12 @@ -202,6 +202,7 @@ The fifth byte identifies the architecture for this binary: .RS 12 .\" .Bl -tag -width "ELFCLASSNONE" -compact .TP 14 +.PD 0 .BR ELFCLASSNONE This class is invalid. .TP @@ -212,6 +213,7 @@ and virtual address spaces up to 4 Gigabytes. .TP .BR ELFCLASS64 This defines the 64-bit architecture. +.PD .RE .\" .El .TP @@ -222,6 +224,7 @@ Currently these encodings are supported: .\" .Bl -tag -width "ELFDATA2LSB" -compact .RS 12 .TP 14 +.PD 0 .BR ELFDATANONE Unknown data format. .TP @@ -230,9 +233,11 @@ Two's complement, little-endian. .TP .BR ELFDATA2MSB Two's complement, big-endian. +.PD .RE .\" .El .TP +.PD 0 .BR EI_VERSION The version number of the ELF specification: .\" .Bl -tag -width "EV_CURRENT" -compact @@ -243,6 +248,7 @@ Invalid version. .TP .BR EV_CURRENT Current version. +.PD .RE .\".El .TP @@ -256,6 +262,7 @@ E.g.: .\" .Bl -tag -width "ELFOSABI_STANDALONE" -compact .RS 12 .TP 20 +.PD 0 .BR ELFOSABI_NONE Same as ELFOSABI_SYSV .\" 0 @@ -318,6 +325,7 @@ ARM architecture ABI. Stand-alone (embedded) ABI. .\" 255 .\" .El +.PD .RE .TP .BR EI_ABIVERSION @@ -349,6 +357,7 @@ This member of the structure identifies the object file type: .RS 12 .\" .Bl -tag -width "ET_NONE" -compact .TP 12 +.PD 0 .BR ET_NONE An unknown type. .TP @@ -363,6 +372,7 @@ A shared object. .TP .BR ET_CORE A core file. +.PD .RE .\" .El .TP @@ -372,6 +382,7 @@ E.g.: .RS 12 .\" .Bl -tag -width "EM_MIPS_RS4_BE" -compact .TP 12 +.PD 0 .BR EM_NONE An unknown machine. .\" 0 @@ -467,6 +478,7 @@ DEC Vax. .\" .TP .\" .BR EM_ALPHA_EXP .\" Compaq [DEC] Alpha with enhanced instruction set. +.PD .RE .\" .El .TP @@ -475,12 +487,14 @@ This member identifies the file version: .\" .Bl -tag -width "EV_CURRENT" -compact .RS 12 .TP 12 +.PD 0 .BR EV_NONE Invalid version. .TP .BR EV_CURRENT Current version. .\" .El +.PD .RE .TP .IR e_entry @@ -648,7 +662,7 @@ typedef struct { } Elf64_Phdr; .fi .in -.sp +.PP The main difference between the 32-bit and the 64-bit program header lies in the location of the .IR p_flags @@ -760,6 +774,7 @@ This member holds a bitmask of flags relevant to the segment: .\" .Bl -tag -width "PF_X" -compact .RS 12 .TP +.PD 0 .BR PF_X An executable segment. .TP @@ -768,9 +783,10 @@ A writable segment. .TP .BR PF_R A readable segment. +.PD .RE .\" .El -.sp +.IP A text segment commonly has the flags .BR PF_X and @@ -799,7 +815,7 @@ should equal modulo .IR p_align . .\" .El -.sp +.PP A file's section header table lets one locate all the file's sections. The section header table is an array of @@ -816,14 +832,13 @@ header table. holds the number of entries the section header table contains. .IR e_shentsize holds the size in bytes of each entry. -.sp +.PP A section header table index is a subscript into this array. Some section header table indices are reserved. An object file does not have sections for these special indices: .\" .Bl -tag -width "SHN_LORESERVE" -.RS 12 .TP 14 .BR SHN_UNDEF This value marks an undefined, missing, irrelevant or otherwise meaningless @@ -864,7 +879,6 @@ inclusive. The section header table does not contain entries for the reserved indices. .\" .El -.RE .PP The section header has the following structure: .in +4n @@ -901,10 +915,10 @@ typedef struct { } Elf64_Shdr; .fi .in -.sp +.PP No real differences exist between the 32-bit and 64-bit section headers. .\" .Bl -tag -width "sh_addralign" -.TP 12 +.TP 10 .IR sh_name This member specifies the name of the section. Its value is an index @@ -914,8 +928,8 @@ a null-terminated string. .IR sh_type This member categorizes the section's contents and semantics. .\" .Bl -tag -width "SHT_PROGBITS" -.RS 12 -.TP 13 +.RS 10 +.TP 15 .BR SHT_NULL This value marks the section header as inactive. It does not @@ -1032,8 +1046,8 @@ Otherwise, the attribute is or does not apply. Undefined attributes are set to zero. .\" .Bl -tag -width "SHF_EXECINSTR" -compact -.RS 12 -.TP 14 +.RS 10 +.TP 15 .BR SHF_WRITE This section contains data that should be writable during process execution. @@ -1110,7 +1124,7 @@ fixed-size entries. .PP Various sections hold program and control information: .\" .Bl -tag -width ".shstrtab" -.TP +.TP 10 .IR .bss This section holds uninitialized data that contributes to the program's memory image. @@ -1409,7 +1423,7 @@ The attributes used are and .BR SHF_EXECINSTR . .\" .El -.sp +.PP String table sections hold null-terminated character sequences, commonly called strings. The object file uses these strings to represent symbol @@ -1420,7 +1434,7 @@ The first byte, which is index zero, is defined to hold a null byte ('\\0'). Similarly, a string table's last byte is defined to hold a null byte, ensuring null termination for all strings. -.sp +.PP An object file's symbol table holds information needed to locate and relocate a program's symbolic definitions and references. A symbol table @@ -1451,11 +1465,11 @@ typedef struct { } Elf64_Sym; .fi .in -.sp +.PP The 32-bit and 64-bit versions have the same members, just in a different order. .\" .Bl -tag -width "st_value" -.TP +.TP 10 .IR st_name This member holds an index into the object file's symbol string table, which holds character representations of the symbol names. @@ -1475,7 +1489,7 @@ has no size or an unknown size. .IR st_info This member specifies the symbol's type and binding attributes: .\" .Bl -tag -width "STT_SECTION" -.RS 12 +.RS 10 .TP 12 .BR STT_NOTYPE The symbol's type is not defined. @@ -1541,14 +1555,14 @@ is reserved for processor-specific semantics. This value down to and including .BR STB_LOPROC is reserved for processor-specific semantics. -.sp +.IP There are macros for packing and unpacking the binding and type fields: -.sp +.IP .BR ELF32_ST_BIND (info) or .BR ELF64_ST_BIND (info) extract a binding from an st_info value. -.sp +.IP .BR ELF32_ST_TYPE (info) or .BR ELF64_ST_TYPE (info) @@ -1556,7 +1570,7 @@ or extract a type from an .I st_info value. -.sp +.IP .BR ELF32_ST_INFO "(bind, type)" or .BR ELF64_ST_INFO "(bind, type)" @@ -1568,8 +1582,9 @@ convert a binding and a type into an st_info value. .IR st_other This member defines the symbol visibility. .\" .Bl -tag -width "STV_PROTECTED" -.RS 12 +.RS 10 .TP 16 +.PD 0 .BR STV_DEFAULT Default symbol visibility rules. .TP @@ -1581,9 +1596,10 @@ Symbol is unavailable in other modules. .TP .BR STV_PROTECTED Not preemptible, not exported. -.sp +.PD +.PP There are macros for extracting the visibility type: -.sp +.PP .BR ELF32_ST_VISIBILITY (other) or .BR ELF64_ST_VISIBILITY (other) @@ -1597,7 +1613,7 @@ in relation to some section. This member holds the relevant section header table index. .\" .El -.sp +.PP Relocation is the process of connecting symbolic references with symbolic definitions. Relocatable files must have information that @@ -1605,7 +1621,7 @@ describes how to modify their section contents, thus allowing executable and shared object files to hold the right information for a process' program image. Relocation entries are these data. -.sp +.PP Relocation structures that do not need an addend: .in +4n .nf @@ -1625,7 +1641,7 @@ typedef struct { } Elf64_Rel; .fi .in -.sp +.PP Relocation structures that need an addend: .in +4n .nf @@ -1676,7 +1692,7 @@ member. This member specifies a constant addend used to compute the value to be stored into the relocatable field. .\" .El -.sp +.PP The .dynamic section contains a series of structures that hold relevant dynamic linking information. The d_tag member controls the interpretation @@ -1708,11 +1724,11 @@ extern Elf64_Dyn _DYNAMIC[]; .fi .in .\" .Bl -tag -width "d_tag" -.TP 12 +.TP 10 .IR d_tag This member may have any of the following values: .\" .Bl -tag -width "DT_SYMBOLIC" -.RS 12 +.RS 10 .TP 12 .BR DT_NULL Marks end of dynamic section @@ -1840,13 +1856,13 @@ The ELF format is an adopted standard. .BR objdump (1), .BR execve (2), .BR core (5) -.sp +.PP Hewlett-Packard, .IR "Elf-64 Object File Format" . -.sp +.PP Santa Cruz Operation, .IR "System V Application Binary Interface" . -.sp +.PP Unix System Laboratories, "Object Files", .IR "Executable and Linking Format (ELF)" . |
