]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man5/elf.5
sync
[thirdparty/man-pages.git] / man5 / elf.5
CommitLineData
8d5bf179
MK
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.
4.\"
5.\"Redistribution and use in source and binary forms, with or without
6.\"modification, are permitted provided that the following conditions
7.\"are met:
8.\"1. Redistributions of source code must retain the above copyright
9.\" notice, this list of conditions and the following disclaimer.
10.\"2. Redistributions in binary form must reproduce the above copyright
11.\" notice, this list of conditions and the following disclaimer in the
12.\" documentation and/or other materials provided with the distribution.
13.\"
14.\"THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\"ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\"ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\"FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\"DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\"OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\"HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\"LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\"OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\"SUCH DAMAGE.
25.\"
26.\" $FreeBSD: src/share/man/man5/elf.5,v 1.21 2001/10/01 16:09:23 ru Exp $
27.\"
28.\" Slightly adapted - aeb, 2004-01-01
29.\" 2005-07-15, Mike Frysinger <vapier@gentoo.org>, various fixes
dbdab2f4 30.\" 2007-10-11, Mike Frysinger <vapier@gentoo.org>, various fixes
8d5bf179 31.\"
33c6f374 32.Dd November 25, 2007
fea681da
MK
33.Dt ELF 5
34.Os
35.Sh NAME
36.Nm elf
28d979c8 37.Nd format of Executable and Linking Format (ELF) files
fea681da
MK
38.Sh SYNOPSIS
39.\" .Fd #include <elf_abi.h>
40.Fd #include <elf.h>
41.Sh DESCRIPTION
42The header file
43.\" .Aq Pa elf_abi.h
44.Aq Pa elf.h
45defines the format of ELF executable binary files.
46Amongst these files are
47normal executable files, relocatable object files, core files and shared
48libraries.
49.Pp
50An executable file using the ELF file format consists of an ELF header,
51followed by a program header table or a section header table, or both.
52The ELF header is always at offset zero of the file.
53The program header
54table and the section header table's offset in the file are defined in the
55ELF header.
56The two tables describe the rest of the particularities of
57the file.
58.Pp
59.\" Applications which wish to process ELF binary files for their native
60.\" architecture only should include
61.\" .Aq Pa elf_abi.h
62.\" in their source code.
63.\" These applications should need to refer to
64.\" all the types and structures by their generic names
65.\" .Dq Elf_xxx
66.\" and to the macros by
67.\" .Dq ELF_xxx .
68.\" Applications written this way can be compiled on any architecture,
69.\" regardless of whether the host is 32-bit or 64-bit.
70.\" .Pp
71.\" Should an application need to process ELF files of an unknown
72.\" architecture, then the application needs to explicitly use either
73.\" .Dq Elf32_xxx
74.\" or
75.\" .Dq Elf64_xxx
76.\" type and structure names.
77.\" Likewise, the macros need to be identified by
78.\" .Dq ELF32_xxx
79.\" or
80.\" .Dq ELF64_xxx .
81.\" .Pp
82This header file describes the above mentioned headers as C structures
83and also includes structures for dynamic sections, relocation sections and
84symbol tables.
85.Pp
86The following types are used for N-bit architectures (N=32,64,
87ElfN stands for Elf32 or Elf64, uintN_t stands for uint32_t or uint64_t):
88.Bd -literal -offset indent
89ElfN_Addr Unsigned program address, uintN_t
90ElfN_Off Unsigned file offset, uintN_t
91ElfN_Section Unsigned section index, uint16_t
92ElfN_Versym Unsigned version symbol information, uint16_t
93Elf_Byte unsigned char
94ElfN_Half uint16_t
95ElfN_Sword int32_t
96ElfN_Word uint32_t
97ElfN_Sxword int64_t
98ElfN_Xword uint64_t
99.\" Elf32_Size Unsigned object size
100.Ed
101.Pp
c13182ef
MK
102(Note: The *BSD terminology is a bit different.
103There Elf64_Half is
fea681da
MK
104twice as large as Elf32_Half, and Elf64Quarter is used for uint16_t.
105In order to avoid confusion these types are replaced by explicit ones
106in the below.)
107.Pp
108All data structures that the file format defines follow the
109.Dq natural
110size and alignment guidelines for the relevant class.
111If necessary,
112data structures contain explicit padding to ensure 4-byte alignment
113for 4-byte objects, to force structure sizes to a multiple of 4, etc.
114.Pp
115The ELF header is described by the type Elf32_Ehdr or Elf64_Ehdr:
116.Bd -literal -offset indent
117#define EI_NIDENT 16
118
119typedef struct {
dd0a09a5
MK
120 unsigned char e_ident[EI_NIDENT];
121 uint16_t e_type;
122 uint16_t e_machine;
123 uint32_t e_version;
124 ElfN_Addr e_entry;
125 ElfN_Off e_phoff;
126 ElfN_Off e_shoff;
127 uint32_t e_flags;
128 uint16_t e_ehsize;
129 uint16_t e_phentsize;
130 uint16_t e_phnum;
131 uint16_t e_shentsize;
132 uint16_t e_shnum;
133 uint16_t e_shstrndx;
fea681da
MK
134} ElfN_Ehdr;
135.Ed
136.Pp
137The fields have the following meanings:
dd0a09a5 138.Bl -tag -width "e_phentsize"
8d5bf179
MK
139.It Dv e_ident
140This array of bytes specifies to interpret the file,
141independent of the processor or the file's remaining contents.
142Within this array everything is named by macros, which start with
143the prefix
144.Sy EI_
145and may contain values which start with the prefix
146.Sy ELF .
147The following macros are defined:
148.Bl -tag -width "EI_VERSION" \" EI_ABIVERSION
149.It Dv EI_MAG0
150The first byte of the magic number.
151It must be filled with
152.Sy ELFMAG0 .
153(0: 0x7f)
154.It Dv EI_MAG1
155The second byte of the magic number.
156It must be filled with
157.Sy ELFMAG1 .
158(1: 'E')
159.It Dv EI_MAG2
160The third byte of the magic number.
161It must be filled with
162.Sy ELFMAG2 .
163(2: 'L')
164.It Dv EI_MAG3
165The fourth byte of the magic number.
166It must be filled with
167.Sy ELFMAG3 .
168(3: 'F')
169.It Dv EI_CLASS
170The fifth byte identifies the architecture for this binary:
171.Pp
172.Bl -tag -width "ELFCLASSNONE" -compact
173.It Dv ELFCLASSNONE
174This class is invalid.
175.It Dv ELFCLASS32
176This defines the 32-bit architecture.
177It supports machines with files
178and virtual address spaces up to 4 Gigabytes.
179.It Dv ELFCLASS64
180This defines the 64-bit architecture.
181.El
182.It Dv EI_DATA
183The sixth byte specifies the data encoding of the processor-specific
184data in the file.
185Currently these encodings are supported:
186.Pp
187.Bl -tag -width "ELFDATA2LSB" -compact
188.It Dv ELFDATANONE
189Unknown data format.
190.It Dv ELFDATA2LSB
191Two's complement, little-endian.
192.It Dv ELFDATA2MSB
193Two's complement, big-endian.
194.El
195.It Dv EI_VERSION
196The version number of the ELF specification:
197.Pp
198.Bl -tag -width "EV_CURRENT" -compact
199.It Dv EV_NONE
200Invalid version.
201.It Dv EV_CURRENT
202Current version.
203.El
204.It Dv EI_OSABI
205This byte identifies the operating system
206and ABI to which the object is targeted.
207Some fields in other ELF structures have flags
208and values that have platform specific meanings;
209the interpretation of those fields is determined by the value of this byte.
210E.g.:
211.Pp
212.Bl -tag -width "ELFOSABI_STANDALONE" -compact
213.It Dv ELFOSABI_NONE
214Same as ELFOSABI_SYSV
215.\" 0
216.It Dv ELFOSABI_SYSV
217UNIX System V ABI.
218.\" 0
219.\" synonym: ELFOSABI_NONE
220.It Dv ELFOSABI_HPUX
221HP-UX ABI.
222.\" 1
223.It Dv ELFOSABI_NETBSD
224NetBSD ABI.
225.\" 2
226.It Dv ELFOSABI_LINUX
227Linux ABI.
228.\" 3
229.\" .It Dv ELFOSABI_HURD
230.\" Hurd ABI.
231.\" 4
232.\" .It Dv ELFOSABI_86OPEN
233.\" 86Open Common IA32 ABI.
234.\" 5
235.It Dv ELFOSABI_SOLARIS
236Solaris ABI.
237.\" 6
238.\" .It Dv ELFOSABI_MONTEREY
239.\" Monterey project ABI. Now replaced by
240.\" ELFOSABI_AIX
241.\" 7
242.It Dv ELFOSABI_IRIX
243IRIX ABI.
244.\" 8
245.It Dv ELFOSABI_FREEBSD
246FreeBSD ABI.
247.\" 9
248.It Dv ELFOSABI_TRU64
249TRU64 UNIX ABI.
250.\" 10
251.\" ELFOSABI_MODESTO
252.\" 11
253.\" ELFOSABI_OPENBSD
254.\" 12
255.It Dv ELFOSABI_ARM
256ARM architecture ABI.
257.\" 97
258.It Dv ELFOSABI_STANDALONE
259Stand-alone (embedded) ABI.
260.\" 255
261.El
262.It Dv EI_ABIVERSION
263This byte identifies the version of the ABI
264to which the object is targeted.
265This field is used to distinguish among incompatible versions of an ABI.
266The interpretation of this version number
267is dependent on the ABI identified by the EI_OSABI field.
268Applications conforming to this specification use the value 0.
269.It Dv EI_PAD
270Start of padding.
271These bytes are reserved and set to zero.
272Programs
273which read them should ignore them.
274The value for EI_PAD will change in
275the future if currently unused bytes are given meanings.
276.It Dv EI_BRAND
277Start of architecture identification.
278.It Dv EI_NIDENT
279The size of the e_ident array.
280.El
281.Pp
282.It Dv e_type
283This member of the structure identifies the object file type:
284.Pp
285.Bl -tag -width "ET_NONE" -compact
286.It Dv ET_NONE
287An unknown type.
288.It Dv ET_REL
289A relocatable file.
290.It Dv ET_EXEC
291An executable file.
292.It Dv ET_DYN
293A shared object.
294.It Dv ET_CORE
295A core file.
296.El
297.Pp
298.It Dv e_machine
299This member specifies the required architecture for an individual file.
300E.g.:
301.Pp
302.Bl -tag -width "EM_MIPS_RS4_BE" -compact
303.It Dv EM_NONE
304An unknown machine.
305.\" 0
306.It Dv EM_M32
307AT&T WE 32100.
308.\" 1
309.It Dv EM_SPARC
310Sun Microsystems SPARC.
311.\" 2
312.It Dv EM_386
313Intel 80386.
314.\" 3
315.It Dv EM_68K
316Motorola 68000.
317.\" 4
318.It Dv EM_88K
319Motorola 88000.
320.\" 5
321.\" .It Dv EM_486
322.\" Intel 80486.
323.\" 6
324.It Dv EM_860
325Intel 80860.
326.\" 7
327.It Dv EM_MIPS
328MIPS RS3000 (big-endian only).
329.\" 8
330.\" EM_S370
331.\" 9
332.\" .It Dv EM_MIPS_RS4_BE
333.\" MIPS RS4000 (big-endian only). Deprecated.
334.\" 10
335.\" EM_MIPS_RS3_LE (MIPS R3000 little-endian)
336.\" 10
337.It Dv EM_PARISC
338HP/PA.
339.\" 15
340.It Dv EM_SPARC32PLUS
341SPARC with enhanced instruction set.
342.\" 18
343.It Dv EM_PPC
344PowerPC.
345.\" 20
346.It Dv EM_PPC64
347PowerPC 64-bit.
348.\" 21
349.It Dv EM_S390
350IBM S/390
351.\" 22
352.It Dv EM_ARM
353Advanced RISC Machines
354.\" 40
355.It Dv EM_SH
356Renesas SuperH
357.\" 42
358.It Dv EM_SPARCV9
359SPARC v9 64-bit.
360.\" 43
361.It Dv EM_IA_64
362Intel Itanium
363.\" 50
364.It Dv EM_X86_64
365AMD x86-64
366.\" 62
367.It Dv EM_VAX
368DEC Vax.
369.\" 75
370.\" EM_CRIS
371.\" 76
372.\" .It Dv EM_ALPHA
373.\" Compaq [DEC] Alpha.
374.\" .It Dv EM_ALPHA_EXP
375.\" Compaq [DEC] Alpha with enhanced instruction set.
376.El
377.Pp
378.It Dv e_version
379This member identifies the file version:
380.Pp
381.Bl -tag -width "EV_CURRENT" -compact
382.It Dv EV_NONE
383Invalid version.
384.It Dv EV_CURRENT
385Current version.
386.El
387.It Dv e_entry
388This member gives the virtual address to which the system first transfers
389control, thus starting the process.
390If the file has no associated entry
391point, this member holds zero.
392.It Dv e_phoff
393This member holds the program header table's file offset in bytes.
394If
395the file has no program header table, this member holds zero.
396.It Dv e_shoff
397This member holds the section header table's file offset in bytes.
398If the
399file has no section header table this member holds zero.
400.It Dv e_flags
401This member holds processor-specific flags associated with the file.
402Flag names take the form EF_`machine_flag'.
403Currently no flags have been defined.
404.It Dv e_ehsize
405This member holds the ELF header's size in bytes.
406.It Dv e_phentsize
407This member holds the size in bytes of one entry in the file's program header
408table; all entries are the same size.
409.It Dv e_phnum
410This member holds the number of entries in the program header
411table.
412Thus the product of
413.Sy e_phentsize
414and
415.Sy e_phnum
416gives the table's size
417in bytes.
418If a file has no program header,
419.Sy e_phnum
420holds the value zero.
421.It Dv e_shentsize
422This member holds a sections header's size in bytes.
423A section header is one
424entry in the section header table; all entries are the same size.
425.It Dv e_shnum
426This member holds the number of entries in the section header table.
427Thus
428the product of
429.Sy e_shentsize
430and
431.Sy e_shnum
432gives the section header table's size in bytes.
433If a file has no section
434header table,
435.Sy e_shnum
436holds the value of zero.
437.It Dv e_shstrndx
438This member holds the section header table index of the entry associated
439with the section name string table.
440If the file has no section name string
441table, this member holds the value
442.Sy SHN_UNDEF .
443.Bl -tag -width "SHN_LORESERVE"
444.It Dv SHN_UNDEF
445This value marks an undefined, missing, irrelevant, or otherwise meaningless
446section reference.
447For example, a symbol
448.Dq defined
449relative to section number
450.Sy SHN_UNDEF
451is an undefined symbol.
452.It Dv SHN_LORESERVE
453This value specifies the lower bound of the range of reserved indices.
454.It Dv SHN_LOPROC
455Values greater than or equal to
456.Sy SHN_HIPROC
457are reserved for processor-specific semantics.
458.It Dv SHN_HIPROC
459Values less than or equal to
460.Sy SHN_LOPROC
461are reserved for processor-specific semantics.
462.It Dv SHN_ABS
463This value specifies absolute values for the corresponding reference.
464For
465example, symbols defined relative to section number
466.Sy SHN_ABS
467have absolute values and are not affected by relocation.
468.It Dv SHN_COMMON
469Symbols defined relative to this section are common symbols, such as Fortran
470COMMON or unallocated C external variables.
471.It Dv SHN_HIRESERVE
472This value specifies the upper bound of the range of reserved
473indices between
474.Sy SHN_LORESERVE
475and
476.Sy SHN_HIRESERVE ,
477inclusive; the values do
478not reference the section header table.
479That is, the section header table
480does
481.Em not
482contain entries for the reserved indices.
483.El
484.El
485.Pp
486An executable or shared object file's program header table is an array of
487structures, each describing a segment or other information the system needs
488to prepare the program for execution.
489An object file
490.Em segment
491contains one or more
492.Em sections .
493Program headers are meaningful only for executable and shared object files.
494A file specifies its own program header size with the ELF header's
495.Sy e_phentsize
496and
497.Sy e_phnum
498members.
499The ELF program header is described by the type Elf32_Phdr or Elf64_Phdr
500depending on the architecture:
501.Bd -literal -offset indent
502typedef struct {
dd0a09a5
MK
503 uint32_t p_type;
504 Elf32_Off p_offset;
505 Elf32_Addr p_vaddr;
506 Elf32_Addr p_paddr;
507 uint32_t p_filesz;
508 uint32_t p_memsz;
509 uint32_t p_flags;
510 uint32_t p_align;
8d5bf179
MK
511} Elf32_Phdr;
512.Ed
513.Bd -literal -offset indent
514typedef struct {
dd0a09a5
MK
515 uint32_t p_type;
516 uint32_t p_flags;
517 Elf64_Off p_offset;
518 Elf64_Addr p_vaddr;
519 Elf64_Addr p_paddr;
520 uint64_t p_filesz;
521 uint64_t p_memsz;
522 uint64_t p_align;
8d5bf179
MK
523} Elf64_Phdr;
524.Ed
525.Pp
526The main difference between the 32-bit and the 64-bit program header lies
527in the location of the
528.Sy p_flags
529member in the total struct.
dd0a09a5 530.Bl -tag -width "p_offset"
8d5bf179
MK
531.It Dv p_type
532This member of the Phdr struct tells what kind of segment this array
533element describes or how to interpret the array element's information.
534.Bl -tag -width "PT_DYNAMIC"
535.It Dv PT_NULL
536The array element is unused and the other members' values are undefined.
537This lets the program header have ignored entries.
538.It Dv PT_LOAD
539The array element specifies a loadable segment, described by
540.Sy p_filesz
541and
542.Sy p_memsz .
543The bytes from the file are mapped to the beginning of the memory
544segment.
545If the segment's memory size
546.Pq Sy p_memsz
547is larger than the file size
548.Pq Sy p_filesz ,
549the
550.Dq extra
551bytes are defined to hold the value 0 and to follow the segment's
552initialized area.
553The file size may not be larger than the memory size.
554Loadable segment entries in the program header table appear in ascending
555order, sorted on the
556.Sy p_vaddr
557member.
558.It Dv PT_DYNAMIC
559The array element specifies dynamic linking information.
560.It Dv PT_INTERP
561The array element specifies the location and size of a null-terminated
2d7195b8 562pathname to invoke as an interpreter.
8d5bf179
MK
563This segment type is meaningful
564only for executable files (though it may occur for shared objects).
565However it may not occur more than once in a file.
566If it is present, it must precede any loadable segment entry.
567.It Dv PT_NOTE
568The array element specifies the location and size for auxiliary information.
569.It Dv PT_SHLIB
570This segment type is reserved but has unspecified semantics.
571Programs that
572contain an array element of this type do not conform to the ABI.
573.It Dv PT_PHDR
574The array element, if present, specifies the location and size of the program
575header table itself, both in the file and in the memory image of the program.
576This segment type may not occur more than once in a file.
577Moreover, it may
578only occur if the program header table is part of the memory image of the
579program.
580If it is present, it must precede any loadable segment entry.
581.It Dv PT_LOPROC
582Values greater than or equal to
583.Sy PT_HIPROC
584are reserved for processor-specific semantics.
585.It Dv PT_HIPROC
586Values less than or equal to
587.Sy PT_LOPROC
588are reserved for processor-specific semantics.
dbdab2f4
MK
589.It PT_GNU_STACK
590GNU extension which is used by the Linux kernel to control the state of the
38f76cd2 591stack via the flags set in the
dbdab2f4
MK
592.Sy p_flags
593member.
8d5bf179
MK
594.El
595.Pp
596.It Dv p_offset
597This member holds the offset from the beginning of the file at which
598the first byte of the segment resides.
599.It Dv p_vaddr
600This member holds the virtual address at which the first byte of the
601segment resides in memory.
602.It Dv p_paddr
603On systems for which physical addressing is relevant, this member is
604reserved for the segment's physical address.
605Under
606.Bx
607this member is
608not used and must be zero.
609.It Dv p_filesz
610This member holds the number of bytes in the file image of the segment.
611It may be zero.
612.It Dv p_memsz
613This member holds the number of bytes in the memory image of the segment.
614It may be zero.
615.It Dv p_flags
dbdab2f4 616This member holds a bitmask of flags relevant to the segment:
8d5bf179
MK
617.Pp
618.Bl -tag -width "PF_X" -compact
619.It Dv PF_X
620An executable segment.
621.It Dv PF_W
622A writable segment.
623.It Dv PF_R
624A readable segment.
625.El
626.Pp
627A text segment commonly has the flags
628.Sy PF_X
629and
630.Sy PF_R .
631A data segment commonly has
632.Sy PF_X ,
633.Sy PF_W
634and
635.Sy PF_R .
636.It Dv p_align
637This member holds the value to which the segments are aligned in memory
638and in the file.
639Loadable process segments must have congruent values for
640.Sy p_vaddr
641and
642.Sy p_offset ,
643modulo the page size.
644Values of zero and one mean no alignment is required.
645Otherwise,
646.Sy p_align
647should be a positive, integral power of two, and
648.Sy p_vaddr
649should equal
650.Sy p_offset ,
651modulo
652.Sy p_align .
653.El
654.Pp
655A file's section header table lets one locate all the file's sections.
656The
657section header table is an array of Elf32_Shdr or Elf64_Shdr structures.
658The
659ELF header's
660.Sy e_shoff
661member gives the byte offset from the beginning of the file to the section
662header table.
663.Sy e_shnum
664holds the number of entries the section header table contains.
665.Sy e_shentsize
666holds the size in bytes of each entry.
667.Pp
668A section header table index is a subscript into this array.
669Some section
670header table indices are reserved.
671An object file does not have sections for
672these special indices:
673.Bl -tag -width "SHN_LORESERVE"
674.It Dv SHN_UNDEF
675This value marks an undefined, missing, irrelevant or otherwise meaningless
676section reference.
677.It Dv SHN_LORESERVE
678This value specifies the lower bound of the range of reserved indices.
679.It Dv SHN_LOPROC
680Values greater than or equal to
681.Sy SHN_HIPROC
682are reserved for processor-specific semantics.
683.It Dv SHN_HIPROC
684Values less than or equal to
685.Sy SHN_LOPROC
686are reserved for processor-specific semantics.
687.It Dv SHN_ABS
688This value specifies the absolute value for the corresponding reference.
689For
690example, a symbol defined relative to section number
691.Sy SHN_ABS
692has an absolute value and is not affected by relocation.
693.It Dv SHN_COMMON
694Symbols defined relative to this section are common symbols, such as FORTRAN
695COMMON or unallocated C external variables.
696.It Dv SHN_HIRESERVE
697This value specifies the upper bound of the range of reserved indices.
698The
699system reserves indices between
700.Sy SHN_LORESERVE
701and
702.Sy SHN_HIRESERVE ,
703inclusive.
704The section header table does not contain entries for the
705reserved indices.
706.El
707.Pp
708The section header has the following structure:
709.Bd -literal -offset indent
710typedef struct {
dd0a09a5
MK
711 uint32_t sh_name;
712 uint32_t sh_type;
713 uint32_t sh_flags;
714 Elf32_Addr sh_addr;
715 Elf32_Off sh_offset;
716 uint32_t sh_size;
717 uint32_t sh_link;
718 uint32_t sh_info;
719 uint32_t sh_addralign;
720 uint32_t sh_entsize;
8d5bf179
MK
721} Elf32_Shdr;
722.Ed
723.Bd -literal -offset indent
724typedef struct {
dd0a09a5
MK
725 uint32_t sh_name;
726 uint32_t sh_type;
727 uint64_t sh_flags;
728 Elf64_Addr sh_addr;
729 Elf64_Off sh_offset;
730 uint64_t sh_size;
731 uint32_t sh_link;
732 uint32_t sh_info;
733 uint64_t sh_addralign;
734 uint64_t sh_entsize;
8d5bf179
MK
735} Elf64_Shdr;
736.Ed
737.Pp
738No real differences exist between the 32-bit and 64-bit section headers.
dd0a09a5 739.Bl -tag -width "sh_addralign"
8d5bf179
MK
740.It Dv sh_name
741This member specifies the name of the section.
742Its value is an index
743into the section header string table section, giving the location of
744a null-terminated string.
745.It Dv sh_type
746This member categorizes the section's contents and semantics.
747.Bl -tag -width "SHT_PROGBITS"
748.It Dv SHT_NULL
749This value marks the section header as inactive.
750It does not
751have an associated section.
752Other members of the section header
753have undefined values.
754.It Dv SHT_PROGBITS
755This section holds information defined by the program, whose
756format and meaning are determined solely by the program.
757.It Dv SHT_SYMTAB
758This section holds a symbol table.
759Typically,
760.Sy SHT_SYMTAB
761provides symbols for link editing, though it may also be used
762for dynamic linking.
763As a complete symbol table, it may contain
764many symbols unnecessary for dynamic linking.
765An object file can
766also contain a
767.Sy SHT_DYNSYM
768section.
769.It Dv SHT_STRTAB
770This section holds a string table.
771An object file may have multiple
772string table sections.
773.It Dv SHT_RELA
774This section holds relocation entries with explicit addends, such
775as type
776.Sy Elf32_Rela
777for the 32-bit class of object files.
778An object may have multiple
779relocation sections.
780.It Dv SHT_HASH
781This section holds a symbol hash table.
782An object participating in
783dynamic linking must contain a symbol hash table.
784An object file may
785have only one hash table.
786.It Dv SHT_DYNAMIC
787This section holds information for dynamic linking.
788An object file may
789have only one dynamic section.
790.It Dv SHT_NOTE
791This section holds information that marks the file in some way.
792.It Dv SHT_NOBITS
793A section of this type occupies no space in the file but otherwise
794resembles
795.Sy SHT_PROGBITS .
796Although this section contains no bytes, the
797.Sy sh_offset
798member contains the conceptual file offset.
799.It Dv SHT_REL
800This section holds relocation offsets without explicit addends, such
801as type
802.Sy Elf32_Rel
803for the 32-bit class of object files.
804An object file may have multiple
805relocation sections.
806.It Dv SHT_SHLIB
807This section is reserved but has unspecified semantics.
808.It Dv SHT_DYNSYM
809This section holds a minimal set of dynamic linking symbols.
810An
811object file can also contain a
812.Sy SHT_SYMTAB
813section.
814.It Dv SHT_LOPROC
815This value up to and including
816.Sy SHT_HIPROC
817is reserved for processor-specific semantics.
818.It Dv SHT_HIPROC
819This value down to and including
820.Sy SHT_LOPROC
821is reserved for processor-specific semantics.
822.It Dv SHT_LOUSER
823This value specifies the lower bound of the range of indices reserved for
824application programs.
825.It Dv SHT_HIUSER
826This value specifies the upper bound of the range of indices reserved for
827application programs.
828Section types between
829.Sy SHT_LOUSER
830and
831.Sy SHT_HIUSER
832may be used by the application, without conflicting with current or future
833system-defined section types.
834.El
835.Pp
836.It Dv sh_flags
837Sections support one-bit flags that describe miscellaneous attributes.
838If a flag bit is set in
839.Sy sh_flags ,
840the attribute is
841.Dq on
842for the section.
843Otherwise, the attribute is
844.Dq off
845or does not apply.
846Undefined attributes are set to zero.
847.Pp
848.Bl -tag -width "SHF_EXECINSTR" -compact
849.It Dv SHF_WRITE
850This section contains data that should be writable during process
851execution.
852.It Dv SHF_ALLOC
853This section occupies memory during process execution.
854Some control
855sections do not reside in the memory image of an object file.
856This
857attribute is off for those sections.
858.It Dv SHF_EXECINSTR
859This section contains executable machine instructions.
860.It Dv SHF_MASKPROC
861All bits included in this mask are reserved for processor-specific
862semantics.
863.El
864.Pp
865.It Dv sh_addr
866If this section appears in the memory image of a process, this member
867holds the address at which the section's first byte should reside.
868Otherwise, the member contains zero.
869.It Dv sh_offset
870This member's value holds the byte offset from the beginning of the file
871to the first byte in the section.
872One section type,
873.Sy SHT_NOBITS ,
874occupies no space in the file, and its
875.Sy sh_offset
876member locates the conceptual placement in the file.
877.It Dv sh_size
878This member holds the section's size in bytes.
879Unless the section type
880is
881.Sy SHT_NOBITS ,
882the section occupies
883.Sy sh_size
884bytes in the file.
885A section of type
886.Sy SHT_NOBITS
887may have a non-zero size, but it occupies no space in the file.
888.It Dv sh_link
889This member holds a section header table index link, whose interpretation
890depends on the section type.
891.It Dv sh_info
892This member holds extra information, whose interpretation depends on the
893section type.
894.It Dv sh_addralign
895Some sections have address alignment constraints.
896If a section holds a
897doubleword, the system must ensure doubleword alignment for the entire
898section.
899That is, the value of
900.Sy sh_addr
901must be congruent to zero, modulo the value of
902.Sy sh_addralign .
903Only zero and positive integral powers of two are allowed.
904Values of zero
905or one mean the section has no alignment constraints.
906.It Dv sh_entsize
907Some sections hold a table of fixed-sized entries, such as a symbol table.
908For such a section, this member gives the size in bytes for each entry.
909This member contains zero if the section does not hold a table of
910fixed-size entries.
911.El
912.Pp
913Various sections hold program and control information:
dd0a09a5 914.Bl -tag -width ".shstrtab"
8d5bf179
MK
915.It .bss
916This section holds uninitialized data that contributes to the program's
917memory image.
918By definition, the system initializes the data with zeros
919when the program begins to run.
920This section is of type
921.Sy SHT_NOBITS .
922The attribute types are
923.Sy SHF_ALLOC
924and
925.Sy SHF_WRITE .
926.It .comment
927This section holds version control information.
928This section is of type
929.Sy SHT_PROGBITS .
930No attribute types are used.
931.It .ctors
932This section holds initialized pointers to the C++ constructor functions.
933This section is of type
934.Sy SHT_PROGBITS .
935The attribute types are
936.Sy SHF_ALLOC
937and
938.Sy SHF_WRITE .
939.It .data
940This section holds initialized data that contribute to the program's
941memory image.
942This section is of type
943.Sy SHT_PROGBITS .
944The attribute types are
945.Sy SHF_ALLOC
946and
947.Sy SHF_WRITE .
948.It .data1
949This section holds initialized data that contribute to the program's
950memory image.
951This section is of type
952.Sy SHT_PROGBITS .
953The attribute types are
954.Sy SHF_ALLOC
955and
956.Sy SHF_WRITE .
957.It .debug
958This section holds information for symbolic debugging.
959The contents
960are unspecified.
961This section is of type
962.Sy SHT_PROGBITS .
963No attribute types are used.
964.It .dtors
965This section holds initialized pointers to the C++ destructor functions.
966This section is of type
967.Sy SHT_PROGBITS .
968The attribute types are
969.Sy SHF_ALLOC
970and
971.Sy SHF_WRITE .
972.It .dynamic
973This section holds dynamic linking information.
974The section's attributes
975will include the
976.Sy SHF_ALLOC
977bit.
978Whether the
979.Sy SHF_WRITE
980bit is set is processor-specific.
981This section is of type
982.Sy SHT_DYNAMIC .
983See the attributes above.
984.It .dynstr
985This section holds strings needed for dynamic linking, most commonly
986the strings that represent the names associated with symbol table entries.
987This section is of type
988.Sy SHT_STRTAB .
989The attribute type used is
990.Sy SHF_ALLOC .
991.It .dynsym
992This section holds the dynamic linking symbol table.
993This section is of type
994.Sy SHT_DYNSYM .
995The attribute used is
996.Sy SHF_ALLOC .
997.It .fini
998This section holds executable instructions that contribute to the process
999termination code.
1000When a program exits normally the system arranges to
1001execute the code in this section.
1002This section is of type
1003.Sy SHT_PROGBITS .
1004The attributes used are
1005.Sy SHF_ALLOC
1006and
1007.Sy SHF_EXECINSTR .
dbdab2f4
MK
1008.It .gnu.version
1009This section holds the version symbol table, an array of ElfN_Half elements.
1010This section is of type
1011.Sy SHT_GNU_versym .
1012The attribute type used is
1013.Sy SHF_ALLOC .
1014.It .gnu.version_d
1015This section holds the version symbol definitons, a table of ElfN_Verdef
1016structures. This section is of type
1017.Sy SHT_GNU_verdef .
1018The attribute type used is
1019.Sy SHF_ALLOC .
1020.It .gnu.version_r
1021This section holds the version symbol needed elements, a table of
1022ElfN_Verneed structures. This section is of
1023type
1024.Sy SHT_GNU_versym .
1025The attribute type used is
1026.Sy SHF_ALLOC .
8d5bf179
MK
1027.It .got
1028This section holds the global offset table.
1029This section is of type
1030.Sy SHT_PROGBITS .
1031The attributes are processor-specific.
1032.It .hash
1033This section holds a symbol hash table.
1034This section is of type
1035.Sy SHT_HASH .
1036The attribute used is
1037.Sy SHF_ALLOC .
1038.It .init
1039This section holds executable instructions that contribute to the process
1040initialization code.
1041When a program starts to run the system arranges to
1042execute the code in this section before calling the main program entry point.
1043This section is of type
1044.Sy SHT_PROGBITS .
1045The attributes used are
1046.Sy SHF_ALLOC
1047and
1048.Sy SHF_EXECINSTR .
1049.It .interp
1050This section holds the pathname of a program interpreter.
1051If the file has
1052a loadable segment that includes the section, the section's attributes will
1053include the
1054.Sy SHF_ALLOC
1055bit.
1056Otherwise, that bit will be off.
1057This section is of type
1058.Sy SHT_PROGBITS .
1059.It .line
1060This section holds line number information for symbolic debugging, which
1061describes the correspondence between the program source and the machine code.
1062The contents are unspecified.
1063This section is of type
1064.Sy SHT_PROGBITS .
1065No attribute types are used.
1066.It .note
1067This section holds information in the
1068.Dq Note Section
1069format described below.
1070This section is of type
1071.Sy SHT_NOTE .
1072No attribute types are used.
1073.Ox
1074native executables usually contain a
1075.Sy .note.openbsd.ident
1076section to identify themselves, for the kernel to bypass any compatibility
1077ELF binary emulation tests when loading the file.
dbdab2f4
MK
1078.It .note.GNU-stack
1079This section is used in Linux object files for declaring stack attributes.
1080This section is of type
1081.Sy SHT_PROGBITS .
1082The only attribute used is
1083.Sy SHF_EXECINSTR .
1084This indicates to the GNU linker that the object file requires an
1085executable stack.
8d5bf179
MK
1086.It .plt
1087This section holds the procedure linkage table.
1088This section is of type
1089.Sy SHT_PROGBITS .
1090The attributes are processor-specific.
1091.It .relNAME
1092This section holds relocation information as described below.
1093If the file
1094has a loadable segment that includes relocation, the section's attributes
1095will include the
1096.Sy SHF_ALLOC
1097bit.
1098Otherwise the bit will be off.
1099By convention,
1100.Dq NAME
1101is supplied by the section to which the relocations apply.
1102Thus a relocation
1103section for
1104.Sy .text
1105normally would have the name
1106.Sy .rel.text .
1107This section is of type
1108.Sy SHT_REL .
1109.It .relaNAME
1110This section holds relocation information as described below.
1111If the file
1112has a loadable segment that includes relocation, the section's attributes
1113will include the
1114.Sy SHF_ALLOC
1115bit.
1116Otherwise the bit will be off.
1117By convention,
1118.Dq NAME
1119is supplied by the section to which the relocations apply.
1120Thus a relocation
1121section for
1122.Sy .text
1123normally would have the name
1124.Sy .rela.text .
1125This section is of type
1126.Sy SHT_RELA .
1127.It .rodata
1128This section holds read-only data that typically contributes to a
1129non-writable segment in the process image.
1130This section is of type
1131.Sy SHT_PROGBITS .
1132The attribute used is
1133.Sy SHF_ALLOC .
1134.It .rodata1
1135This section holds read-only data that typically contributes to a
1136non-writable segment in the process image.
1137This section is of type
1138.Sy SHT_PROGBITS .
1139The attribute used is
1140.Sy SHF_ALLOC .
1141.It .shstrtab
1142This section holds section names.
1143This section is of type
1144.Sy SHT_STRTAB .
1145No attribute types are used.
1146.It .strtab
1147This section holds strings, most commonly the strings that represent the
1148names associated with symbol table entries.
1149If the file has a loadable
1150segment that includes the symbol string table, the section's attributes
1151will include the
1152.Sy SHF_ALLOC
1153bit.
1154Otherwise the bit will be off.
1155This section is of type
1156.Sy SHT_STRTAB .
1157.It .symtab
1158This section holds a symbol table.
1159If the file has a loadable segment
1160that includes the symbol table, the section's attributes will include
1161the
1162.Sy SHF_ALLOC
1163bit.
1164Otherwise the bit will be off.
1165This section is of type
1166.Sy SHT_SYMTAB .
1167.It .text
1168This section holds the
1169.Dq text ,
1170or executable instructions, of a program.
1171This section is of type
1172.Sy SHT_PROGBITS .
1173The attributes used are
1174.Sy SHF_ALLOC
1175and
1176.Sy SHF_EXECINSTR .
1177.El
fea681da
MK
1178.Pp
1179String table sections hold null-terminated character sequences, commonly
1180called strings.
1181The object file uses these strings to represent symbol
1182and section names.
1183One references a string as an index into the string
1184table section.
1185The first byte, which is index zero, is defined to hold
28d88c17 1186a null byte ('\\0').
fea681da 1187Similarly, a string table's last byte is defined to
28d88c17 1188hold a null byte, ensuring null termination for all strings.
fea681da
MK
1189.Pp
1190An object file's symbol table holds information needed to locate and
1191relocate a program's symbolic definitions and references.
1192A symbol table
1193index is a subscript into this array.
1194.Bd -literal -offset indent
1195typedef struct {
dd0a09a5
MK
1196 uint32_t st_name;
1197 Elf32_Addr st_value;
1198 uint32_t st_size;
1199 unsigned char st_info;
1200 unsigned char st_other;
1201 uint16_t st_shndx;
fea681da
MK
1202} Elf32_Sym;
1203.Ed
1204.Bd -literal -offset indent
1205typedef struct {
dd0a09a5
MK
1206 uint32_t st_name;
1207 unsigned char st_info;
1208 unsigned char st_other;
1209 uint16_t st_shndx;
1210 Elf64_Addr st_value;
1211 uint64_t st_size;
fea681da
MK
1212} Elf64_Sym;
1213.Ed
28d979c8 1214.Pp
c13182ef 1215The 32-bit and 64-bit versions have the same members, just in a different
28d979c8 1216order.
dd0a09a5 1217.Bl -tag -width "st_value"
fea681da
MK
1218.It Dv st_name
1219This member holds an index into the object file's symbol string table,
1220which holds character representations of the symbol names.
1221If the value
1222is non-zero, it represents a string table index that gives the symbol
1223name.
1224Otherwise, the symbol table has no name.
1225.It Dv st_value
1226This member gives the value of the associated symbol.
1227.It Dv st_size
1228Many symbols have associated sizes.
1229This member holds zero if the symbol
1230has no size or an unknown size.
1231.It Dv st_info
1232This member specifies the symbol's type and binding attributes:
8d5bf179
MK
1233.Bl -tag -width "STT_SECTION"
1234.It Dv STT_NOTYPE
1235The symbol's type is not defined.
1236.It Dv STT_OBJECT
1237The symbol is associated with a data object.
1238.It Dv STT_FUNC
1239The symbol is associated with a function or other executable code.
1240.It Dv STT_SECTION
1241The symbol is associated with a section.
1242Symbol table entries of
1243this type exist primarily for relocation and normally have
1244.Sy STB_LOCAL
1245bindings.
1246.It Dv STT_FILE
1247By convention, the symbol's name gives the name of the source file
1248associated with the object file.
1249A file symbol has
1250.Sy STB_LOCAL
1251bindings, its section index is
1252.Sy SHN_ABS ,
1253and it precedes the other
1254.Sy STB_LOCAL
1255symbols of the file, if it is present.
1256.It Dv STT_LOPROC
1257This value up to and including
1258.Sy STT_HIPROC
1259is reserved for processor-specific semantics.
1260.It Dv STT_HIPROC
1261This value down to and including
1262.Sy STT_LOPROC
1263is reserved for processor-specific semantics.
1264.El
1265.Bl -tag -width "STB_GLOBAL"
1266.It Dv STB_LOCAL
1267Local symbols are not visible outside the object file containing their
1268definition.
1269Local symbols of the same name may exist in multiple files
1270without interfering with each other.
1271.It Dv STB_GLOBAL
1272Global symbols are visible to all object files being combined.
1273One file's
1274definition of a global symbol will satisfy another file's undefined
1275reference to the same symbol.
1276.It Dv STB_WEAK
1277Weak symbols resemble global symbols, but their definitions have lower
1278precedence.
1279.It Dv STB_LOPROC
1280This value up to and including
1281.Sy STB_HIPROC
1282is reserved for processor-specific semantics.
1283.It Dv STB_HIPROC
1284This value down to and including
1285.Sy STB_LOPROC
1286is reserved for processor-specific semantics.
1287.Pp
1288There are macros for packing and unpacking the binding and type fields:
1289.Pp
1290.Fn ELF32_ST_BIND info
1291or
1292.Fn ELF64_ST_BIND info
1293extract a binding from an st_info value.
1294.Pp
1295.Fn ELF32_ST_TYPE info
1296or
1297.Fn ELF64_ST_TYPE info
1298.br
1299extract a type from an st_info value.
1300.Pp
1301.Fn ELF32_ST_INFO bind type
1302or
1303.Fn ELF64_ST_INFO bind type
1304.br
1305convert a binding and a type into an st_info value.
1306.El
1307.Pp
1308.It Dv st_other
dbdab2f4
MK
1309This member defines the symbol visibility.
1310.Bl -tag -width "STV_PROTECTED"
1311.It Dv STV_DEFAULT
1312Default symbol visibility rules.
1313.It Dv STV_INTERNAL
1314Processor specific hidden class.
1315.It Dv STV_HIDDEN
1316Symbol is unavailable in other modules.
1317.It Dv STV_PROTECTED
1318Not preemptible, not exported.
1319.Pp
1320There are macros for extracting the visibility type:
1321.Pp
1322.Fn ELF32_ST_VISIBILITY other
1323or
1324.Fn ELF64_ST_VISIBILITY other
1325.El
8d5bf179
MK
1326.It Dv st_shndx
1327Every symbol table entry is
1328.Dq defined
1329in relation to some section.
1330This member holds the relevant section
1331header table index.
fea681da
MK
1332.El
1333.Pp
1334Relocation is the process of connecting symbolic references with
1335symbolic definitions.
1336Relocatable files must have information that
1337describes how to modify their section contents, thus allowing executable
1338and shared object files to hold the right information for a process'
1339program image.
1340Relocation entries are these data.
1341.Pp
1342Relocation structures that do not need an addend:
1343.Bd -literal -offset indent
1344typedef struct {
dd0a09a5
MK
1345 Elf32_Addr r_offset;
1346 uint32_t r_info;
fea681da
MK
1347} Elf32_Rel;
1348.Ed
1349.Bd -literal -offset indent
1350typedef struct {
dd0a09a5
MK
1351 Elf64_Addr r_offset;
1352 uint64_t r_info;
fea681da
MK
1353} Elf64_Rel;
1354.Ed
1355.Pp
1356Relocation structures that need an addend:
1357.Bd -literal -offset indent
1358typedef struct {
dd0a09a5
MK
1359 Elf32_Addr r_offset;
1360 uint32_t r_info;
1361 int32_t r_addend;
fea681da
MK
1362} Elf32_Rela;
1363.Ed
1364.Bd -literal -offset indent
1365typedef struct {
dd0a09a5
MK
1366 Elf64_Addr r_offset;
1367 uint64_t r_info;
1368 int64_t r_addend;
fea681da
MK
1369} Elf64_Rela;
1370.Ed
dd0a09a5 1371.Bl -tag -width "r_offset"
8d5bf179
MK
1372.It Dv r_offset
1373This member gives the location at which to apply the relocation action.
1374For a relocatable file, the value is the byte offset from the beginning
1375of the section to the storage unit affected by the relocation.
1376For an
1377executable file or shared object, the value is the virtual address of
1378the storage unit affected by the relocation.
1379.It Dv r_info
1380This member gives both the symbol table index with respect to which the
1381relocation must be made and the type of relocation to apply.
1382Relocation
1383types are processor-specific.
1384When the text refers to a relocation
1385entry's relocation type or symbol table index, it means the result of
1386applying
1387.Sy ELF_[32|64]_R_TYPE
1388or
1389.Sy ELF[32|64]_R_SYM ,
1390respectively, to the entry's
1391.Sy r_info
1392member.
1393.It Dv r_addend
1394This member specifies a constant addend used to compute the value to be
1395stored into the relocatable field.
1396.El
1397.Pp
c13182ef
MK
1398The .dynamic section contains a series of structures that hold relevant
1399dynamic linking information.
1400The d_tag member controls the interpretation
8d5bf179
MK
1401of d_un.
1402.Bd -literal -offset indent
1403typedef struct {
dd0a09a5
MK
1404 Elf32_Sword d_tag;
1405 union {
1406 Elf32_Word d_val;
1407 Elf32_Addr d_ptr;
1408 } d_un;
8d5bf179
MK
1409} Elf32_Dyn;
1410extern Elf32_Dyn _DYNAMIC[];
1411.Ed
1412.Bd -literal -offset indent
1413typedef struct {
dd0a09a5
MK
1414 Elf64_Sxword d_tag;
1415 union {
1416 Elf64_Xword d_val;
1417 Elf64_Addr d_ptr;
1418 } d_un;
8d5bf179
MK
1419} Elf64_Dyn;
1420extern Elf64_Dyn _DYNAMIC[];
1421.Ed
dd0a09a5 1422.Bl -tag -width "d_tag"
8d5bf179
MK
1423.It Dv d_tag
1424This member may have any of the following values:
1425.Bl -tag -width "DT_SYMBOLIC"
1426.It Dv DT_NULL
1427Marks end of dynamic section
1428.It Dv DT_NEEDED
1429String table offset to name of a needed library
1430.It Dv DT_PLTRELSZ
1431Size in bytes of PLT relocs
1432.It Dv DT_PLTGOT
1433Address of PLT and/or GOT
1434.It Dv DT_HASH
1435Address of symbol hash table
1436.It Dv DT_STRTAB
1437Address of string table
1438.It Dv DT_SYMTAB
1439Address of symbol table
1440.It Dv DT_RELA
1441Address of Rela relocs table
1442.It Dv DT_RELASZ
1443Size in bytes of Rela table
1444.It Dv DT_RELAENT
1445Size in bytes of a Rela table entry
1446.It Dv DT_STRSZ
1447Size in bytes of string table
1448.It Dv DT_SYMENT
1449Size in bytes of a symbol table entry
1450.It Dv DT_INIT
1451Address of the initialization function
1452.It Dv DT_FINI
1453Address of the termination function
1454.It Dv DT_SONAME
1455String table offset to name of shared object
1456.It Dv DT_RPATH
1457String table offset to library search path (deprecated)
1458.It Dv DT_SYMBOLIC
1459Alert linker to search this shared object before the executable for symbols
1460.It Dv DT_REL
1461Address of Rel relocs table
1462.It Dv DT_RELSZ
1463Size in bytes of Rel table
1464.It Dv DT_RELENT
1465Size in bytes of a Rel table entry
1466.It Dv DT_PLTREL
1467Type of reloc the PLT refers (Rela or Rel)
1468.It Dv DT_DEBUG
1469Undefined use for debugging
1470.It Dv DT_TEXTREL
1471Absence of this indicates no relocs should apply to a non-writable segment
1472.It Dv DT_JMPREL
1473Address of reloc entries solely for the PLT
1474.It Dv DT_BIND_NOW
c13182ef 1475Instruct dynamic linker to process all relocs before transferring control to
8d5bf179
MK
1476the executable
1477.It Dv DT_RUNPATH
1478String table offset to library search path
1479.It Dv DT_LOPROC
1480Start of processor-specific semantics
1481.It Dv DT_HIPROC
1482End of processor-specific semantics
1483.El
1484.It Dv d_val
1485This member represents integer values with various interpretations.
1486.It Dv d_ptr
c13182ef
MK
1487This member represents program virtual addresses.
1488When interpreting
1489these addresses, the actual address should be computed based on the
1490original file value and memory base address.
1491Files do not contain
8d5bf179
MK
1492relocation entries to fixup these addresses.
1493.It Dv _DYNAMIC
c13182ef 1494Array containing all the dynamic structures in the .dynamic section.
8d5bf179
MK
1495This is automatically populated by the linker.
1496.El
75434268
MK
1497.Sh NOTES
1498.\" .Ox
1499.\" ELF support first appeared in
1500.\" .Ox 1.2 ,
1501.\" although not all supported platforms use it as the native
1502.\" binary file format.
1503ELF first appeared in
e37e3282
MK
1504.At V .
1505The ELF format is an adopted standard.
d2dc6294
MK
1506.\" .Sh AUTHORS
1507.\" The original version of this manual page was written by
1508.\" .An Jeroen Ruigrok van der Werven
1509.\" .Aq asmodai@FreeBSD.org
1510.\" with inspiration from BSDi's
1511.\" .Bsx
1512.\" .Nm elf
1513.\" man page.
fea681da
MK
1514.Sh SEE ALSO
1515.Xr as 1 ,
1516.Xr gdb 1 ,
1517.Xr ld 1 ,
1518.Xr objdump 1 ,
d57d1b90 1519.Xr execve 2 ,
e1a9bc1b 1520.Xr core 5
fea681da
MK
1521.Rs
1522.%A Hewlett-Packard
1523.%B Elf-64 Object File Format
1524.Re
1525.Rs
1526.%A Santa Cruz Operation
1527.%B System V Application Binary Interface
1528.Re
1529.Rs
1530.%A Unix System Laboratories
1531.%T Object Files
1532.%B "Executable and Linking Format (ELF)"
1533.Re