The Solaris 11.4 ld recently gained support for zstd compression. This
patch adds a configure check for it.
I also noticed that we don't currently document -gz=zstd, so this patch
adds that, too.
Tested on i386-pc-solaris2.11 (with pre-zstd and post-zstd ld) and
x86_64-pc-linux-gnu.
Ok for trunk?
I wonder if the invoke.texi snippet would better be shortened a bit.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
2025-11-14 Rainer Orth <[email protected]>
gcc:
* configure.ac (gcc_cv_ld_compress_debug) <*-*-solaris2*>: Check
for zstd compression support.
* configure: Regenerate.
* doc/invoke.texi (Debugging Options, gz): Document zstd.
# HG changeset patch
# Parent 57fac812ffcd350151dba826c0f91cd6cb275921
build: Check for ld -z compress-debug=zstd on Solaris
diff --git a/gcc/configure b/gcc/configure
--- a/gcc/configure
+++ b/gcc/configure
@@ -33157,6 +33157,11 @@ else
# Introduced in Solaris 11.2.
gcc_cv_ld_compress_debug=1
gcc_cv_ld_compress_debug_option="-z compress-sections"
+ # Detect zstd debug section compression support. Introduced in
+ # Solaris 11.4 SRU 90.
+ if $gcc_cv_ld --help 2>&1 | grep -- '-z compress-sections.*\<zstd\>' > /dev/null; then
+ gcc_cv_ld_compress_debug=2
+ fi
;;
*)
# Assume linkers other than GNU ld don't support compessed debug
diff --git a/gcc/configure.ac b/gcc/configure.ac
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -6389,6 +6389,11 @@ changequote(,)dnl
# Introduced in Solaris 11.2.
gcc_cv_ld_compress_debug=1
gcc_cv_ld_compress_debug_option="-z compress-sections"
+ # Detect zstd debug section compression support. Introduced in
+ # Solaris 11.4 SRU 90.
+ if $gcc_cv_ld --help 2>&1 | grep -- '-z compress-sections.*\<zstd\>' > /dev/null; then
+ gcc_cv_ld_compress_debug=2
+ fi
;;
*)
# Assume linkers other than GNU ld don't support compessed debug
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -13089,7 +13089,8 @@ location views are enabled.
Produce compressed debug sections in DWARF format, if that is supported.
If @var{type} is not given, the default type depends on the capabilities
of the assembler and linker used. @var{type} may be one of
-@samp{none} (don't compress debug sections), or @samp{zlib} (use zlib
+@samp{none} (don't compress debug sections), @samp{zlib} (use zlib
+compression in ELF gABI format), or @samp{zstd} (use zstd
compression in ELF gABI format). If the linker doesn't support writing
compressed debug sections, the option is rejected. Otherwise, if the
assembler does not support them, @option{-gz} is silently ignored when