[PATCH v3] binutils, gdb: support zstd compressed debug sections

Fangrui Song maskray@google.com
Fri Sep 23 18:20:38 GMT 2022


On 2022-09-23, Simon Marchi wrote:
>
>
>On 2022-09-23 11:45, Nick Clifton wrote:
>> Hi Fangrui,
>>
>>> PR29397 PR29563: The new configure option --with-zstd defaults to auto.
>>> If pkgconfig/libzstd.pc is found, define HAVE_ZSTD and support zstd
>>> compressed debug sections for most tools.

Hi Simon and Nick,

I have checked that `make all-gdb` works in a --enable-gdb --without-debuginfod build.

I then inspected the 2020 commits adding AC_DEBUGINFOD to
gdb/configure.ac and binutils/configure.ac. They come with no
PKG_PROG_PKG_CONFIG and config/debuginfod.m4 does not have
PKG_PROG_PKG_CONFIG, but they still work.  So I think AC_ZSTD doesn't
need PKG_PROG_PKG_CONFIG, either. Though I have no insight why it
behaves that way:)

>> One small, but important point.  Please could you add entries to the gas/NEWS
>> binutils/NEWS and ld/NEWS files giving a brief description of this new feature.
>
>I guess to gdb/NEWS, while at it :).
>
>Simon

Here are the NEWS entries :)
(As usual, it's available as the latest https://gitlab.com/MaskRay/binutils-gdb/-/commits/zstd)

----
   bfd/Makefile.am                              |   4 +-
@@ -58,2 +51,3 @@
   binutils/Makefile.in                         |   5 +-
+ binutils/NEWS                                |   6 +
   binutils/aclocal.m4                          |   1 +
@@ -70,2 +64,3 @@
   gas/Makefile.in                              |  13 +-
+ gas/NEWS                                     |   3 +
   gas/aclocal.m4                               |   2 +
@@ -80,2 +75,3 @@
   gdb/Makefile.in                              |   8 +-
+ gdb/NEWS                                     |   2 +
   gdb/acinclude.m4                             |   3 +-
@@ -86,2 +82,3 @@
   ld/Makefile.in                               |  11 +-
+ ld/NEWS                                      |   3 +
   ld/aclocal.m4                                |   1 +
@@ -95,3 +92,3 @@
   ld/testsuite/ld-elf/compress.exp             |  17 +
- 51 files changed, 1470 insertions(+), 255 deletions(-)
+ 55 files changed, 1484 insertions(+), 255 deletions(-)
   create mode 100644 config/zstd.m4
@@ -990,2 +987,18 @@
   abs_top_builddir = @abs_top_builddir@
+diff --git a/binutils/NEWS b/binutils/NEWS
+index 8c2c416c17e..073e9bc4647 100644
+--- a/binutils/NEWS
++++ b/binutils/NEWS
+@@ -1,5 +1,11 @@
+ -*- text -*-
+ 
++* objcopy --decompress-debug-sections now supports zstd compressed debug
++  sections.  The new option --compress-debug-sections=zstd compresses debug
++  sections with zstd.
++
++* addr2line and objdump --dwarf now support zstd compressed debug sections.
++
+ * The dlltool program now accepts --deterministic-libraries and
+   --non-deterministic-libraries as command line options to control whether or
+   not it generates deterministic output libraries.  If neither of these options
  diff --git a/binutils/aclocal.m4 b/binutils/aclocal.m4
@@ -1539,2 +1552,15 @@
   	$(extra_objects) $(GASLIBS) $(LIBINTL_DEP)
+diff --git a/gas/NEWS b/gas/NEWS
+index d61cdb9edd4..9a8b726b942 100644
+--- a/gas/NEWS
++++ b/gas/NEWS
+@@ -1,5 +1,8 @@
+ -*- text -*-
+ 
++* gas now supports --compress-debug-sections=zstd to compress
++  debug sections with zstd.
++
+ Changes in 2.39:
+ 
+ * Remove (rudimentary) support for the x86-64 sub-architectures Intel L1OM and
  diff --git a/gas/aclocal.m4 b/gas/aclocal.m4
@@ -2262,2 +2288,15 @@
   $(srcdir)/aclocal.m4: @MAINTAINER_MODE_TRUE@ $(aclocal_m4_deps)
+diff --git a/gdb/NEWS b/gdb/NEWS
+index 9619842bc03..1457c99ff04 100644
+--- a/gdb/NEWS
++++ b/gdb/NEWS
+@@ -57,6 +57,8 @@
+ 
+ * The Windows native target now supports target async.
+ 
++* gdb now supports zstd compressed debug sections (ELFCOMPRESS_ZSTD) for ELF.
++
+ * New commands
+ 
+ maintenance set ignore-prologue-end-flag on|off
  diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
@@ -2582,2 +2621,15 @@
   # Build a dummy plugin using libtool.
+diff --git a/ld/NEWS b/ld/NEWS
+index 355752e6b24..dfe2690d9f2 100644
+--- a/ld/NEWS
++++ b/ld/NEWS
+@@ -1,5 +1,8 @@
+ -*- text -*-
+ 
++* ld now supports zstd compressed debug sections.  The new option
++  --compress-debug-sections=zstd compresses debug sections with zstd.
++
+ Changes in 2.39:
+ 
+ * The ELF linker will now generate a warning message if the stack is made
  diff --git a/ld/aclocal.m4 b/ld/aclocal.m4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: v4-0001-binutils-gdb-support-zstd-compressed-debug-sectio.patch
Type: text/x-diff
Size: 110132 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20220923/9d0a48d5/attachment-0001.bin>


More information about the Binutils mailing list