]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man5/elf.5
Fix developer second name.
[FreeBSD/FreeBSD.git] / share / man / man5 / elf.5
1 .\" Copyright (c) 1999 Jeroen Ruigrok van der Werven
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
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.
12 .\"
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
23 .\" SUCH DAMAGE.
24 .\"
25 .\" $FreeBSD$
26 .\"
27 .Dd July 25, 2022
28 .Dt ELF 5
29 .Os
30 .Sh NAME
31 .Nm elf
32 .Nd format of ELF executable binary files
33 .Sh SYNOPSIS
34 .In elf.h
35 .Sh DESCRIPTION
36 The header file
37 .In elf.h
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
41 libraries.
42 .Pp
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.
46 The program header
47 table and the section header table's offset in the file are defined in the
48 ELF header.
49 The two tables describe the rest of the particularities of
50 the file.
51 .Pp
52 Applications which wish to process ELF binary files for their native
53 architecture only should include
54 .In elf.h
55 in their source code.
56 These applications should need to refer to
57 all the types and structures by their generic names
58 .Dq Elf_xxx
59 and to the macros by
60 .Dq ELF_xxx .
61 Applications written this way can be compiled on any architecture,
62 regardless whether the host is 32-bit or 64-bit.
63 .Pp
64 Should an application need to process ELF files of an unknown
65 architecture then the application needs to include both
66 .In sys/elf32.h
67 and
68 .In sys/elf64.h
69 instead of
70 .In elf.h .
71 Furthermore, all types and structures need to be identified by either
72 .Dq Elf32_xxx
73 or
74 .Dq Elf64_xxx .
75 The macros need to be identified by
76 .Dq ELF32_xxx
77 or
78 .Dq ELF64_xxx .
79 .Pp
80 Whatever the system's architecture is, it will always include
81 .In sys/elf_common.h
82 as well as
83 .In sys/elf_generic.h .
84 .Pp
85 These header files describe the above mentioned headers as C structures
86 and also include structures for dynamic sections, relocation sections and
87 symbol tables.
88 .Pp
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
97 .Ed
98 .Pp
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
109 .Ed
110 .Pp
111 All data structures that the file format defines follow the
112 .Dq natural
113 size and alignment guidelines for the relevant class.
114 If necessary,
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.
117 .Pp
118 The ELF header is described by the type Elf32_Ehdr or Elf64_Ehdr:
119 .Bd -literal -offset indent
120 typedef struct {
121         unsigned char   e_ident[EI_NIDENT];
122         Elf32_Half      e_type;
123         Elf32_Half      e_machine;
124         Elf32_Word      e_version;
125         Elf32_Addr      e_entry;
126         Elf32_Off       e_phoff;
127         Elf32_Off       e_shoff;
128         Elf32_Word      e_flags;
129         Elf32_Half      e_ehsize;
130         Elf32_Half      e_phentsize;
131         Elf32_Half      e_phnum;
132         Elf32_Half      e_shentsize;
133         Elf32_Half      e_shnum;
134         Elf32_Half      e_shstrndx;
135 } Elf32_Ehdr;
136 .Ed
137 .Bd -literal -offset indent
138 typedef struct {
139         unsigned char   e_ident[EI_NIDENT];
140         Elf64_Half      e_type;
141         Elf64_Half      e_machine;
142         Elf64_Word      e_version;
143         Elf64_Addr      e_entry;
144         Elf64_Off       e_phoff;
145         Elf64_Off       e_shoff;
146         Elf64_Word      e_flags;
147         Elf64_Half      e_ehsize;
148         Elf64_Half      e_phentsize;
149         Elf64_Half      e_phnum;
150         Elf64_Half      e_shentsize;
151         Elf64_Half      e_shnum;
152         Elf64_Half      e_shstrndx;
153 } Elf64_Ehdr;
154 .Ed
155 .Pp
156 The fields have the following meanings:
157 .Pp
158 .Bl -tag -width "e_phentsize" -compact -offset indent
159 .It Dv e_ident
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
163 the prefix
164 .Sy EI_
165 and may contain values which start with the prefix
166 .Sy ELF .
167 The following macros are defined:
168 .Pp
169 .Bl -tag -width "EI_ABIVERSION" -compact
170 .It Dv EI_MAG0
171 The first byte of the magic number.
172 It must be filled with
173 .Sy ELFMAG0 .
174 .It Dv EI_MAG1
175 The second byte of the magic number.
176 It must be filled with
177 .Sy ELFMAG1 .
178 .It Dv EI_MAG2
179 The third byte of the magic number.
180 It must be filled with
181 .Sy ELFMAG2 .
182 .It Dv EI_MAG3
183 The fourth byte of the magic number.
184 It must be filled with
185 .Sy ELFMAG3 .
186 .It Dv EI_CLASS
187 The fifth byte identifies the architecture for this binary:
188 .Pp
189 .Bl -tag -width "ELFCLASSNONE" -compact
190 .It Dv ELFCLASSNONE
191 This class is invalid.
192 .It Dv ELFCLASS32
193 This defines the 32-bit architecture.
194 It supports machines with files
195 and virtual address spaces up to 4 Gigabytes.
196 .It Dv ELFCLASS64
197 This defines the 64-bit architecture.
198 .El
199 .It Dv EI_DATA
200 The sixth byte specifies the data encoding of the processor-specific
201 data in the file.
202 Currently these encodings are supported:
203 .Pp
204 .Bl -tag -width "ELFDATA2LSB" -compact
205 .It Dv ELFDATANONE
206 Unknown data format.
207 .It Dv ELFDATA2LSB
208 Two's complement, little-endian.
209 .It Dv ELFDATA2MSB
210 Two's complement, big-endian.
211 .El
212 .It Dv EI_VERSION
213 The version number of the ELF specification:
214 .Pp
215 .Bl -tag -width "EV_CURRENT" -compact
216 .It Dv EV_NONE
217 Invalid version.
218 .It Dv EV_CURRENT
219 Current version.
220 .El
221 .It Dv EI_OSABI
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:
228 .Pp
229 .Bl -tag -width "ELFOSABI_STANDALONE" -compact
230 .It Dv ELFOSABI_SYSV
231 UNIX System V ABI.
232 .It Dv ELFOSABI_HPUX
233 HP-UX operating system ABI.
234 .It Dv ELFOSABI_NETBSD
235 .Nx
236 operating system ABI.
237 .It Dv ELFOSABI_LINUX
238 GNU/Linux operating system ABI.
239 .It Dv ELFOSABI_HURD
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.
247 .It Dv ELFOSABI_IRIX
248 IRIX operating system ABI.
249 .It Dv ELFOSABI_FREEBSD
250 .Fx
251 operating system ABI.
252 .It Dv ELFOSABI_TRU64
253 TRU64 UNIX operating system ABI.
254 .It Dv ELFOSABI_ARM
255 ARM architecture ABI.
256 .It Dv ELFOSABI_STANDALONE
257 Standalone (embedded) ABI.
258 .El
259 .It Dv EI_ABIVERSION
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.
266 .It Dv EI_PAD
267 Start of padding.
268 These bytes are reserved and set to zero.
269 Programs
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.
273 .It Dv EI_BRAND
274 Start of architecture identification.
275 .It Dv EI_NIDENT
276 The size of the e_ident array.
277 .El
278 .Pp
279 .It Dv e_type
280 This member of the structure identifies the object file type:
281 .Pp
282 .Bl -tag -width "ET_NONE" -compact
283 .It Dv ET_NONE
284 An unknown type.
285 .It Dv ET_REL
286 A relocatable file.
287 .It Dv ET_EXEC
288 An executable file.
289 .It Dv ET_DYN
290 A shared object.
291 .It Dv ET_CORE
292 A core file.
293 .El
294 .Pp
295 .It Dv e_machine
296 This member specifies the required architecture for an individual file:
297 .Pp
298 .Bl -tag -width "EM_MIPS_RS4_BE" -compact
299 .It Dv EM_NONE
300 An unknown machine.
301 .It Dv EM_M32
302 AT&T WE 32100.
303 .It Dv EM_SPARC
304 Sun Microsystems SPARC.
305 .It Dv EM_386
306 Intel 80386.
307 .It Dv EM_68K
308 Motorola 68000.
309 .It Dv EM_88K
310 Motorola 88000.
311 .It Dv EM_486
312 Intel 80486.
313 .It Dv EM_860
314 Intel 80860.
315 .It Dv EM_MIPS
316 MIPS RS3000 (big-endian only).
317 .It Dv EM_MIPS_RS4_BE
318 MIPS RS4000 (big-endian only).
319 .It Dv EM_SPARC64
320 SPARC v9 64-bit unofficial.
321 .It Dv EM_PARISC
322 HPPA.
323 .It Dv EM_PPC
324 PowerPC.
325 .It Dv EM_ALPHA
326 Compaq [DEC] Alpha.
327 .El
328 .Pp
329 .It Dv e_version
330 This member identifies the file version:
331 .Pp
332 .Bl -tag -width "EV_CURRENT" -compact
333 .It Dv EV_NONE
334 Invalid version
335 .It Dv EV_CURRENT
336 Current version
337 .El
338 .It Dv e_entry
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.
343 .It Dv e_phoff
344 This member holds the program header table's file offset in bytes.
345 If
346 the file has no program header table, this member holds zero.
347 .It Dv e_shoff
348 This member holds the section header table's file offset in bytes.
349 If the
350 file has no section header table this member holds zero.
351 .It Dv e_flags
352 This member holds processor-specific flags associated with the file.
353 Flag
354 names take the form EF_`machine_flag'.
355 Currently no flags have been defined.
356 .It Dv e_ehsize
357 This member holds the ELF header's size in bytes.
358 .It Dv e_phentsize
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.
361 .It Dv e_phnum
362 This member holds the number of entries in the program header
363 table.
364 If the file is using extended program header numbering, then the
365 .Sy e_phnum
366 member will contain the value
367 .Dv PN_XNUM
368 and the actual number of program header table entries will be stored
369 in the
370 .Sy sh_info
371 member of the section header at index
372 .Dv SHN_UNDEF .
373 The product of
374 .Sy e_phentsize
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,
378 .Sy e_phnum
379 holds the value zero.
380 .It Dv e_shentsize
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.
384 .It Dv e_shnum
385 This member holds the number of entries in the section header table.
386 If the file is using extended section numbering, then the
387 .Sy e_shnum
388 member will be zero and the actual section number will be stored in the
389 .Sy sh_size
390 member of the section header at index
391 .Dv SHN_UNDEF .
392 If a file has no section header table, both the
393 .Sy e_shnum
394 and the
395 .Sy e_shoff
396 fields of the ELF header will be zero.
397 The product of
398 .Sy e_shentsize
399 and the number of sections in the file gives the section header
400 table's size in bytes.
401 .It Dv e_shstrndx
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
405 value
406 .Sy SHN_XINDEX ,
407 and the actual section header table index will be present in the
408 .Sy sh_link
409 field of the section header entry at index
410 .Dv SHN_UNDEF .
411 If the file has no section name string
412 table, this member holds the value
413 .Sy SHN_UNDEF .
414 .El
415 .Pp
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.
419 An object file
420 .Em segment
421 contains one or more
422 .Em sections .
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
425 .Sy e_phentsize
426 and
427 .Sy e_phnum
428 members.
429 As with the Elf executable header, the program header
430 also has different versions depending on the architecture:
431 .Bd -literal -offset indent
432 typedef struct {
433         Elf32_Word      p_type;
434         Elf32_Off       p_offset;
435         Elf32_Addr      p_vaddr;
436         Elf32_Addr      p_paddr;
437         Elf32_Word      p_filesz;
438         Elf32_Word      p_memsz;
439         Elf32_Word      p_flags;
440         Elf32_Word      p_align;
441 } Elf32_Phdr;
442 .Ed
443 .Bd -literal -offset indent
444 typedef struct {
445         Elf64_Word      p_type;
446         Elf64_Word      p_flags;
447         Elf64_Off       p_offset;
448         Elf64_Addr      p_vaddr;
449         Elf64_Addr      p_paddr;
450         Elf64_Xword     p_filesz;
451         Elf64_Xword     p_memsz;
452         Elf64_Xword     p_align;
453 } Elf64_Phdr;
454 .Ed
455 .Pp
456 The main difference between the 32-bit and the 64-bit program header lies
457 only in the location of a
458 .Sy p_flags
459 member in the total struct.
460 .Pp
461 .Bl -tag -width "p_offset" -compact -offset indent
462 .It Dv p_type
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.
465 .Pp
466 .Bl -tag -width "PT_DYNAMIC" -compact
467 .It Dv PT_NULL
468 The array element is unused and the other members' values are undefined.
469 This lets the program header have ignored entries.
470 .It Dv PT_LOAD
471 The array element specifies a loadable segment, described by
472 .Sy p_filesz
473 and
474 .Sy p_memsz .
475 The bytes from the file are mapped to the beginning of the memory
476 segment.
477 If the segment's memory size
478 .Pq Sy p_memsz
479 is larger than the file size
480 .Pq Sy p_filesz ,
481 the
482 .Dq extra
483 bytes are defined to hold the value 0 and to follow the segment's
484 initialized area.
485 The file size may not be larger than the memory size.
486 Loadable segment entries in the program header table appear in ascending
487 order, sorted on the
488 .Sy p_vaddr
489 member.
490 .It Dv PT_DYNAMIC
491 The array element specifies dynamic linking information.
492 .It Dv PT_INTERP
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).
497 However
498 it may not occur more than once in a file.
499 If it is present it must precede
500 any loadable segment entry.
501 .It Dv PT_NOTE
502 The array element specifies the location and size for auxiliary information.
503 .It Dv PT_SHLIB
504 This segment type is reserved but has unspecified semantics.
505 Programs that
506 contain an array element of this type do not conform to the ABI.
507 .It Dv PT_PHDR
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.
511 Moreover, it may
512 only occur if the program header table is part of the memory image of the
513 program.
514 If it is present it must precede any loadable segment entry.
515 .It Dv PT_LOPROC
516 This value up to and including
517 .Sy PT_HIPROC
518 are reserved for processor-specific semantics.
519 .It Dv PT_HIPROC
520 This value down to and including
521 .Sy PT_LOPROC
522 are reserved for processor-specific semantics.
523 .El
524 .Pp
525 .It Dv p_offset
526 This member holds the offset from the beginning of the file at which
527 the first byte of the segment resides.
528 .It Dv p_vaddr
529 This member holds the virtual address at which the first byte of the
530 segment resides in memory.
531 .It Dv p_paddr
532 On systems for which physical addressing is relevant, this member is
533 reserved for the segment's physical address.
534 Under
535 .Bx
536 this member is
537 not used and must be zero.
538 .It Dv p_filesz
539 This member holds the number of bytes in the file image of the segment.
540 It may be zero.
541 .It Dv p_memsz
542 This member holds the number of bytes in the memory image of the segment.
543 It may be zero.
544 .It Dv p_flags
545 This member holds flags relevant to the segment:
546 .Pp
547 .Bl -tag -width "PF_X" -compact
548 .It Dv PF_X
549 An executable segment.
550 .It Dv PF_W
551 A writable segment.
552 .It Dv PF_R
553 A readable segment.
554 .El
555 .Pp
556 A text segment commonly has the flags
557 .Sy PF_X
558 and
559 .Sy PF_R .
560 A data segment commonly has
561 .Sy PF_X ,
562 .Sy PF_W
563 and
564 .Sy PF_R .
565 .It Dv p_align
566 This member holds the value to which the segments are aligned in memory
567 and in the file.
568 Loadable process segments must have congruent values for
569 .Sy p_vaddr
570 and
571 .Sy p_offset ,
572 modulo the page size.
573 Values of zero and one mean no alignment is required.
574 Otherwise,
575 .Sy p_align
576 should be a positive, integral power of two, and
577 .Sy p_vaddr
578 should equal
579 .Sy p_offset ,
580 modulo
581 .Sy p_align .
582 .El
583 .Pp
584 An file's section header table lets one locate all the file's sections.
585 The
586 section header table is an array of Elf32_Shdr or Elf64_Shdr structures.
587 The
588 ELF header's
589 .Sy e_shoff
590 member gives the byte offset from the beginning of the file to the section
591 header table.
592 .Sy e_shnum
593 holds the number of entries the section header table contains.
594 .Sy e_shentsize
595 holds the size in bytes of each entry.
596 .Pp
597 A section header table index is a subscript into this array.
598 Some section
599 header table indices are reserved.
600 An object file does not have sections for
601 these special indices:
602 .Pp
603 .Bl -tag -width "SHN_LORESERVE" -compact
604 .It Dv SHN_UNDEF
605 This value marks an undefined, missing, irrelevant, or otherwise meaningless
606 section reference.
607 For example, a symbol
608 .Dq defined
609 relative to section number
610 .Sy SHN_UNDEF
611 is an undefined symbol.
612 .It Dv SHN_LORESERVE
613 This value specifies the lower bound of the range of reserved indices.
614 .It Dv SHN_LOPROC
615 This value up to and including
616 .Sy SHN_HIPROC
617 are reserved for processor-specific semantics.
618 .It Dv SHN_HIPROC
619 This value down to and including
620 .Sy SHN_LOPROC
621 are reserved for processor-specific semantics.
622 .It Dv SHN_ABS
623 This value specifies absolute values for the corresponding reference.
624 For
625 example, symbols defined relative to section number
626 .Sy SHN_ABS
627 have absolute values and are not affected by relocation.
628 .It Dv SHN_COMMON
629 Symbols defined relative to this section are common symbols, such as FORTRAN
630 COMMON or unallocated C external variables.
631 .It Dv SHN_HIRESERVE
632 This value specifies the upper bound of the range of reserved indices.
633 The
634 system reserves indices between
635 .Sy SHN_LORESERVE
636 and
637 .Sy SHN_HIRESERVE ,
638 inclusive.
639 The section header table does not contain entries for the
640 reserved indices.
641 .El
642 .Pp
643 The section header has the following structure:
644 .Bd -literal -offset indent
645 typedef struct {
646         Elf32_Word      sh_name;
647         Elf32_Word      sh_type;
648         Elf32_Word      sh_flags;
649         Elf32_Addr      sh_addr;
650         Elf32_Off       sh_offset;
651         Elf32_Word      sh_size;
652         Elf32_Word      sh_link;
653         Elf32_Word      sh_info;
654         Elf32_Word      sh_addralign;
655         Elf32_Word      sh_entsize;
656 } Elf32_Shdr;
657 .Ed
658 .Bd -literal -offset indent
659 typedef struct {
660         Elf64_Word      sh_name;
661         Elf64_Word      sh_type;
662         Elf64_Xword     sh_flags;
663         Elf64_Addr      sh_addr;
664         Elf64_Off       sh_offset;
665         Elf64_Xword     sh_size;
666         Elf64_Word      sh_link;
667         Elf64_Word      sh_info;
668         Elf64_Xword     sh_addralign;
669         Elf64_Xword     sh_entsize;
670 } Elf64_Shdr;
671 .Ed
672 .Pp
673 .Bl -tag -width "sh_addralign" -compact
674 .It Dv sh_name
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.
679 .It Dv sh_type
680 This member categorizes the section's contents and semantics.
681 .Pp
682 .Bl -tag -width "SHT_PROGBITS" -compact
683 .It Dv SHT_NULL
684 This value marks the section header as inactive.
685 It does not
686 have an associated section.
687 Other members of the section header
688 have undefined values.
689 .It Dv SHT_PROGBITS
690 The section holds information defined by the program, whose
691 format and meaning are determined solely by the program.
692 .It Dv SHT_SYMTAB
693 This section holds a symbol table.
694 Typically,
695 .Sy SHT_SYMTAB
696 provides symbols for link editing, though it may also be used
697 for dynamic linking.
698 As a complete symbol table, it may contain
699 many symbols unnecessary for dynamic linking.
700 An object file can
701 also contain a
702 .Sy SHN_DYNSYM
703 section.
704 .It Dv SHT_STRTAB
705 This section holds a string table.
706 An object file may have multiple
707 string table sections.
708 .It Dv SHT_RELA
709 This section holds relocation entries with explicit addends, such
710 as type
711 .Sy Elf32_Rela
712 for the 32-bit class of object files.
713 An object may have multiple
714 relocation sections.
715 .It Dv SHT_HASH
716 This section holds a symbol hash table.
717 All object participating in
718 dynamic linking must contain a symbol hash table.
719 An object file may
720 have only one hash table.
721 .It Dv SHT_DYNAMIC
722 This section holds information for dynamic linking.
723 An object file may
724 have only one dynamic section.
725 .It Dv SHT_NOTE
726 This section holds information that marks the file in some way.
727 .It Dv SHT_NOBITS
728 A section of this type occupies no space in the file but otherwise
729 resembles
730 .Sy SHN_PROGBITS .
731 Although this section contains no bytes, the
732 .Sy sh_offset
733 member contains the conceptual file offset.
734 .It Dv SHT_REL
735 This section holds relocation offsets without explicit addends, such
736 as type
737 .Sy Elf32_Rel
738 for the 32-bit class of object files.
739 An object file may have multiple
740 relocation sections.
741 .It Dv SHT_SHLIB
742 This section is reserved but has unspecified semantics.
743 .It Dv SHT_DYNSYM
744 This section holds a minimal set of dynamic linking symbols.
745 An
746 object file can also contain a
747 .Sy SHN_SYMTAB
748 section.
749 .It Dv SHT_LOPROC
750 This value up to and including
751 .Sy SHT_HIPROC
752 are reserved for processor-specific semantics.
753 .It Dv SHT_HIPROC
754 This value down to and including
755 .Sy SHT_LOPROC
756 are reserved for processor-specific semantics.
757 .It Dv SHT_LOUSER
758 This value specifies the lower bound of the range of indices reserved for
759 application programs.
760 .It Dv SHT_HIUSER
761 This value specifies the upper bound of the range of indices reserved for
762 application programs.
763 Section types between
764 .Sy SHT_LOUSER
765 and
766 .Sy SHT_HIUSER
767 may be used by the application, without conflicting with current or future
768 system-defined section types.
769 .El
770 .Pp
771 .It Dv sh_flags
772 Sections support one-bit flags that describe miscellaneous attributes.
773 If a flag bit is set in
774 .Sy sh_flags ,
775 the attribute is
776 .Dq on
777 for the section.
778 Otherwise, the attribute is
779 .Dq off
780 or does not apply.
781 Undefined attributes are set to zero.
782 .Pp
783 .Bl -tag -width "SHF_EXECINSTR" -compact
784 .It Dv SHF_WRITE
785 This section contains data that should be writable during process
786 execution.
787 .It Dv SHF_ALLOC
788 The section occupies memory during process execution.
789 Some control
790 sections do not reside in the memory image of an object file.
791 This
792 attribute is off for those sections.
793 .It Dv SHF_EXECINSTR
794 The section contains executable machine instructions.
795 .It Dv SHF_MASKPROC
796 All bits included in this mask are reserved for processor-specific
797 semantics.
798 .It Dv SHF_COMPRESSED
799 The section data is compressed.
800 .El
801 .Pp
802 .It Dv sh_addr
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.
806 .It Dv sh_offset
807 This member's value holds the byte offset from the beginning of the file
808 to the first byte in the section.
809 One section type,
810 .Sy SHT_NOBITS ,
811 occupies no space in the file, and its
812 .Sy sh_offset
813 member locates the conceptual placement in the file.
814 .It Dv sh_size
815 This member holds the section's size in bytes.
816 Unless the section type
817 is
818 .Sy SHT_NOBITS ,
819 the section occupies
820 .Sy sh_size
821 bytes in the file.
822 A section of type
823 .Sy SHT_NOBITS
824 may have a non-zero size, but it occupies no space in the file.
825 .It Dv sh_link
826 This member holds a section header table index link, whose interpretation
827 depends on the section type.
828 .It Dv sh_info
829 This member holds extra information, whose interpretation depends on the
830 section type.
831 .It Dv sh_addralign
832 Some sections have address alignment constraints.
833 If a section holds a
834 doubleword, the system must ensure doubleword alignment for the entire
835 section.
836 That is, the value of
837 .Sy sh_addr
838 must be congruent to zero, modulo the value of
839 .Sy sh_addralign .
840 Only zero and positive integral powers of two are allowed.
841 Values of zero
842 or one mean the section has no alignment constraints.
843 .It Dv sh_entsize
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
847 fixed-size entries.
848 .El
849 .Pp
850 Various sections hold program and control information:
851 .Bl -tag -width ".shstrtab" -compact
852 .It .bss
853 (Block Started by Symbol)
854 This section holds uninitialized data that contributes to the program's
855 memory image.
856 By definition, the system initializes the data with zeros
857 when the program begins to run.
858 This section is of type
859 .Sy SHT_NOBITS .
860 The attributes types are
861 .Sy SHF_ALLOC
862 and
863 .Sy SHF_WRITE .
864 .It .comment
865 This section holds version control information.
866 This section is of type
867 .Sy SHT_PROGBITS .
868 No attribute types are used.
869 .It .data
870 This section holds initialized data that contribute to the program's
871 memory image.
872 This section is of type
873 .Sy SHT_PROGBITS .
874 The attribute types are
875 .Sy SHF_ALLOC
876 and
877 .Sy SHF_WRITE .
878 .It .data1
879 This section holds initialized data that contribute to the program's
880 memory image.
881 This section is of type
882 .Sy SHT_PROGBITS .
883 The attribute types are
884 .Sy SHF_ALLOC
885 and
886 .Sy SHF_WRITE .
887 .It .debug
888 This section holds information for symbolic debugging.
889 The contents
890 are unspecified.
891 This section is of type
892 .Sy SHT_PROGBITS .
893 No attribute types are used.
894 .It .dynamic
895 This section holds dynamic linking information.
896 The section's attributes
897 will include the
898 .Sy SHF_ALLOC
899 bit.
900 Whether the
901 .Sy SHF_WRITE
902 bit is set is processor-specific.
903 This section is of type
904 .Sy SHT_DYNAMIC .
905 See the attributes above.
906 .It .dynstr
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
910 .Sy SHT_STRTAB .
911 The attribute type used is
912 .Sy SHF_ALLOC .
913 .It .dynsym
914 This section holds the dynamic linking symbol table.
915 This section is of type
916 .Sy SHT_DYNSYM .
917 The attribute used is
918 .Sy SHF_ALLOC .
919 .It .fini
920 This section holds executable instructions that contribute to the process
921 termination code.
922 When a program exits normally the system arranges to
923 execute the code in this section.
924 This section is of type
925 .Sy SHT_PROGBITS .
926 The attributes used are
927 .Sy SHF_ALLOC
928 and
929 .Sy SHF_EXECINSTR .
930 .It .got
931 This section holds the global offset table.
932 This section is of type
933 .Sy SHT_PROGBITS .
934 The attributes are processor-specific.
935 .It .hash
936 This section holds a symbol hash table.
937 This section is of type
938 .Sy SHT_HASH .
939 The attribute used is
940 .Sy SHF_ALLOC .
941 .It .init
942 This section holds executable instructions that contribute to the process
943 initialization code.
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
947 .Sy SHT_PROGBITS .
948 The attributes used are
949 .Sy SHF_ALLOC
950 and
951 .Sy SHF_EXECINSTR .
952 .It .interp
953 This section holds the pathname of a program interpreter.
954 If the file has
955 a loadable segment that includes the section, the section's attributes will
956 include the
957 .Sy SHF_ALLOC
958 bit.
959 Otherwise, that bit will be off.
960 This section is of type
961 .Sy SHT_PROGBITS .
962 .It .line
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
967 .Sy SHT_PROGBITS .
968 No attribute types are used.
969 .It .note
970 This section holds information in the
971 .Dq Note Section
972 format described below.
973 This section is of type
974 .Sy SHT_NOTE .
975 No attribute types are used.
976 .It .plt
977 This section holds the procedure linkage table.
978 This section is of type
979 .Sy SHT_PROGBITS .
980 The attributes are processor-specific.
981 .It .relNAME
982 This section holds relocation information as described below.
983 If the file
984 has a loadable segment that includes relocation, the section's attributes
985 will include the
986 .Sy SHF_ALLOC
987 bit.
988 Otherwise the bit will be off.
989 By convention,
990 .Dq NAME
991 is supplied by the section to which the relocations apply.
992 Thus a relocation
993 section for
994 .Sy .text
995 normally would have the name
996 .Sy .rel.text .
997 This section is of type
998 .Sy SHT_REL .
999 .It .relaNAME
1000 This section holds relocation information as described below.
1001 If the file
1002 has a loadable segment that includes relocation, the section's attributes
1003 will include the
1004 .Sy SHF_ALLOC
1005 bit.
1006 Otherwise the bit will be off.
1007 By convention,
1008 .Dq NAME
1009 is supplied by the section to which the relocations apply.
1010 Thus a relocation
1011 section for
1012 .Sy .text
1013 normally would have the name
1014 .Sy .rela.text .
1015 This section is of type
1016 .Sy SHT_RELA .
1017 .It .rodata
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
1021 .Sy SHT_PROGBITS .
1022 The attribute used is
1023 .Sy SHF_ALLOC .
1024 .It .rodata1
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
1028 .Sy SHT_PROGBITS .
1029 The attribute used is
1030 .Sy SHF_ALLOC .
1031 .It .shstrtab
1032 This section holds section names.
1033 This section is of type
1034 .Sy SHT_STRTAB .
1035 No attribute types are used.
1036 .It .strtab
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
1041 will include the
1042 .Sy SHF_ALLOC
1043 bit.
1044 Otherwise the bit will be off.
1045 This section is of type
1046 .Sy SHT_STRTAB .
1047 .It .symtab
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
1051 the
1052 .Sy SHF_ALLOC
1053 bit.
1054 Otherwise the bit will be off.
1055 This section is of type
1056 .Sy SHT_SYMTAB .
1057 .It .text
1058 This section holds the
1059 .Dq text ,
1060 or executable instructions, of a program.
1061 This section is of type
1062 .Sy SHT_PROGBITS .
1063 The attributes used are
1064 .Sy SHF_ALLOC
1065 and
1066 .Sy SHF_EXECINSTR .
1067 .It .jcr
1068 This section holds information about Java classes that must
1069 be registered.
1070 .It .eh_frame
1071 This section holds information used for C++ exception-handling.
1072 .El
1073 .Pp
1074 A section with the
1075 .Dv SHF_COMPRESSED
1076 flag set contains a compressed copy of the section data.
1077 Compressed section data begins with an
1078 .Vt Elf64_Chdr
1079 or
1080 .Vt Elf32_Chdr structure
1081 which encodes the compression algorithm and some characteristics of the
1082 uncompressed data.
1083 .Bd -literal -offset indent
1084 typedef struct {
1085         Elf32_Word    ch_type;
1086         Elf32_Word    ch_size;
1087         Elf32_Word    ch_addralign;
1088 } Elf32_Chdr;
1089 .Ed
1090 .Bd -literal -offset indent
1091 typedef struct {
1092         Elf64_Word    ch_type;
1093         Elf64_Word    ch_reserved;
1094         Elf64_Xword   ch_size;
1095         Elf64_Xword   ch_addralign;
1096 } Elf64_Chdr;
1097 .Ed
1098 .Pp
1099 .Bl -tag -width "ch_addralign" -compact
1100 .It Dv ch_type
1101 The compression algorithm used.
1102 A value of
1103 .Dv ELFCOMPRESS_ZLIB
1104 indicates that the data is compressed using
1105 .Xr zlib 3 .
1106 A value of
1107 .Dv ELFCOMPRESS_ZSTD
1108 indicates that the data is compressed using
1109 Zstandard.
1110 .It Dv ch_size
1111 The size, in bytes, of the uncompressed section data.
1112 This corresponds to the
1113 .Sy sh_size
1114 field of a section header containing uncompressed data.
1115 .It Dv ch_addralign
1116 The address alignment of the uncompressed section data.
1117 This corresponds to the
1118 .Sy sh_addralign
1119 field of a section header containing uncompressed data.
1120 .El
1121 .Pp
1122 String table sections hold null-terminated character sequences, commonly
1123 called strings.
1124 The object file uses these strings to represent symbol
1125 and section names.
1126 One references a string as an index into the string
1127 table section.
1128 The first byte, which is index zero, is defined to hold
1129 a null character.
1130 Similarly, a string table's last byte is defined to
1131 hold a null character, ensuring null termination for all strings.
1132 .Pp
1133 An object file's symbol table holds information needed to locate and
1134 relocate a program's symbolic definitions and references.
1135 A symbol table
1136 index is a subscript into this array.
1137 .Bd -literal -offset indent
1138 typedef struct {
1139         Elf32_Word      st_name;
1140         Elf32_Addr      st_value;
1141         Elf32_Word      st_size;
1142         unsigned char   st_info;
1143         unsigned char   st_other;
1144         Elf32_Half      st_shndx;
1145 } Elf32_Sym;
1146 .Ed
1147 .Bd -literal -offset indent
1148 typedef struct {
1149         Elf64_Word      st_name;
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;
1155 } Elf64_Sym;
1156 .Ed
1157 .Pp
1158 .Bl -tag -width "st_value" -compact
1159 .It Dv st_name
1160 This member holds an index into the object file's symbol string table,
1161 which holds character representations of the symbol names.
1162 If the value
1163 is non-zero, it represents a string table index that gives the symbol
1164 name.
1165 Otherwise, the symbol table has no name.
1166 .It Dv st_value
1167 This member gives the value of the associated symbol.
1168 .It Dv st_size
1169 Many symbols have associated sizes.
1170 This member holds zero if the symbol
1171 has no size or an unknown size.
1172 .It Dv st_info
1173 This member specifies the symbol's type and binding attributes:
1174 .Pp
1175 .Bl -tag -width "STT_SECTION" -compact
1176 .It Dv STT_NOTYPE
1177 The symbol's type is not defined.
1178 .It Dv STT_OBJECT
1179 The symbol is associated with a data object.
1180 .It Dv STT_FUNC
1181 The symbol is associated with a function or other executable code.
1182 .It Dv STT_SECTION
1183 The symbol is associated with a section.
1184 Symbol table entries of
1185 this type exist primarily for relocation and normally have
1186 .Sy STB_LOCAL
1187 bindings.
1188 .It Dv STT_FILE
1189 By convention the symbol's name gives the name of the source file
1190 associated with the object file.
1191 A file symbol has
1192 .Sy STB_LOCAL
1193 bindings, its section index is
1194 .Sy SHN_ABS ,
1195 and it precedes the other
1196 .Sy STB_LOCAL
1197 symbols of the file, if it is present.
1198 .It Dv STT_LOPROC
1199 This value up to and including
1200 .Sy STT_HIPROC
1201 are reserved for processor-specific semantics.
1202 .It Dv STT_HIPROC
1203 This value down to and including
1204 .Sy STT_LOPROC
1205 are reserved for processor-specific semantics.
1206 .El
1207 .Pp
1208 .Bl -tag -width "STB_GLOBAL" -compact
1209 .It Dv STB_LOCAL
1210 Local symbols are not visible outside the object file containing their
1211 definition.
1212 Local symbols of the same name may exist in multiple file
1213 without interfering with each other.
1214 .It Dv STB_GLOBAL
1215 Global symbols are visible to all object files being combined.
1216 One file's
1217 definition of a global symbol will satisfy another file's undefined
1218 reference to the same symbol.
1219 .It Dv STB_WEAK
1220 Weak symbols resemble global symbols, but their definitions have lower
1221 precedence.
1222 .It Dv STB_LOPROC
1223 This value up to and including
1224 .Sy STB_HIPROC
1225 are reserved for processor-specific semantics.
1226 .It Dv STB_HIPROC
1227 This value down to and including
1228 .Sy STB_LOPROC
1229 are reserved for processor-specific semantics.
1230 .Pp
1231 There are macros for packing and unpacking the binding and type fields:
1232 .Pp
1233 .Bl -tag -width "ELF32_ST_INFO(bind, type)" -compact
1234 .It Xo
1235 .Fn ELF32_ST_BIND info
1236 .Xc
1237 or
1238 .Fn ELF64_ST_BIND info
1239 extract a binding from an st_info value.
1240 .It Xo
1241 .Fn ELF64_ST_TYPE info
1242 .Xc
1243 or
1244 .Fn ELF32_ST_TYPE info
1245 extract a type from an st_info value.
1246 .It Xo
1247 .Fn ELF32_ST_INFO bind type
1248 .Xc
1249 or
1250 .Fn ELF64_ST_INFO bind type
1251 convert a binding and a type into an st_info value.
1252 .El
1253 .El
1254 .Pp
1255 .It Dv st_other
1256 This member currently holds zero and has no defined meaning.
1257 .It Dv st_shndx
1258 Every symbol table entry is
1259 .Dq defined
1260 in relation to some section.
1261 This member holds the relevant section
1262 header table index.
1263 .El
1264 .Pp
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'
1270 program image.
1271 Relocation entries are these data.
1272 .Pp
1273 Relocation structures that do not need an addend:
1274 .Bd -literal -offset indent
1275 typedef struct {
1276         Elf32_Addr      r_offset;
1277         Elf32_Word      r_info;
1278 } Elf32_Rel;
1279 .Ed
1280 .Bd -literal -offset indent
1281 typedef struct {
1282         Elf64_Addr      r_offset;
1283         Elf64_Xword     r_info;
1284 } Elf64_Rel;
1285 .Ed
1286 .Pp
1287 Relocation structures that need an addend:
1288 .Bd -literal -offset indent
1289 typedef struct {
1290         Elf32_Addr      r_offset;
1291         Elf32_Word      r_info;
1292         Elf32_Sword     r_addend;
1293 } Elf32_Rela;
1294 .Ed
1295 .Bd -literal -offset indent
1296 typedef struct {
1297         Elf64_Addr      r_offset;
1298         Elf64_Xword     r_info;
1299         Elf64_Sxword    r_addend;
1300 } Elf64_Rela;
1301 .Ed
1302 .Pp
1303 .Bl -tag -width "r_offset" -compact
1304 .It Dv r_offset
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.
1308 For an
1309 executable file or shared object, the value is the virtual address of
1310 the storage unit affected by the relocation.
1311 .It Dv r_info
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.
1314 Relocation
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
1318 applying
1319 .Sy ELF_[32|64]_R_TYPE
1320 or
1321 .Sy ELF[32|64]_R_SYM ,
1322 respectively to the entry's
1323 .Sy r_info
1324 member.
1325 .It Dv r_addend
1326 This member specifies a constant addend used to compute the value to be
1327 stored into the relocatable field.
1328 .El
1329 .Ss Note Section
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
1338 .El
1339 .Pp
1340 The
1341 .Va name
1342 and
1343 .Va desc
1344 fields are padded to ensure 4-byte alignemnt.
1345 .Va namesz
1346 and
1347 .Va descsz
1348 specify the unpadded length.
1349 .Pp
1350 .Fx
1351 defines the following ELF note types
1352 .Po with corresponding interpretation of
1353 .Va desc Pc :
1354 .Bl -tag -width 4n
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
1357 ABI version
1358 .Po i.e.,
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
1362 .Xr rtld 1
1363 must do so.
1364 .Va desc
1365 is ignored.
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:
1370 .Bl -tag -width 4n
1371 .It NT_FREEBSD_FCTL_ASLR_DISABLE Pq Value: 0x01
1372 Request that address randomization (ASLR) not be performed.
1373 See
1374 .Xr security 7 .
1375 .It NT_FREEBSD_FCTL_PROTMAX_DISABLE Pq Value: 0x02
1376 Request that
1377 .Xr mmap 2
1378 calls not set PROT_MAX to the initial value of the
1379 .Fa prot
1380 argument.
1381 .It NT_FREEBSD_FCTL_STKGAP_DISABLE Pq Value: 0x04
1382 Disable stack gap.
1383 .It NT_FREEBSD_FCTL_WXNEEDED Pq Value: 0x08
1384 Indicate that the binary requires mappings that are simultaneously
1385 writeable and executable.
1386 .El
1387 .El
1388 .Sh SEE ALSO
1389 .Xr as 1 ,
1390 .Xr gdb 1 Pq Pa ports/devel/gdb ,
1391 .Xr ld 1 ,
1392 .Xr objdump 1 ,
1393 .Xr readelf 1 ,
1394 .Xr execve 2 ,
1395 .Xr zlib 3 ,
1396 .Xr ar 5 ,
1397 .Xr core 5
1398 .Rs
1399 .%A Hewlett Packard
1400 .%B Elf-64 Object File Format
1401 .Re
1402 .Rs
1403 .%A Santa Cruz Operation
1404 .%B System V Application Binary Interface
1405 .Re
1406 .Rs
1407 .%A Unix System Laboratories
1408 .%T Object Files
1409 .%B "Executable and Linking Format (ELF)"
1410 .Re
1411 .Sh HISTORY
1412 The ELF header files made their appearance in
1413 .Fx 2.2.6 .
1414 ELF in itself first appeared in
1415 .At V .
1416 The ELF format is an adopted standard.
1417 .Sh AUTHORS
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
1421 .Bsx
1422 .Nm
1423 manpage.