git: 68ff187a2530 - stable/12 - Add ELFCOMPRESS_ZSTD ELF compression constant

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Fri, 07 Oct 2022 15:26:55 UTC
The branch stable/12 has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=68ff187a25306514b36e0b17314603e050ea301b

commit 68ff187a25306514b36e0b17314603e050ea301b
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2022-06-28 13:06:12 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2022-10-07 15:24:36 +0000

    Add ELFCOMPRESS_ZSTD ELF compression constant
    
    ELFCOMPRESS_ZSTD indicates that an ELF section is compressed with zstd.
    It is the second compression type, after the existing ELFCOMPRESS_ZLIB.
    Zstd generally provides a compelling tradeoff of speed and compression
    (other algorithms may compress slightly better but take a lot longer,
    or run faster but do not compress nearly as well).
    
    See https://groups.google.com/g/generic-abi/c/satyPkuMisk for details.
    ELFCOMPRESS_ZSTD will be supported in a future Clang/LLVM update.  ELF
    Tool Chain tools also need updating.
    
    Reviewed by:    Fangrui Song
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 05b6744c446c2d274738fbb27a3ded1bf9f9f1d1)
---
 share/man/man5/elf.5 | 6 +++++-
 sys/sys/elf_common.h | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/share/man/man5/elf.5 b/share/man/man5/elf.5
index f7abefa9a5d0..df051adbf873 100644
--- a/share/man/man5/elf.5
+++ b/share/man/man5/elf.5
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 11, 2020
+.Dd July 25, 2022
 .Dt ELF 5
 .Os
 .Sh NAME
@@ -1069,6 +1069,10 @@ be registered.
 This section holds information used for C++ exception-handling.
 .El
 .Pp
+A value of
+.Dv ELFCOMPRESS_ZSTD
+indicates that the data is compressed using
+Zstandard.
 String table sections hold null-terminated character sequences, commonly
 called strings.
 The object file uses these strings to represent symbol
diff --git a/sys/sys/elf_common.h b/sys/sys/elf_common.h
index ed5352ba53a2..d77fc31720a4 100644
--- a/sys/sys/elf_common.h
+++ b/sys/sys/elf_common.h
@@ -923,6 +923,7 @@ typedef struct {
 
 /* Values for ch_type (compressed section headers). */
 #define	ELFCOMPRESS_ZLIB	1	/* ZLIB/DEFLATE */
+#define	ELFCOMPRESS_ZSTD	2	/* Zstandard */
 #define	ELFCOMPRESS_LOOS	0x60000000	/* OS-specific */
 #define	ELFCOMPRESS_HIOS	0x6fffffff
 #define	ELFCOMPRESS_LOPROC	0x70000000	/* Processor-specific */