1 .\" $OpenBSD: elf.5,v 1.12 2003/10/27 20:23:58 jmc Exp $
2 .\"Copyright (c) 1999 Jeroen Ruigrok van der Werven
3 .\"All rights reserved.
5 .\" %%%LICENSE_START(PERMISSIVE_MISC)
6 .\"Redistribution and use in source and binary forms, with or without
7 .\"modification, are permitted provided that the following conditions
9 .\"1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\"2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
15 .\"THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 .\"ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 .\"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 .\"ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 .\"FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 .\"DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 .\"OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 .\"HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 .\"LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\"OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" $FreeBSD: src/share/man/man5/elf.5,v 1.21 2001/10/01 16:09:23 ru Exp $
30 .\" Slightly adapted - aeb, 2004-01-01
31 .\" 2005-07-15, Mike Frysinger <vapier@gentoo.org>, various fixes
32 .\" 2007-10-11, Mike Frysinger <vapier@gentoo.org>, various fixes
33 .\" 2007-12-08, mtk, Converted from mdoc to man macros
35 .TH ELF 5 2017-09-15 "Linux" "Linux Programmer's Manual"
37 elf \- format of Executable and Linking Format (ELF) files
40 .\" .B #include <elf_abi.h>
46 defines the format of ELF executable binary files.
47 Amongst these files are
48 normal executable files, relocatable object files, core files, and shared
51 An executable file using the ELF file format consists of an ELF header,
52 followed by a program header table or a section header table, or both.
53 The ELF header is always at offset zero of the file.
55 table and the section header table's offset in the file are defined in the
57 The two tables describe the rest of the particularities of
60 .\" Applications which wish to process ELF binary files for their native
61 .\" architecture only should include
63 .\" in their source code.
64 .\" These applications should need to refer to
65 .\" all the types and structures by their generic names
67 .\" and to the macros by
69 .\" Applications written this way can be compiled on any architecture,
70 .\" regardless of whether the host is 32-bit or 64-bit.
72 .\" Should an application need to process ELF files of an unknown
73 .\" architecture, then the application needs to explicitly use either
77 .\" type and structure names.
78 .\" Likewise, the macros need to be identified by
83 This header file describes the above mentioned headers as C structures
84 and also includes structures for dynamic sections, relocation sections and
88 The following types are used for N-bit architectures (N=32,64,
102 ElfN_Addr Unsigned program address, uintN_t
103 ElfN_Off Unsigned file offset, uintN_t
104 ElfN_Section Unsigned section index, uint16_t
105 ElfN_Versym Unsigned version symbol information, uint16_t
106 Elf_Byte unsigned char
112 .\" Elf32_Size Unsigned object size
116 (Note: the *BSD terminology is a bit different.
126 In order to avoid confusion these types are replaced by explicit ones
129 All data structures that the file format defines follow the
131 size and alignment guidelines for the relevant class.
133 data structures contain explicit padding to ensure 4-byte alignment
134 for 4-byte objects, to force structure sizes to a multiple of 4, and so on.
136 .SS ELF header (Ehdr)
137 The ELF header is described by the type
147 unsigned char e_ident[EI_NIDENT];
156 uint16_t e_phentsize;
158 uint16_t e_shentsize;
165 The fields have the following meanings:
171 This array of bytes specifies how to interpret the file,
172 independent of the processor or the file's remaining contents.
173 Within this array everything is named by macros, which start with
176 and may contain values which start with the prefix
178 The following macros are defined:
182 The first byte of the magic number.
183 It must be filled with
188 The second byte of the magic number.
189 It must be filled with
194 The third byte of the magic number.
195 It must be filled with
200 The fourth byte of the magic number.
201 It must be filled with
206 The fifth byte identifies the architecture for this binary:
211 This class is invalid.
214 This defines the 32-bit architecture.
215 It supports machines with files
216 and virtual address spaces up to 4 Gigabytes.
219 This defines the 64-bit architecture.
224 The sixth byte specifies the data encoding of the processor-specific
226 Currently, these encodings are supported:
234 Two's complement, little-endian.
237 Two's complement, big-endian.
242 The seventh byte is the version number of the ELF specification:
257 The eighth byte identifies the operating system
258 and ABI to which the object is targeted.
259 Some fields in other ELF structures have flags
260 and values that have platform-specific meanings;
261 the interpretation of those fields is determined by the value of this byte.
267 Same as ELFOSABI_SYSV
273 .\" synonym: ELFOSABI_NONE
287 .\" .BR ELFOSABI_HURD
291 .\" .BR ELFOSABI_86OPEN
292 .\" 86Open Common IA32 ABI
299 .\" .BR ELFOSABI_MONTEREY
300 .\" Monterey project ABI
325 .BR ELFOSABI_STANDALONE
326 Stand-alone (embedded) ABI
332 The ninth byte identifies the version of the ABI
333 to which the object is targeted.
334 This field is used to distinguish among incompatible versions of an ABI.
335 The interpretation of this version number
336 is dependent on the ABI identified by the
339 Applications conforming to this specification use the value 0.
343 These bytes are reserved and set to zero.
345 which read them should ignore them.
349 the future if currently unused bytes are given meanings.
350 .\" As reported by Yuri Kozlov and confirmed by Mike Frysinger, EI_BRAND is
351 .\" not in GABI (http://www.sco.com/developers/gabi/latest/ch4.eheader.html)
352 .\" It looks to be a BSDism
355 .\" Start of architecture identification.
364 This member of the structure identifies the object file type:
386 This member specifies the required architecture for an individual file.
400 Sun Microsystems SPARC
424 MIPS RS3000 (big-endian only)
429 .\" .BR EM_MIPS_RS4_BE
430 .\" MIPS RS4000 (big-endian only). Deprecated
432 .\" EM_MIPS_RS3_LE (MIPS R3000 little-endian)
440 SPARC with enhanced instruction set
456 Advanced RISC Machines
482 .\" Compaq [DEC] Alpha
485 .\" Compaq [DEC] Alpha with enhanced instruction set
490 This member identifies the file version:
503 This member gives the virtual address to which the system first transfers
504 control, thus starting the process.
505 If the file has no associated entry
506 point, this member holds zero.
509 This member holds the program header table's file offset in bytes.
511 the file has no program header table, this member holds zero.
514 This member holds the section header table's file offset in bytes.
516 file has no section header table, this member holds zero.
519 This member holds processor-specific flags associated with the file.
520 Flag names take the form EF_`machine_flag'.
521 Currently, no flags have been defined.
524 This member holds the ELF header's size in bytes.
527 This member holds the size in bytes of one entry in the file's
528 program header table; all entries are the same size.
531 This member holds the number of entries in the program header
537 gives the table's size
539 If a file has no program header,
541 holds the value zero.
543 If the number of entries in the program header table is
544 larger than or equal to
545 .\" This is a Linux extension, added in Linux 2.6.34.
547 (0xffff), this member holds
549 (0xffff) and the real number of entries in the program header table is held
552 member of the initial entry in section header table.
555 member of the initial entry contains the value zero.
559 This is defined as 0xffff, the largest number
561 can have, specifying where the actual number of program headers is assigned.
567 This member holds a sections header's size in bytes.
568 A section header is one
569 entry in the section header table; all entries are the same size.
572 This member holds the number of entries in the section header table.
578 gives the section header table's size in bytes.
579 If a file has no section
582 holds the value of zero.
584 If the number of entries in the section header table is
585 larger than or equal to
589 holds the value zero and the real number of entries in the section header
592 member of the initial entry in section header table.
595 member of the initial entry in the section header table holds
599 This member holds the section header table index of the entry associated
600 with the section name string table.
601 If the file has no section name string
602 table, this member holds the value
605 If the index of section name string table section is
606 larger than or equal to
608 (0xff00), this member holds
610 (0xffff) and the real index of the section name string table section
613 member of the initial entry in section header table.
616 member of the initial entry in section header table contains the value zero.
618 .SS Program header (Phdr)
619 An executable or shared object file's program header table is an array of
620 structures, each describing a segment or other information the system needs
621 to prepare the program for execution.
626 Program headers are meaningful only for executable and shared object files.
627 A file specifies its own program header size with the ELF header's
632 The ELF program header is described by the type
636 depending on the architecture:
668 The main difference between the 32-bit and the 64-bit program header lies
669 in the location of the
671 member in the total struct.
674 This member of the structure indicates what kind of segment this array
675 element describes or how to interpret the array element's information.
679 The array element is unused and the other members' values are undefined.
680 This lets the program header have ignored entries.
683 The array element specifies a loadable segment, described by
687 The bytes from the file are mapped to the beginning of the memory
689 If the segment's memory size
691 is larger than the file size
695 bytes are defined to hold the value 0 and to follow the segment's
697 The file size may not be larger than the memory size.
698 Loadable segment entries in the program header table appear in ascending
704 The array element specifies dynamic linking information.
707 The array element specifies the location and size of a null-terminated
708 pathname to invoke as an interpreter.
709 This segment type is meaningful
710 only for executable files (though it may occur for shared objects).
711 However it may not occur more than once in a file.
712 If it is present, it must precede any loadable segment entry.
715 The array element specifies the location of notes (ElfN_Nhdr).
718 This segment type is reserved but has unspecified semantics.
720 contain an array element of this type do not conform to the ABI.
723 The array element, if present,
724 specifies the location and size of the program header table itself,
725 both in the file and in the memory image of the program.
726 This segment type may not occur more than once in a file.
728 occur only if the program header table is part of the memory image of the
730 If it is present, it must precede any loadable segment entry.
732 .BR PT_LOPROC ", " PT_HIPROC
733 Values in the inclusive range
734 .RB [ PT_LOPROC ", " PT_HIPROC ]
735 are reserved for processor-specific semantics.
738 GNU extension which is used by the Linux kernel to control the state of the
739 stack via the flags set in the
745 This member holds the offset from the beginning of the file at which
746 the first byte of the segment resides.
749 This member holds the virtual address at which the first byte of the
750 segment resides in memory.
753 On systems for which physical addressing is relevant, this member is
754 reserved for the segment's physical address.
758 not used and must be zero.
761 This member holds the number of bytes in the file image of the segment.
765 This member holds the number of bytes in the memory image of the segment.
769 This member holds a bit mask of flags relevant to the segment:
774 An executable segment.
784 A text segment commonly has the flags
788 A data segment commonly has
795 This member holds the value to which the segments are aligned in memory
797 Loadable process segments must have congruent values for
801 modulo the page size.
802 Values of zero and one mean no alignment is required.
805 should be a positive, integral power of two, and
812 .SS Section header (Shdr)
813 A file's section header table lets one locate all the file's sections.
815 section header table is an array of
823 member gives the byte offset from the beginning of the file to the section
826 holds the number of entries the section header table contains.
828 holds the size in bytes of each entry.
830 A section header table index is a subscript into this array.
832 header table indices are reserved:
833 the initial entry and the indices between
837 The initial entry is used in ELF extensions for
842 in other cases, each field in the initial entry is set to zero.
843 An object file does not have sections for
844 these special indices:
847 This value marks an undefined, missing, irrelevant,
848 or otherwise meaningless section reference.
851 This value specifies the lower bound of the range of reserved indices.
853 .BR SHN_LOPROC ", " SHN_HIPROC
854 Values greater in the inclusive range
855 .RB [ SHN_LOPROC ", " SHN_HIPROC ]
856 are reserved for processor-specific semantics.
859 This value specifies the absolute value for the corresponding reference.
861 example, a symbol defined relative to section number
863 has an absolute value and is not affected by relocation.
866 Symbols defined relative to this section are common symbols,
867 such as FORTRAN COMMON or unallocated C external variables.
870 This value specifies the upper bound of the range of reserved indices.
872 system reserves indices between
877 The section header table does not contain entries for the
880 The section header has the following structure:
893 uint32_t sh_addralign;
910 uint64_t sh_addralign;
916 No real differences exist between the 32-bit and 64-bit section headers.
919 This member specifies the name of the section.
920 Its value is an index
921 into the section header string table section, giving the location of
922 a null-terminated string.
925 This member categorizes the section's contents and semantics.
929 This value marks the section header as inactive.
931 have an associated section.
932 Other members of the section header
933 have undefined values.
936 This section holds information defined by the program, whose
937 format and meaning are determined solely by the program.
940 This section holds a symbol table.
943 provides symbols for link editing, though it may also be used
945 As a complete symbol table, it may contain
946 many symbols unnecessary for dynamic linking.
953 This section holds a string table.
954 An object file may have multiple
955 string table sections.
958 This section holds relocation entries with explicit addends, such
961 for the 32-bit class of object files.
962 An object may have multiple
966 This section holds a symbol hash table.
967 An object participating in
968 dynamic linking must contain a symbol hash table.
970 have only one hash table.
973 This section holds information for dynamic linking.
975 have only one dynamic section.
978 This section holds notes (ElfN_Nhdr).
981 A section of this type occupies no space in the file but otherwise
984 Although this section contains no bytes, the
986 member contains the conceptual file offset.
989 This section holds relocation offsets without explicit addends, such
992 for the 32-bit class of object files.
993 An object file may have multiple
997 This section is reserved but has unspecified semantics.
1000 This section holds a minimal set of dynamic linking symbols.
1002 object file can also contain a
1006 .BR SHT_LOPROC ", " SHT_HIPROC
1007 Values in the inclusive range
1008 .RB [ SHT_LOPROC ", " SHT_HIPROC ]
1009 are reserved for processor-specific semantics.
1012 This value specifies the lower bound of the range of indices reserved for
1013 application programs.
1016 This value specifies the upper bound of the range of indices reserved for
1017 application programs.
1018 Section types between
1022 may be used by the application, without conflicting with current or future
1023 system-defined section types.
1027 Sections support one-bit flags that describe miscellaneous attributes.
1028 If a flag bit is set in
1033 Otherwise, the attribute is
1036 Undefined attributes are set to zero.
1040 This section contains data that should be writable during process
1044 This section occupies memory during process execution.
1046 sections do not reside in the memory image of an object file.
1048 attribute is off for those sections.
1051 This section contains executable machine instructions.
1054 All bits included in this mask are reserved for processor-specific
1059 If this section appears in the memory image of a process, this member
1060 holds the address at which the section's first byte should reside.
1061 Otherwise, the member contains zero.
1064 This member's value holds the byte offset from the beginning of the file
1065 to the first byte in the section.
1068 occupies no space in the file, and its
1070 member locates the conceptual placement in the file.
1073 This member holds the section's size in bytes.
1074 Unless the section type
1077 the section occupies
1082 may have a nonzero size, but it occupies no space in the file.
1085 This member holds a section header table index link, whose interpretation
1086 depends on the section type.
1089 This member holds extra information, whose interpretation depends on the
1093 Some sections have address alignment constraints.
1094 If a section holds a
1095 doubleword, the system must ensure doubleword alignment for the entire
1097 That is, the value of
1099 must be congruent to zero, modulo the value of
1101 Only zero and positive integral powers of two are allowed.
1102 The value 0 or 1 means that the section has no alignment constraints.
1105 Some sections hold a table of fixed-sized entries, such as a symbol table.
1106 For such a section, this member gives the size in bytes for each entry.
1107 This member contains zero if the section does not hold a table of
1110 Various sections hold program and control information:
1113 This section holds uninitialized data that contributes to the program's
1115 By definition, the system initializes the data with zeros
1116 when the program begins to run.
1117 This section is of type
1119 The attribute types are
1125 This section holds version control information.
1126 This section is of type
1128 No attribute types are used.
1131 This section holds initialized pointers to the C++ constructor functions.
1132 This section is of type
1134 The attribute types are
1140 This section holds initialized data that contribute to the program's
1142 This section is of type
1144 The attribute types are
1150 This section holds initialized data that contribute to the program's
1152 This section is of type
1154 The attribute types are
1160 This section holds information for symbolic debugging.
1163 This section is of type
1165 No attribute types are used.
1168 This section holds initialized pointers to the C++ destructor functions.
1169 This section is of type
1171 The attribute types are
1177 This section holds dynamic linking information.
1178 The section's attributes
1184 bit is set is processor-specific.
1185 This section is of type
1187 See the attributes above.
1190 This section holds strings needed for dynamic linking, most commonly
1191 the strings that represent the names associated with symbol table entries.
1192 This section is of type
1194 The attribute type used is
1198 This section holds the dynamic linking symbol table.
1199 This section is of type
1201 The attribute used is
1205 This section holds executable instructions that contribute to the process
1207 When a program exits normally the system arranges to
1208 execute the code in this section.
1209 This section is of type
1211 The attributes used are
1217 This section holds the version symbol table, an array of
1220 This section is of type
1221 .BR SHT_GNU_versym .
1222 The attribute type used is
1226 This section holds the version symbol definitions, a table of
1229 This section is of type
1230 .BR SHT_GNU_verdef .
1231 The attribute type used is
1235 This section holds the version symbol needed elements, a table of
1240 .BR SHT_GNU_versym .
1241 The attribute type used is
1245 This section holds the global offset table.
1246 This section is of type
1248 The attributes are processor-specific.
1251 This section holds a symbol hash table.
1252 This section is of type
1254 The attribute used is
1258 This section holds executable instructions that contribute to the process
1259 initialization code.
1260 When a program starts to run the system arranges to execute
1261 the code in this section before calling the main program entry point.
1262 This section is of type
1264 The attributes used are
1270 This section holds the pathname of a program interpreter.
1272 a loadable segment that includes the section, the section's attributes will
1276 Otherwise, that bit will be off.
1277 This section is of type
1281 This section holds line number information for symbolic debugging,
1282 which describes the correspondence between the program source and
1284 The contents are unspecified.
1285 This section is of type
1287 No attribute types are used.
1290 This section holds various notes.
1291 This section is of type
1293 No attribute types are used.
1296 This section is used to declare the expected runtime ABI of the ELF image.
1297 It may include the operating system name and its runtime versions.
1298 This section is of type
1300 The only attribute used is
1303 .IR .note.gnu.build-id
1304 This section is used to hold an ID that uniquely identifies
1305 the contents of the ELF image.
1306 Different files with the same build ID should contain the same executable
1310 option to the GNU linker (\fBld\fR (1)) for more details.
1311 This section is of type
1313 The only attribute used is
1317 This section is used in Linux object files for declaring stack attributes.
1318 This section is of type
1320 The only attribute used is
1322 This indicates to the GNU linker that the object file requires an
1325 .IR .note.openbsd.ident
1326 OpenBSD native executables usually contain this section
1327 to identify themselves so the kernel can bypass any compatibility
1328 ELF binary emulation tests when loading the file.
1331 This section holds the procedure linkage table.
1332 This section is of type
1334 The attributes are processor-specific.
1337 This section holds relocation information as described below.
1339 has a loadable segment that includes relocation, the section's attributes
1343 Otherwise, the bit will be off.
1346 is supplied by the section to which the relocations apply.
1350 normally would have the name
1352 This section is of type
1356 This section holds relocation information as described below.
1358 has a loadable segment that includes relocation, the section's attributes
1362 Otherwise, the bit will be off.
1365 is supplied by the section to which the relocations apply.
1369 normally would have the name
1371 This section is of type
1375 This section holds read-only data that typically contributes to a
1376 nonwritable segment in the process image.
1377 This section is of type
1379 The attribute used is
1383 This section holds read-only data that typically contributes to a
1384 nonwritable segment in the process image.
1385 This section is of type
1387 The attribute used is
1391 This section holds section names.
1392 This section is of type
1394 No attribute types are used.
1397 This section holds strings, most commonly the strings that represent the
1398 names associated with symbol table entries.
1399 If the file has a loadable
1400 segment that includes the symbol string table, the section's attributes
1404 Otherwise, the bit will be off.
1405 This section is of type
1409 This section holds a symbol table.
1410 If the file has a loadable segment
1411 that includes the symbol table, the section's attributes will include
1415 Otherwise, the bit will be off.
1416 This section is of type
1420 This section holds the
1422 or executable instructions, of a program.
1423 This section is of type
1425 The attributes used are
1430 .SS String and symbol tables
1431 String table sections hold null-terminated character sequences, commonly
1433 The object file uses these strings to represent symbol
1435 One references a string as an index into the string
1437 The first byte, which is index zero, is defined to hold
1438 a null byte (\(aq\\0\(aq).
1439 Similarly, a string table's last byte is defined to
1440 hold a null byte, ensuring null termination for all strings.
1442 An object file's symbol table holds information needed to locate and
1443 relocate a program's symbolic definitions and references.
1445 index is a subscript into this array.
1451 Elf32_Addr st_value;
1453 unsigned char st_info;
1454 unsigned char st_other;
1464 unsigned char st_info;
1465 unsigned char st_other;
1467 Elf64_Addr st_value;
1473 The 32-bit and 64-bit versions have the same members, just in a different
1477 This member holds an index into the object file's symbol string table,
1478 which holds character representations of the symbol names.
1480 is nonzero, it represents a string table index that gives the symbol
1482 Otherwise, the symbol has no name.
1485 This member gives the value of the associated symbol.
1488 Many symbols have associated sizes.
1489 This member holds zero if the symbol
1490 has no size or an unknown size.
1493 This member specifies the symbol's type and binding attributes:
1497 The symbol's type is not defined.
1500 The symbol is associated with a data object.
1503 The symbol is associated with a function or other executable code.
1506 The symbol is associated with a section.
1507 Symbol table entries of
1508 this type exist primarily for relocation and normally have
1513 By convention, the symbol's name gives the name of the source file
1514 associated with the object file.
1517 bindings, its section index is
1519 and it precedes the other
1521 symbols of the file, if it is present.
1523 .BR STT_LOPROC ", " STT_HIPROC
1524 Values in the inclusive range
1525 .RB [ STT_LOPROC ", " STT_HIPROC ]
1526 are reserved for processor-specific semantics.
1529 Local symbols are not visible outside the object file containing their
1531 Local symbols of the same name may exist in multiple files
1532 without interfering with each other.
1535 Global symbols are visible to all object files being combined.
1537 definition of a global symbol will satisfy another file's undefined
1538 reference to the same symbol.
1541 Weak symbols resemble global symbols, but their definitions have lower
1544 .BR STB_LOPROC ", " STB_HIPROC
1545 Values in the inclusive range
1546 .RB [ STB_LOPROC ", " STB_HIPROC ]
1547 are reserved for processor-specific semantics.
1550 There are macros for packing and unpacking the binding and type fields:
1553 .BR ELF32_ST_BIND( \fIinfo\fP ) ", " ELF64_ST_BIND( \fIinfo\fP )
1554 Extract a binding from an
1558 .BR ELF32_ST_TYPE( \fIinfo ) ", " ELF64_ST_TYPE( \fIinfo\fP )
1559 Extract a type from an
1563 .BR ELF32_ST_INFO( \fIbind\fP ", " \fItype\fP ) ", " \
1564 ELF64_ST_INFO( \fIbind\fP ", " \fItype\fP )
1565 Convert a binding and a type into an
1571 This member defines the symbol visibility.
1576 Default symbol visibility rules.
1577 Global and weak symbols are available to other modules;
1578 references in the local module can be interposed
1579 by definitions in other modules.
1582 Processor-specific hidden class.
1585 Symbol is unavailable to other modules;
1586 references in the local module always resolve to the local symbol
1587 (i.e., the symbol can't be interposed by definitions in other modules).
1590 Symbol is available to other modules,
1591 but references in the local module always resolve to the local symbol.
1594 There are macros for extracting the visibility type:
1596 .BR ELF32_ST_VISIBILITY (other)
1598 .BR ELF64_ST_VISIBILITY (other)
1602 Every symbol table entry is
1604 in relation to some section.
1605 This member holds the relevant section
1608 .SS Relocation entries (Rel & Rela)
1609 Relocation is the process of connecting symbolic references with
1610 symbolic definitions.
1611 Relocatable files must have information that
1612 describes how to modify their section contents, thus allowing executable
1613 and shared object files to hold the right information for a process's
1615 Relocation entries are these data.
1617 Relocation structures that do not need an addend:
1622 Elf32_Addr r_offset;
1631 Elf64_Addr r_offset;
1637 Relocation structures that need an addend:
1642 Elf32_Addr r_offset;
1652 Elf64_Addr r_offset;
1660 This member gives the location at which to apply the relocation action.
1661 For a relocatable file, the value is the byte offset from the beginning
1662 of the section to the storage unit affected by the relocation.
1664 executable file or shared object, the value is the virtual address of
1665 the storage unit affected by the relocation.
1668 This member gives both the symbol table index with respect to which the
1669 relocation must be made and the type of relocation to apply.
1671 types are processor-specific.
1672 When the text refers to a relocation
1673 entry's relocation type or symbol table index, it means the result of
1675 .BR ELF[32|64]_R_TYPE
1677 .BR ELF[32|64]_R_SYM ,
1678 respectively, to the entry's
1683 This member specifies a constant addend used to compute the value to be
1684 stored into the relocatable field.
1686 .SS Dynamic tags (Dyn)
1689 section contains a series of structures that hold relevant
1690 dynamic linking information.
1693 member controls the interpretation
1706 extern Elf32_Dyn _DYNAMIC[];
1719 extern Elf64_Dyn _DYNAMIC[];
1724 This member may have any of the following values:
1728 Marks end of dynamic section
1731 String table offset to name of a needed library
1734 Size in bytes of PLT relocation entries
1737 Address of PLT and/or GOT
1740 Address of symbol hash table
1743 Address of string table
1746 Address of symbol table
1749 Address of Rela relocation table
1752 Size in bytes of the Rela relocation table
1755 Size in bytes of a Rela relocation table entry
1758 Size in bytes of string table
1761 Size in bytes of a symbol table entry
1764 Address of the initialization function
1767 Address of the termination function
1770 String table offset to name of shared object
1773 String table offset to library search path (deprecated)
1776 Alert linker to search this shared object before the executable for symbols
1779 Address of Rel relocation table
1782 Size in bytes of Rel relocation table
1785 Size in bytes of a Rel table entry
1788 Type of relocation entry to which the PLT refers (Rela or Rel)
1791 Undefined use for debugging
1794 Absence of this entry indicates that no relocation entries should
1795 apply to a nonwritable segment
1798 Address of relocation entries associated solely with the PLT
1801 Instruct dynamic linker to process all relocations before
1802 transferring control to the executable
1805 String table offset to library search path
1807 .BR DT_LOPROC ", " DT_HIPROC
1808 Values in the inclusive range
1809 .RB [ DT_LOPROC ", " DT_HIPROC ]
1810 are reserved for processor-specific semantics
1814 This member represents integer values with various interpretations.
1817 This member represents program virtual addresses.
1819 these addresses, the actual address should be computed based on the
1820 original file value and memory base address.
1821 Files do not contain
1822 relocation entries to fixup these addresses.
1825 Array containing all the dynamic structures in the
1828 This is automatically populated by the linker.
1829 .\" GABI ELF Reference for Note Sections:
1830 .\" http://www.sco.com/developers/gabi/latest/ch5.pheader.html#note_section
1832 .\" Note that it implies the sizes and alignments of notes depend on the ELF
1833 .\" size (e.g. 32-bit ELFs have three 4-byte words and use 4-byte alignment
1834 .\" while 64-bit ELFs use 8-byte words & alignment), but that is not the case
1835 .\" in the real world. Notes always have three 4-byte words as can be seen
1836 .\" in the source links below (remember that Elf64_Word is a 32-bit quantity).
1837 .\" glibc: https://sourceware.org/git/?p=glibc.git;a=blob;f=elf/elf.h;h=9e59b3275917549af0cebe1f2de9ded3b7b10bf2#l1173
1838 .\" binutils: https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=binutils/readelf.c;h=274ddd17266aef6e4ad1f67af8a13a21500ff2af#l15943
1839 .\" Linux: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/elf.h?h=v4.8#n422
1840 .\" Solaris: https://docs.oracle.com/cd/E23824_01/html/819-0690/chapter6-18048.html
1841 .\" FreeBSD: https://svnweb.freebsd.org/base/head/sys/sys/elf_common.h?revision=303677&view=markup#l33
1842 .\" NetBSD: https://www.netbsd.org/docs/kernel/elf-notes.html
1843 .\" OpenBSD: https://github.com/openbsd/src/blob/master/sys/sys/exec_elf.h#L533
1846 ELF notes allow for appending arbitrary information for the system to use.
1847 They are largely used by core files
1851 but many projects define their own set of extensions.
1853 the GNU tool chain uses ELF notes to pass information from
1854 the linker to the C library.
1856 Note sections contain a series of notes (see the
1859 Each note is followed by the name field (whose length is defined in
1860 \fIn_namesz\fR) and then by the descriptor field (whose length is defined in
1861 \fIn_descsz\fR) and whose starting address has a 4 byte alignment.
1862 Neither field is defined in the note struct due to their arbitrary lengths.
1864 An example for parsing out two consecutive notes should clarify their layout
1869 void *memory, *name, *desc;
1870 Elf64_Nhdr *note, *next_note;
1872 /* The buffer is pointing to the start of the section/segment */
1875 /* If the name is defined, it follows the note */
1876 name = note->n_namesz == 0 ? NULL : memory + sizeof(*note);
1878 /* If the descriptor is defined, it follows the name
1881 desc = note->n_descsz == 0 ? NULL :
1882 memory + sizeof(*note) + ALIGN_UP(note->n_namesz, 4);
1884 /* The next note follows both (with alignment) */
1885 next_note = memory + sizeof(*note) +
1886 ALIGN_UP(note->n_namesz, 4) +
1887 ALIGN_UP(note->n_descsz, 4);
1891 Keep in mind that the interpretation of
1893 depends on the namespace defined by the
1898 field is not set (e.g., is 0), then there are two sets of notes:
1899 one for core files and one for all other ELF types.
1900 If the namespace is unknown, then tools will usually fallback to these sets
1906 Elf32_Word n_namesz;
1907 Elf32_Word n_descsz;
1916 Elf64_Word n_namesz;
1917 Elf64_Word n_descsz;
1924 The length of the name field in bytes.
1925 The contents will immediately follow this note in memory.
1926 The name is null terminated.
1927 For example, if the name is "GNU", then
1932 The length of the descriptor field in bytes.
1933 The contents will immediately follow the name field in memory.
1936 Depending on the value of the name field, this member may have any of the
1940 .B Core files (e_type = ET_CORE)
1941 Notes used by all core files.
1942 These are highly operating system or architecture specific and often require
1943 close coordination with kernels, C libraries, and debuggers.
1944 These are used when the namespace is the default (i.e.,
1946 will be set to 0), or a fallback when the namespace is unknown.
1966 String from sysinfo(SI_PLATFORM)
1999 siginfo_t (size might increase over time)
2002 Contains information about mapped files
2008 PowerPC Altivec/VMX registers
2011 PowerPC SPE/EVR registers
2014 PowerPC VSX registers
2017 i386 TLS slots (struct user_desc)
2020 x86 io permission bitmap (1=deny)
2023 x86 extended state using xsave
2025 .B NT_S390_HIGH_GPRS
2026 s390 upper register halves
2032 s390 time-of-day (TOD) clock comparator register
2035 s390 time-of-day (TOD) programmable register
2038 s390 control registers
2041 s390 prefix register
2043 .B NT_S390_LAST_BREAK
2044 s390 breaking event address
2046 .B NT_S390_SYSTEM_CALL
2047 s390 system call restart data
2050 s390 transaction diagnostic block
2053 ARM VFP/NEON registers
2059 ARM hardware breakpoint registers
2062 ARM hardware watchpoint registers
2064 .B NT_ARM_SYSTEM_CALL
2065 ARM system call number
2070 Extensions used by the GNU tool chain.
2074 Operating system (OS) ABI information.
2075 The desc field will be 4 words:
2080 word 0: OS descriptor
2081 (\fBELF_NOTE_OS_LINUX\fR, \fBELF_NOTE_OS_GNU\fR, and so on)`
2083 word 1: major version of the ABI
2085 word 2: minor version of the ABI
2087 word 3: subminor version of the ABI
2092 Synthetic hwcap information.
2093 The desc field begins with two words:
2098 word 0: number of entries
2100 word 1: bit mask of enabled entries
2104 Then follow variable-length entries, one byte followed by a null-terminated
2106 The byte gives the bit number to test if enabled, (1U << bit) & bit mask.
2109 Unique build ID as generated by the GNU
2113 The desc consists of any nonzero number of bytes.
2115 .B NT_GNU_GOLD_VERSION
2116 The desc contains the GNU Gold linker version used.
2119 .B Default/unknown namespace (e_type != ET_CORE)
2120 These are used when the namespace is the default (i.e.,
2122 will be set to 0), or a fallback when the namespace is unknown.
2127 A version string of some sort.
2130 Architecture information.
2137 .\" ELF support first appeared in
2139 .\" although not all supported platforms use it as the native
2140 .\" binary file format.
2141 ELF first appeared in
2143 The ELF format is an adopted standard.
2152 Sun, BSD and AMD64 also support them; for further information,
2153 look under SEE ALSO.
2155 .\" The original version of this manual page was written by
2156 .\" .An Jeroen Ruigrok van der Werven
2157 .\" .Aq asmodai@FreeBSD.org
2158 .\" with inspiration from BSDi's
2174 .BR dl_iterate_phdr (3),
2178 .IR "Elf-64 Object File Format" .
2180 Santa Cruz Operation,
2181 .IR "System V Application Binary Interface" .
2183 UNIX System Laboratories,
2185 .IR "Executable and Linking Format (ELF)" .
2188 .IR "Linker and Libraries Guide" .
2191 .IR "System V Application Binary Interface AMD64 Architecture Processor Supplement" .