1 .\" Copyright (c) 1999 Jeroen Ruigrok van der Werven
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .Nd format of ELF executable binary files
38 defines the format of ELF executable binary files.
39 Amongst these files are
40 normal executable files, relocatable object files, core files and shared
43 An executable file using the ELF file format consists of an ELF header,
44 followed by a program header table or a section header table, or both.
45 The ELF header is always at offset zero of the file.
47 table and the section header table's offset in the file are defined in the
49 The two tables describe the rest of the particularities of
52 Applications which wish to process ELF binary files for their native
53 architecture only should include
56 These applications should need to refer to
57 all the types and structures by their generic names
61 Applications written this way can be compiled on any architecture,
62 regardless whether the host is 32-bit or 64-bit.
64 Should an application need to process ELF files of an unknown
65 architecture then the application needs to include both
71 Furthermore, all types and structures need to be identified by either
75 The macros need to be identified by
80 Whatever the system's architecture is, it will always include
83 .In sys/elf_generic.h .
85 These header files describe the above mentioned headers as C structures
86 and also include structures for dynamic sections, relocation sections and
89 The following types are being used for 32-bit architectures:
90 .Bd -literal -offset indent
91 Elf32_Addr Unsigned 32-bit program address
92 Elf32_Half Unsigned 16-bit field
93 Elf32_Lword Unsigned 64-bit field
94 Elf32_Off Unsigned 32-bit file offset
95 Elf32_Sword Signed 32-bit field or integer
96 Elf32_Word Unsigned 32-bit field or integer
99 For 64-bit architectures we have the following types:
100 .Bd -literal -offset indent
101 Elf64_Addr Unsigned 64-bit program address
102 Elf64_Half Unsigned 16-bit field
103 Elf64_Lword Unsigned 64-bit field
104 Elf64_Off Unsigned 64-bit file offset
105 Elf64_Sword Signed 32-bit field
106 Elf64_Sxword Signed 64-bit field or integer
107 Elf64_Word Unsigned 32-bit field
108 Elf64_Xword Unsigned 64-bit field or integer
111 All data structures that the file format defines follow the
113 size and alignment guidelines for the relevant class.
115 data structures contain explicit padding to ensure 4-byte alignment
116 for 4-byte objects, to force structure sizes to a multiple of 4, etc.
118 The ELF header is described by the type Elf32_Ehdr or Elf64_Ehdr:
119 .Bd -literal -offset indent
121 unsigned char e_ident[EI_NIDENT];
123 Elf32_Half e_machine;
124 Elf32_Word e_version;
130 Elf32_Half e_phentsize;
132 Elf32_Half e_shentsize;
134 Elf32_Half e_shstrndx;
137 .Bd -literal -offset indent
139 unsigned char e_ident[EI_NIDENT];
141 Elf64_Half e_machine;
142 Elf64_Word e_version;
148 Elf64_Half e_phentsize;
150 Elf64_Half e_shentsize;
152 Elf64_Half e_shstrndx;
156 The fields have the following meanings:
158 .Bl -tag -width "e_phentsize" -compact -offset indent
160 This array of bytes specifies to interpret the file,
161 independent of the processor or the file's remaining contents.
162 Within this array everything is named by macros, which start with
165 and may contain values which start with the prefix
167 The following macros are defined:
169 .Bl -tag -width "EI_ABIVERSION" -compact
171 The first byte of the magic number.
172 It must be filled with
175 The second byte of the magic number.
176 It must be filled with
179 The third byte of the magic number.
180 It must be filled with
183 The fourth byte of the magic number.
184 It must be filled with
187 The fifth byte identifies the architecture for this binary:
189 .Bl -tag -width "ELFCLASSNONE" -compact
191 This class is invalid.
193 This defines the 32-bit architecture.
194 It supports machines with files
195 and virtual address spaces up to 4 Gigabytes.
197 This defines the 64-bit architecture.
200 The sixth byte specifies the data encoding of the processor-specific
202 Currently these encodings are supported:
204 .Bl -tag -width "ELFDATA2LSB" -compact
208 Two's complement, little-endian.
210 Two's complement, big-endian.
213 The version number of the ELF specification:
215 .Bl -tag -width "EV_CURRENT" -compact
222 This byte identifies the operating system
223 and ABI to which the object is targeted.
224 Some fields in other ELF structures have flags
225 and values that have platform specific meanings;
226 the interpretation of those fields is determined by the value of this byte.
227 The following values are currently defined:
229 .Bl -tag -width "ELFOSABI_STANDALONE" -compact
233 HP-UX operating system ABI.
234 .It Dv ELFOSABI_NETBSD
236 operating system ABI.
237 .It Dv ELFOSABI_LINUX
238 GNU/Linux operating system ABI.
240 GNU/Hurd operating system ABI.
241 .It Dv ELFOSABI_86OPEN
242 86Open Common IA32 ABI.
243 .It Dv ELFOSABI_SOLARIS
244 Solaris operating system ABI.
245 .It Dv ELFOSABI_MONTEREY
246 Monterey project ABI.
248 IRIX operating system ABI.
249 .It Dv ELFOSABI_FREEBSD
251 operating system ABI.
252 .It Dv ELFOSABI_TRU64
253 TRU64 UNIX operating system ABI.
255 ARM architecture ABI.
256 .It Dv ELFOSABI_STANDALONE
257 Standalone (embedded) ABI.
260 This byte identifies the version of the ABI
261 to which the object is targeted.
262 This field is used to distinguish among incompatible versions of an ABI.
263 The interpretation of this version number
264 is dependent on the ABI identified by the EI_OSABI field.
265 Applications conforming to this specification use the value 0.
268 These bytes are reserved and set to zero.
270 which read them should ignore them.
271 The value for EI_PAD will change in
272 the future if currently unused bytes are given meanings.
274 Start of architecture identification.
276 The size of the e_ident array.
280 This member of the structure identifies the object file type:
282 .Bl -tag -width "ET_NONE" -compact
296 This member specifies the required architecture for an individual file:
298 .Bl -tag -width "EM_MIPS_RS4_BE" -compact
304 Sun Microsystems SPARC.
316 MIPS RS3000 (big-endian only).
317 .It Dv EM_MIPS_RS4_BE
318 MIPS RS4000 (big-endian only).
320 SPARC v9 64-bit unofficial.
330 This member identifies the file version:
332 .Bl -tag -width "EV_CURRENT" -compact
339 This member gives the virtual address to which the system first transfers
340 control, thus starting the process.
341 If the file has no associated entry
342 point, this member holds zero.
344 This member holds the program header table's file offset in bytes.
346 the file has no program header table, this member holds zero.
348 This member holds the section header table's file offset in bytes.
350 file has no section header table this member holds zero.
352 This member holds processor-specific flags associated with the file.
354 names take the form EF_`machine_flag'.
355 Currently no flags have been defined.
357 This member holds the ELF header's size in bytes.
359 This member holds the size in bytes of one entry in the file's program header
360 table; all entries are the same size.
362 This member holds the number of entries in the program header
364 If the file is using extended program header numbering, then the
366 member will contain the value
368 and the actual number of program header table entries will be stored
371 member of the section header at index
375 and the number of program header table entries gives the program
376 header table's size in bytes.
377 If a file has no program header,
379 holds the value zero.
381 This member holds a sections header's size in bytes.
382 A section header is one
383 entry in the section header table; all entries are the same size.
385 This member holds the number of entries in the section header table.
386 If the file is using extended section numbering, then the
388 member will be zero and the actual section number will be stored in the
390 member of the section header at index
392 If a file has no section header table, both the
396 fields of the ELF header will be zero.
399 and the number of sections in the file gives the section header
400 table's size in bytes.
402 This member holds the section header table index of the entry associated
403 with the section name string table.
404 If extended section numbering is being used, this field will hold the
407 and the actual section header table index will be present in the
409 field of the section header entry at index
411 If the file has no section name string
412 table, this member holds the value
416 An executable or shared object file's program header table is an array of
417 structures, each describing a segment or other information the system needs
418 to prepare the program for execution.
423 Program headers are meaningful only for executable and shared object files.
424 A file specifies its own program header size with the ELF header's
429 As with the Elf executable header, the program header
430 also has different versions depending on the architecture:
431 .Bd -literal -offset indent
443 .Bd -literal -offset indent
450 Elf64_Xword p_filesz;
456 The main difference between the 32-bit and the 64-bit program header lies
457 only in the location of a
459 member in the total struct.
461 .Bl -tag -width "p_offset" -compact -offset indent
463 This member of the Phdr struct tells what kind of segment this array
464 element describes or how to interpret the array element's information.
466 .Bl -tag -width "PT_DYNAMIC" -compact
468 The array element is unused and the other members' values are undefined.
469 This lets the program header have ignored entries.
471 The array element specifies a loadable segment, described by
475 The bytes from the file are mapped to the beginning of the memory
477 If the segment's memory size
479 is larger than the file size
483 bytes are defined to hold the value 0 and to follow the segment's
485 The file size may not be larger than the memory size.
486 Loadable segment entries in the program header table appear in ascending
491 The array element specifies dynamic linking information.
493 The array element specifies the location and size of a null-terminated
494 path name to invoke as an interpreter.
495 This segment type is meaningful
496 only for executable files (though it may occur for shared objects).
498 it may not occur more than once in a file.
499 If it is present it must precede
500 any loadable segment entry.
502 The array element specifies the location and size for auxiliary information.
504 This segment type is reserved but has unspecified semantics.
506 contain an array element of this type do not conform to the ABI.
508 The array element, if present, specifies the location and size of the program
509 header table itself, both in the file and in the memory image of the program.
510 This segment type may not occur more than once in a file.
512 only occur if the program header table is part of the memory image of the
514 If it is present it must precede any loadable segment entry.
516 This value up to and including
518 are reserved for processor-specific semantics.
520 This value down to and including
522 are reserved for processor-specific semantics.
526 This member holds the offset from the beginning of the file at which
527 the first byte of the segment resides.
529 This member holds the virtual address at which the first byte of the
530 segment resides in memory.
532 On systems for which physical addressing is relevant, this member is
533 reserved for the segment's physical address.
537 not used and must be zero.
539 This member holds the number of bytes in the file image of the segment.
542 This member holds the number of bytes in the memory image of the segment.
545 This member holds flags relevant to the segment:
547 .Bl -tag -width "PF_X" -compact
549 An executable segment.
556 A text segment commonly has the flags
560 A data segment commonly has
566 This member holds the value to which the segments are aligned in memory
568 Loadable process segments must have congruent values for
572 modulo the page size.
573 Values of zero and one mean no alignment is required.
576 should be a positive, integral power of two, and
584 An file's section header table lets one locate all the file's sections.
586 section header table is an array of Elf32_Shdr or Elf64_Shdr structures.
590 member gives the byte offset from the beginning of the file to the section
593 holds the number of entries the section header table contains.
595 holds the size in bytes of each entry.
597 A section header table index is a subscript into this array.
599 header table indices are reserved.
600 An object file does not have sections for
601 these special indices:
603 .Bl -tag -width "SHN_LORESERVE" -compact
605 This value marks an undefined, missing, irrelevant, or otherwise meaningless
607 For example, a symbol
609 relative to section number
611 is an undefined symbol.
613 This value specifies the lower bound of the range of reserved indices.
615 This value up to and including
617 are reserved for processor-specific semantics.
619 This value down to and including
621 are reserved for processor-specific semantics.
623 This value specifies absolute values for the corresponding reference.
625 example, symbols defined relative to section number
627 have absolute values and are not affected by relocation.
629 Symbols defined relative to this section are common symbols, such as FORTRAN
630 COMMON or unallocated C external variables.
632 This value specifies the upper bound of the range of reserved indices.
634 system reserves indices between
639 The section header table does not contain entries for the
643 The section header has the following structure:
644 .Bd -literal -offset indent
654 Elf32_Word sh_addralign;
655 Elf32_Word sh_entsize;
658 .Bd -literal -offset indent
662 Elf64_Xword sh_flags;
668 Elf64_Xword sh_addralign;
669 Elf64_Xword sh_entsize;
673 .Bl -tag -width "sh_addralign" -compact
675 This member specifies the name of the section.
676 Its value is an index
677 into the section header string table section, giving the location of
678 a null-terminated string.
680 This member categorizes the section's contents and semantics.
682 .Bl -tag -width "SHT_PROGBITS" -compact
684 This value marks the section header as inactive.
686 have an associated section.
687 Other members of the section header
688 have undefined values.
690 The section holds information defined by the program, whose
691 format and meaning are determined solely by the program.
693 This section holds a symbol table.
696 provides symbols for link editing, though it may also be used
698 As a complete symbol table, it may contain
699 many symbols unnecessary for dynamic linking.
705 This section holds a string table.
706 An object file may have multiple
707 string table sections.
709 This section holds relocation entries with explicit addends, such
712 for the 32-bit class of object files.
713 An object may have multiple
716 This section holds a symbol hash table.
717 All object participating in
718 dynamic linking must contain a symbol hash table.
720 have only one hash table.
722 This section holds information for dynamic linking.
724 have only one dynamic section.
726 This section holds information that marks the file in some way.
728 A section of this type occupies no space in the file but otherwise
731 Although this section contains no bytes, the
733 member contains the conceptual file offset.
735 This section holds relocation offsets without explicit addends, such
738 for the 32-bit class of object files.
739 An object file may have multiple
742 This section is reserved but has unspecified semantics.
744 This section holds a minimal set of dynamic linking symbols.
746 object file can also contain a
750 This value up to and including
752 are reserved for processor-specific semantics.
754 This value down to and including
756 are reserved for processor-specific semantics.
758 This value specifies the lower bound of the range of indices reserved for
759 application programs.
761 This value specifies the upper bound of the range of indices reserved for
762 application programs.
763 Section types between
767 may be used by the application, without conflicting with current or future
768 system-defined section types.
772 Sections support one-bit flags that describe miscellaneous attributes.
773 If a flag bit is set in
778 Otherwise, the attribute is
781 Undefined attributes are set to zero.
783 .Bl -tag -width "SHF_EXECINSTR" -compact
785 This section contains data that should be writable during process
788 The section occupies memory during process execution.
790 sections do not reside in the memory image of an object file.
792 attribute is off for those sections.
794 The section contains executable machine instructions.
796 All bits included in this mask are reserved for processor-specific
798 .It Dv SHF_COMPRESSED
799 The section data is compressed.
803 If the section will appear in the memory image of a process, this member
804 holds the address at which the section's first byte should reside.
805 Otherwise, the member contains zero.
807 This member's value holds the byte offset from the beginning of the file
808 to the first byte in the section.
811 occupies no space in the file, and its
813 member locates the conceptual placement in the file.
815 This member holds the section's size in bytes.
816 Unless the section type
824 may have a non-zero size, but it occupies no space in the file.
826 This member holds a section header table index link, whose interpretation
827 depends on the section type.
829 This member holds extra information, whose interpretation depends on the
832 Some sections have address alignment constraints.
834 doubleword, the system must ensure doubleword alignment for the entire
836 That is, the value of
838 must be congruent to zero, modulo the value of
840 Only zero and positive integral powers of two are allowed.
842 or one mean the section has no alignment constraints.
844 Some sections hold a table of fixed-sized entries, such as a symbol table.
845 For such a section, this member gives the size in bytes for each entry.
846 This member contains zero if the section does not hold a table of
850 Various sections hold program and control information:
851 .Bl -tag -width ".shstrtab" -compact
853 (Block Started by Symbol)
854 This section holds uninitialized data that contributes to the program's
856 By definition, the system initializes the data with zeros
857 when the program begins to run.
858 This section is of type
860 The attributes types are
865 This section holds version control information.
866 This section is of type
868 No attribute types are used.
870 This section holds initialized data that contribute to the program's
872 This section is of type
874 The attribute types are
879 This section holds initialized data that contribute to the program's
881 This section is of type
883 The attribute types are
888 This section holds information for symbolic debugging.
891 This section is of type
893 No attribute types are used.
895 This section holds dynamic linking information.
896 The section's attributes
902 bit is set is processor-specific.
903 This section is of type
905 See the attributes above.
907 This section holds strings needed for dynamic linking, most commonly
908 the strings that represent the names associated with symbol table entries.
909 This section is of type
911 The attribute type used is
914 This section holds the dynamic linking symbol table.
915 This section is of type
917 The attribute used is
920 This section holds executable instructions that contribute to the process
922 When a program exits normally the system arranges to
923 execute the code in this section.
924 This section is of type
926 The attributes used are
931 This section holds the global offset table.
932 This section is of type
934 The attributes are processor-specific.
936 This section holds a symbol hash table.
937 This section is of type
939 The attribute used is
942 This section holds executable instructions that contribute to the process
944 When a program starts to run the system arranges to
945 execute the code in this section before calling the main program entry point.
946 This section is of type
948 The attributes used are
953 This section holds the pathname of a program interpreter.
955 a loadable segment that includes the section, the section's attributes will
959 Otherwise, that bit will be off.
960 This section is of type
963 This section holds line number information for symbolic debugging, which
964 describes the correspondence between the program source and the machine code.
965 The contents are unspecified.
966 This section is of type
968 No attribute types are used.
970 This section holds information in the
972 format described below.
973 This section is of type
975 No attribute types are used.
977 This section holds the procedure linkage table.
978 This section is of type
980 The attributes are processor-specific.
982 This section holds relocation information as described below.
984 has a loadable segment that includes relocation, the section's attributes
988 Otherwise the bit will be off.
991 is supplied by the section to which the relocations apply.
995 normally would have the name
997 This section is of type
1000 This section holds relocation information as described below.
1002 has a loadable segment that includes relocation, the section's attributes
1006 Otherwise the bit will be off.
1009 is supplied by the section to which the relocations apply.
1013 normally would have the name
1015 This section is of type
1018 This section holds read-only data that typically contributes to a
1019 non-writable segment in the process image.
1020 This section is of type
1022 The attribute used is
1025 This section hold read-only data that typically contributes to a
1026 non-writable segment in the process image.
1027 This section is of type
1029 The attribute used is
1032 This section holds section names.
1033 This section is of type
1035 No attribute types are used.
1037 This section holds strings, most commonly the strings that represent the
1038 names associated with symbol table entries.
1039 If the file has a loadable
1040 segment that includes the symbol string table, the section's attributes
1044 Otherwise the bit will be off.
1045 This section is of type
1048 This section holds a symbol table.
1049 If the file has a loadable segment
1050 that includes the symbol table, the section's attributes will include
1054 Otherwise the bit will be off.
1055 This section is of type
1058 This section holds the
1060 or executable instructions, of a program.
1061 This section is of type
1063 The attributes used are
1068 This section holds information about Java classes that must
1071 This section holds information used for C++ exception-handling.
1076 flag set contains a compressed copy of the section data.
1077 Compressed section data begins with an
1080 .Vt Elf32_Chdr structure
1081 which encodes the compression algorithm and some characteristics of the
1083 .Bd -literal -offset indent
1087 Elf32_Word ch_addralign;
1090 .Bd -literal -offset indent
1093 Elf64_Word ch_reserved;
1094 Elf64_Xword ch_size;
1095 Elf64_Xword ch_addralign;
1099 .Bl -tag -width "ch_addralign" -compact
1101 The compression algorithm used.
1103 .Dv ELFCOMPRESS_ZLIB
1104 indicates that the data is compressed using
1107 .Dv ELFCOMPRESS_ZSTD
1108 indicates that the data is compressed using
1111 The size, in bytes, of the uncompressed section data.
1112 This corresponds to the
1114 field of a section header containing uncompressed data.
1116 The address alignment of the uncompressed section data.
1117 This corresponds to the
1119 field of a section header containing uncompressed data.
1122 String table sections hold null-terminated character sequences, commonly
1124 The object file uses these strings to represent symbol
1126 One references a string as an index into the string
1128 The first byte, which is index zero, is defined to hold
1130 Similarly, a string table's last byte is defined to
1131 hold a null character, ensuring null termination for all strings.
1133 An object file's symbol table holds information needed to locate and
1134 relocate a program's symbolic definitions and references.
1136 index is a subscript into this array.
1137 .Bd -literal -offset indent
1140 Elf32_Addr st_value;
1142 unsigned char st_info;
1143 unsigned char st_other;
1144 Elf32_Half st_shndx;
1147 .Bd -literal -offset indent
1150 unsigned char st_info;
1151 unsigned char st_other;
1152 Elf64_Half st_shndx;
1153 Elf64_Addr st_value;
1154 Elf64_Xword st_size;
1158 .Bl -tag -width "st_value" -compact
1160 This member holds an index into the object file's symbol string table,
1161 which holds character representations of the symbol names.
1163 is non-zero, it represents a string table index that gives the symbol
1165 Otherwise, the symbol table has no name.
1167 This member gives the value of the associated symbol.
1169 Many symbols have associated sizes.
1170 This member holds zero if the symbol
1171 has no size or an unknown size.
1173 This member specifies the symbol's type and binding attributes:
1175 .Bl -tag -width "STT_SECTION" -compact
1177 The symbol's type is not defined.
1179 The symbol is associated with a data object.
1181 The symbol is associated with a function or other executable code.
1183 The symbol is associated with a section.
1184 Symbol table entries of
1185 this type exist primarily for relocation and normally have
1189 By convention the symbol's name gives the name of the source file
1190 associated with the object file.
1193 bindings, its section index is
1195 and it precedes the other
1197 symbols of the file, if it is present.
1199 This value up to and including
1201 are reserved for processor-specific semantics.
1203 This value down to and including
1205 are reserved for processor-specific semantics.
1208 .Bl -tag -width "STB_GLOBAL" -compact
1210 Local symbols are not visible outside the object file containing their
1212 Local symbols of the same name may exist in multiple file
1213 without interfering with each other.
1215 Global symbols are visible to all object files being combined.
1217 definition of a global symbol will satisfy another file's undefined
1218 reference to the same symbol.
1220 Weak symbols resemble global symbols, but their definitions have lower
1223 This value up to and including
1225 are reserved for processor-specific semantics.
1227 This value down to and including
1229 are reserved for processor-specific semantics.
1231 There are macros for packing and unpacking the binding and type fields:
1233 .Bl -tag -width "ELF32_ST_INFO(bind, type)" -compact
1235 .Fn ELF32_ST_BIND info
1238 .Fn ELF64_ST_BIND info
1239 extract a binding from an st_info value.
1241 .Fn ELF64_ST_TYPE info
1244 .Fn ELF32_ST_TYPE info
1245 extract a type from an st_info value.
1247 .Fn ELF32_ST_INFO bind type
1250 .Fn ELF64_ST_INFO bind type
1251 convert a binding and a type into an st_info value.
1256 This member currently holds zero and has no defined meaning.
1258 Every symbol table entry is
1260 in relation to some section.
1261 This member holds the relevant section
1265 Relocation is the process of connecting symbolic references with
1266 symbolic definitions.
1267 Relocatable files must have information that
1268 describes how to modify their section contents, thus allowing executable
1269 and shared object files to hold the right information for a process'
1271 Relocation entries are these data.
1273 Relocation structures that do not need an addend:
1274 .Bd -literal -offset indent
1276 Elf32_Addr r_offset;
1280 .Bd -literal -offset indent
1282 Elf64_Addr r_offset;
1287 Relocation structures that need an addend:
1288 .Bd -literal -offset indent
1290 Elf32_Addr r_offset;
1292 Elf32_Sword r_addend;
1295 .Bd -literal -offset indent
1297 Elf64_Addr r_offset;
1299 Elf64_Sxword r_addend;
1303 .Bl -tag -width "r_offset" -compact
1305 This member gives the location at which to apply the relocation action.
1306 For a relocatable file, the value is the byte offset from the beginning
1307 of the section to the storage unit affected by the relocation.
1309 executable file or shared object, the value is the virtual address of
1310 the storage unit affected by the relocation.
1312 This member gives both the symbol table index with respect to which the
1313 relocation must be made and the type of relocation to apply.
1315 types are processor-specific.
1316 When the text refers to a relocation
1317 entry's relocation type or symbol table index, it means the result of
1319 .Sy ELF_[32|64]_R_TYPE
1321 .Sy ELF[32|64]_R_SYM ,
1322 respectively to the entry's
1326 This member specifies a constant addend used to compute the value to be
1327 stored into the relocatable field.
1330 ELF note sections consist of entries with the following format:
1331 .Bl -column -offset indent "namesz" "32 bits" "Null-terminated originator name"
1332 .Sy Field Ta Sy Size Ta Sy Description
1333 .It Va namesz Ta 32 bits Ta Size of "name"
1334 .It Va descsz Ta 32 bits Ta Size of "desc"
1335 .It Va type Ta 32 bits Ta OS-dependent note type
1336 .It Va name Ta Va namesz Ta Null-terminated originator name
1337 .It Va desc Ta Va descsz Ta OS-dependent note data
1344 fields are padded to ensure 4-byte alignemnt.
1348 specify the unpadded length.
1351 defines the following ELF note types
1352 .Po with corresponding interpretation of
1355 .It Dv NT_FREEBSD_ABI_TAG Pq Value: 1
1356 Indicates the OS ABI version in a form of a 32-bit integer containing expected
1359 .Dv __FreeBSD_version Pc .
1360 .It Dv NT_FREEBSD_NOINIT_TAG Pq Value: 2
1361 Indicates that the C startup does not call initialization routines, and thus
1366 .It Dv NT_FREEBSD_ARCH_TAG Pq Value: 3
1367 Contains the MACHINE_ARCH that the executable was built for.
1368 .It Dv NT_FREEBSD_FEATURE_CTL Pq Value: 4
1369 Contains a bitmask of mitigations and features to enable:
1371 .It NT_FREEBSD_FCTL_ASLR_DISABLE Pq Value: 0x01
1372 Request that address randomization (ASLR) not be performed.
1375 .It NT_FREEBSD_FCTL_PROTMAX_DISABLE Pq Value: 0x02
1378 calls not set PROT_MAX to the initial value of the
1381 .It NT_FREEBSD_FCTL_STKGAP_DISABLE Pq Value: 0x04
1383 .It NT_FREEBSD_FCTL_WXNEEDED Pq Value: 0x08
1384 Indicate that the binary requires mappings that are simultaneously
1385 writeable and executable.
1390 .Xr gdb 1 Pq Pa ports/devel/gdb ,
1400 .%B Elf-64 Object File Format
1403 .%A Santa Cruz Operation
1404 .%B System V Application Binary Interface
1407 .%A Unix System Laboratories
1409 .%B "Executable and Linking Format (ELF)"
1412 The ELF header files made their appearance in
1414 ELF in itself first appeared in
1416 The ELF format is an adopted standard.
1418 This manual page was written by
1419 .An Jeroen Ruigrok van der Werven Aq Mt asmodai@FreeBSD.org
1420 with inspiration from BSDi's