public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: elfutils-devel@sourceware.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [COMMITTED] libelf: Document and make ELFCOMPRESS_ZSTD usable with old system elf.h
Date: Fri,  3 Mar 2023 15:42:02 +0100	[thread overview]
Message-ID: <20230303144202.329710-1-mark@klomp.org> (raw)

Make sure that even if the system elf.h doesn't have ELF_COMPRESS_ZSTD
defined it can still be used as constant. Also update libelf.h
documentation and add new feature to NEWS.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 ChangeLog        |  4 ++++
 NEWS             |  8 +++++++-
 libelf/ChangeLog |  5 +++++
 libelf/libelf.h  | 13 +++++++++----
 4 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 53a1d292..10c23002 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2023-03-03  Mark Wielaard  <mark@klomp.org>
+
+	* NEWS: Add ELFCOMPRESS_ZSTD support for libelf and elfcompress.
+
 2023-02-23  Mark Wielaard  <mark@klomp.org>
 
 	* NEWS: Add old version code names.
diff --git a/NEWS b/NEWS
index c01513d0..4985658f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,11 +1,17 @@
-Version 0.189
+Version 0.189 "Don't deflate!"
 
 configure: eu-nm, eu-addr2line and eu-stack can provide demangled symbols
            when linked with libstdc++. Use --disable-demangler to disable.
 
+libelf: elf_compress now supports ELFCOMPRESS_ZSTD when build against
+        libzstd
+
 libdwfl: dwfl_module_return_value_location now returns 0 (no return type)
          for DIEs that point to a DW_TAG_unspecified_type.
 
+elfcompress: -t, --type= now support zstd if libelf has been build with
+             ELFCOMPRESS_ZSTD support.
+
 Version 0.188 "no section left behind"
 
 readelf: Add -D, --use-dynamic option.
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index bfd6b82d..8cc3c53c 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,8 @@
+2023-03-03  Mark Wielaard  <mark@klomp.org>
+
+	* libelf.h: Define ELFCOMPRESS_ZSTD if undefined.
+	(elf_compress): Document ELFCOMPRESS_ZSTD compression type.
+
 2023-02-20  Mark Wielaard  <mark@klomp.org>
 
 	* gnuhash_xlate.h (elf_cvt_gnuhash): memmove any left over bytes.
diff --git a/libelf/libelf.h b/libelf/libelf.h
index a139e733..2374a48a 100644
--- a/libelf/libelf.h
+++ b/libelf/libelf.h
@@ -64,6 +64,11 @@
  #define ELFCOMPRESS_HIPROC     0x7fffffff /* End of processor-specific.  */
 #endif
 
+#ifndef ELFCOMPRESS_ZSTD
+ /* So ZSTD compression can be used even with an old system elf.h.  */
+ #define ELFCOMPRESS_ZSTD       2          /* Zstandard algorithm.  */
+#endif
+
 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
 # define __nonnull_attribute__(...) __attribute__ ((__nonnull__ (__VA_ARGS__)))
 # define __deprecated_attribute__ __attribute__ ((__deprecated__))
@@ -348,10 +353,10 @@ extern Elf64_Chdr *elf64_getchdr (Elf_Scn *__scn);
 
    elf_compress takes a compression type that should be either zero to
    decompress or an ELFCOMPRESS algorithm to use for compression.
-   Currently only ELFCOMPRESS_ZLIB is supported.  elf_compress_gnu
-   will compress in the traditional GNU compression format when
-   compress is one and decompress the section data when compress is
-   zero.
+   Currently ELFCOMPRESS_ZLIB and ELFCOMPRESS_ZSTD are supported.
+   elf_compress_gnu will compress in the traditional GNU compression
+   format when compress is one and decompress the section data when
+   compress is zero.
 
    The FLAGS argument can be zero or ELF_CHF_FORCE.  If FLAGS contains
    ELF_CHF_FORCE then it will always compress the section, even if
-- 
2.39.2


                 reply	other threads:[~2023-03-03 14:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230303144202.329710-1-mark@klomp.org \
    --to=mark@klomp.org \
    --cc=elfutils-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).