git: e0189cf66a94 - main - elf.5: Document compressed section headers

From: Mark Johnston <>
Date: Mon, 29 Nov 2021 18:57:56 UTC
The branch main has been updated by markj:


commit e0189cf66a94e1149793caf4dea17288da22a0c3
Author:     Mark Johnston <>
AuthorDate: 2021-11-29 18:51:50 +0000
Commit:     Mark Johnston <>
CommitDate: 2021-11-29 18:57:24 +0000

    elf.5: Document compressed section headers
    Reviewed by:    emaste
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:
 share/man/man5/elf.5 | 49 ++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 48 insertions(+), 1 deletion(-)

diff --git a/share/man/man5/elf.5 b/share/man/man5/elf.5
index 3134e8614988..81376e7e6bb9 100644
--- a/share/man/man5/elf.5
+++ b/share/man/man5/elf.5
@@ -24,7 +24,7 @@
 .\" $FreeBSD$
-.Dd March 11, 2020
+.Dd November 27, 2021
 .Dt ELF 5
@@ -795,6 +795,8 @@ The section contains executable machine instructions.
 All bits included in this mask are reserved for processor-specific
+The section data is compressed.
 .It Dv sh_addr
@@ -1069,6 +1071,50 @@ be registered.
 This section holds information used for C++ exception-handling.
+A section with the
+flag set contains a compressed copy of the section data.
+Compressed section data begins with an
+.Vt Elf64_Chdr
+.Vt Elf32_Chdr structure
+which encodes the compression algorithm and some characteristics of the
+uncompressed data.
+.Bd -literal -offset indent
+typedef struct {
+	Elf32_Word    ch_type;
+	Elf32_Word    ch_size;
+	Elf32_Word    ch_addralign;
+} Elf32_Chdr;
+.Bd -literal -offset indent
+typedef struct {
+	Elf64_Word    ch_type;
+	Elf64_Word    ch_reserved;
+	Elf64_Xword   ch_size;
+	Elf64_Xword   ch_addralign;
+} Elf64_Chdr;
+.Bl -tag -width "ch_addralign" -compact
+.It Dv ch_type
+The compression algorithm used.
+A value of
+indicates that the data is compressed using
+.Xr zlib 3 .
+.It Dv ch_size
+The size, in bytes, of the uncompressed section data.
+This corresponds to the
+.Sy sh_size
+field of a section header containing uncompressed data.
+.It Dv ch_addralign
+The address alignment of the uncompressed section data.
+This corresponds to the
+.Sy sh_addralign
+field of a section header containing uncompressed data.
 String table sections hold null-terminated character sequences, commonly
 called strings.
 The object file uses these strings to represent symbol
@@ -1342,6 +1388,7 @@ writeable and executable.
 .Xr objdump 1 ,
 .Xr readelf 1 ,
 .Xr execve 2 ,
+.Xr zlib 3 ,
 .Xr ar 5 ,
 .Xr core 5