public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Martin Liška" <mliska@suse.cz>
To: binutils@sourceware.org
Cc: Fangrui Song <maskray@google.com>
Subject: [PATCH 2/2] add --enable-default-compressed-debug-sections-algorithm configure option
Date: Mon, 3 Oct 2022 09:50:44 +0200	[thread overview]
Message-ID: <b8acdd83-f33a-74b8-e21a-23719a0b1a60@suse.cz> (raw)
In-Reply-To: <20ce4355-56ca-ad6f-d7de-4c1522d33b5d@suse.cz>

ChangeLog:

	* configure.ac: Add --enable-default-compressed-debug-sections-algorithm.
	* configure: Regenerate.

gas/ChangeLog:

	* NEWS: Document the new option.
	* as.c (flag_compress_debug): Set default algorithm based
	on the configure option.
	* configure.ac: Add --enable-default-compressed-debug-sections-algorithm.
	* configure: Regenerate.
	* config.in: Likewise.

ld/ChangeLog:

	* NEWS: Document the new option.
	* configure.ac: Add --enable-default-compressed-debug-sections-algorithm.
	* configure: Regenerate.
	* config.in: Likewise.
	* ldmain.c: Set default algorithm based
	on the configure option.
---
 configure        | 13 +++++++++++++
 configure.ac     |  6 ++++++
 gas/NEWS         |  3 +++
 gas/as.c         |  2 +-
 gas/config.in    |  3 +++
 gas/configure    | 23 +++++++++++++++++++++--
 gas/configure.ac | 12 ++++++++++++
 ld/NEWS          |  3 +++
 ld/config.in     |  3 +++
 ld/configure     | 23 +++++++++++++++++++++--
 ld/configure.ac  | 12 ++++++++++++
 ld/ldmain.c      |  2 +-
 12 files changed, 99 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index f14e0efd675..a430e625c75 100755
--- a/configure
+++ b/configure
@@ -792,6 +792,7 @@ enable_gold
 enable_ld
 enable_gprofng
 enable_compressed_debug_sections
+enable_default_compressed_debug_sections_algorithm
 enable_year2038
 enable_libquadmath
 enable_libquadmath_support
@@ -1523,6 +1524,9 @@ Optional Features:
   --enable-compressed-debug-sections={all,gas,gold,ld,none}
                           Enable compressed debug sections for gas, gold or ld
                           by default
+  --enable-default-compressed-debug-sections-algorithm={zlib,zstd}
+                          Default compression algorithm for
+                          --enable-compressed-debug-sections.
   --enable-year2038       enable support for timestamps past the year 2038
   --disable-libquadmath   do not build libquadmath directory
   --disable-libquadmath-support
@@ -3119,6 +3123,15 @@ else
 fi
 
 
+# Select default compression algorithm.
+# Check whether --enable-default_compressed_debug_sections_algorithm was given.
+if test "${enable_default_compressed_debug_sections_algorithm+set}" = set; then :
+  enableval=$enable_default_compressed_debug_sections_algorithm;
+else
+  default_compressed_debug_sections_algorithm=
+fi
+
+
 # Configure extra directories which are host specific
 
 case "${host}" in
diff --git a/configure.ac b/configure.ac
index 0152c69292e..9c4c9e13907 100644
--- a/configure.ac
+++ b/configure.ac
@@ -422,6 +422,12 @@ AC_ARG_ENABLE(compressed_debug_sections,
   fi
 ], [enable_compressed_debug_sections=])
 
+# Select default compression algorithm.
+AC_ARG_ENABLE(default_compressed_debug_sections_algorithm,
+[AS_HELP_STRING([--enable-default-compressed-debug-sections-algorithm={zlib,zstd}],
+		[Default compression algorithm for --enable-compressed-debug-sections.])],
+[], [default_compressed_debug_sections_algorithm=])
+
 # Configure extra directories which are host specific
 
 case "${host}" in
diff --git a/gas/NEWS b/gas/NEWS
index 9a8b726b942..d9043d9d469 100644
--- a/gas/NEWS
+++ b/gas/NEWS
@@ -2,6 +2,9 @@
 
 * gas now supports --compress-debug-sections=zstd to compress
   debug sections with zstd.
+* Add --enable-default-compressed-debug-sections-algorithm={zlib,zstd}
+  that selects the default compression algorithm
+  for --enable-compressed-debug-sections.
 
 Changes in 2.39:
 
diff --git a/gas/as.c b/gas/as.c
index a5c2d2459f7..d42dd5394b5 100644
--- a/gas/as.c
+++ b/gas/as.c
@@ -226,7 +226,7 @@ print_version_id (void)
 
 #ifdef DEFAULT_FLAG_COMPRESS_DEBUG
 enum compressed_debug_section_type flag_compress_debug
-  = COMPRESS_DEBUG_GABI_ZLIB;
+  = DEFAULT_COMPRESSED_DEBUG_ALGORITHM;
 #endif
 
 static void
diff --git a/gas/config.in b/gas/config.in
index 0d1668a3eac..232bc350759 100644
--- a/gas/config.in
+++ b/gas/config.in
@@ -22,6 +22,9 @@
 /* Default architecture. */
 #undef DEFAULT_ARCH
 
+/* Default compression algorithm for --enable-compressed-debug-sections. */
+#undef DEFAULT_COMPRESSED_DEBUG_ALGORITHM
+
 /* Default CRIS architecture. */
 #undef DEFAULT_CRIS_ARCH
 
diff --git a/gas/configure b/gas/configure
index 02cded59b6a..cae14c066d2 100755
--- a/gas/configure
+++ b/gas/configure
@@ -810,6 +810,7 @@ enable_largefile
 enable_targets
 enable_checking
 enable_compressed_debug_sections
+enable_default_compressed_debug_sections_algorithm
 enable_x86_relax_relocations
 enable_elf_stt_common
 enable_generate_build_notes
@@ -1476,6 +1477,9 @@ Optional Features:
   --enable-checking       enable run-time checks
   --enable-compressed-debug-sections={all,gas,none}
                           compress debug sections by default
+  --enable-default-compressed-debug-sections-algorithm={zlib,zstd}
+                          Default compression algorithm for
+                          --enable-compressed-debug-sections.
   --enable-x86-relax-relocations
                           generate x86 relax relocations by default
   --enable-elf-stt-common generate ELF common symbols with STT_COMMON type by
@@ -10722,7 +10726,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10725 "configure"
+#line 10729 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10828,7 +10832,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10831 "configure"
+#line 10835 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11502,6 +11506,15 @@ if test "${enable_compressed_debug_sections+set}" = set; then :
 esac
 fi
 
+# Select default compression algorithm.
+ac_default_compressed_debug_sections_algorithm=COMPRESS_DEBUG_GABI_ZLIB
+# Check whether --enable-default_compressed_debug_sections_algorithm was given.
+if test "${enable_default_compressed_debug_sections_algorithm+set}" = set; then :
+  enableval=$enable_default_compressed_debug_sections_algorithm; case "${enableval}" in
+   zstd) ac_default_compressed_debug_sections_algorithm=COMPRESS_DEBUG_ZSTD ;;
+esac
+fi
+
 # PR gas/19520
 # Decide if x86 assembler should generate relax relocations.
 ac_default_x86_relax_relocations=unset
@@ -12671,6 +12684,12 @@ $as_echo "#define DEFAULT_FLAG_COMPRESS_DEBUG 1" >>confdefs.h
 
 fi
 
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_COMPRESSED_DEBUG_ALGORITHM $ac_default_compressed_debug_sections_algorithm
+_ACEOF
+
+
 # Turn on all targets if possible
 if test ${all_targets} = "yes"; then
   case ${target_cpu_type} in
diff --git a/gas/configure.ac b/gas/configure.ac
index e6f3298cb3e..feb43399ce8 100644
--- a/gas/configure.ac
+++ b/gas/configure.ac
@@ -76,6 +76,15 @@ AC_ARG_ENABLE(compressed_debug_sections,
   *)   ac_default_compressed_debug_sections=unset ;;
 esac])dnl
 
+# Select default compression algorithm.
+ac_default_compressed_debug_sections_algorithm=COMPRESS_DEBUG_GABI_ZLIB
+AC_ARG_ENABLE(default_compressed_debug_sections_algorithm,
+	      AS_HELP_STRING([--enable-default-compressed-debug-sections-algorithm={zlib,zstd}],
+	      [Default compression algorithm for --enable-compressed-debug-sections.]),
+[case "${enableval}" in
+   zstd) ac_default_compressed_debug_sections_algorithm=COMPRESS_DEBUG_ZSTD ;;
+esac])dnl
+
 # PR gas/19520
 # Decide if x86 assembler should generate relax relocations.
 ac_default_x86_relax_relocations=unset
@@ -755,6 +764,9 @@ if test x$ac_default_compressed_debug_sections = xyes ; then
   AC_DEFINE(DEFAULT_FLAG_COMPRESS_DEBUG, 1, [Define if you want compressed debug sections by default.])
 fi
 
+AC_DEFINE_UNQUOTED(DEFAULT_COMPRESSED_DEBUG_ALGORITHM, $ac_default_compressed_debug_sections_algorithm,
+		   [Default compression algorithm for --enable-compressed-debug-sections.])
+
 # Turn on all targets if possible
 if test ${all_targets} = "yes"; then
   case ${target_cpu_type} in
diff --git a/ld/NEWS b/ld/NEWS
index dfe2690d9f2..d7ceb0c68b6 100644
--- a/ld/NEWS
+++ b/ld/NEWS
@@ -2,6 +2,9 @@
 
 * ld now supports zstd compressed debug sections.  The new option
   --compress-debug-sections=zstd compresses debug sections with zstd.
+* Add --enable-default-compressed-debug-sections-algorithm={zlib,zstd}
+  that selects the default compression algorithm
+  for --enable-compressed-debug-sections.
 
 Changes in 2.39:
 
diff --git a/ld/config.in b/ld/config.in
index 3916740eee4..ad0dc6a106c 100644
--- a/ld/config.in
+++ b/ld/config.in
@@ -7,6 +7,9 @@
 #endif
 #define __CONFIG_H__ 1
 
+/* Default compression algorithm for --enable-compressed-debug-sections. */
+#undef DEFAULT_COMPRESSED_DEBUG_ALGORITHM
+
 /* Define to 1 if you want to emit gnu hash in the ELF linker by default. */
 #undef DEFAULT_EMIT_GNU_HASH
 
diff --git a/ld/configure b/ld/configure
index 9dd3ed5f1e7..7906f52aadf 100755
--- a/ld/configure
+++ b/ld/configure
@@ -841,6 +841,7 @@ with_sysroot
 enable_gold
 enable_got
 enable_compressed_debug_sections
+enable_default_compressed_debug_sections_algorithm
 enable_new_dtags
 enable_relro
 enable_textrel_check
@@ -1524,6 +1525,9 @@ Optional Features:
                           multigot)
   --enable-compressed-debug-sections={all,ld,none}
                           compress debug sections by default]
+  --enable-default-compressed-debug-sections-algorithm={zlib,zstd}
+                          Default compression algorithm for
+                          --enable-compressed-debug-sections.
   --enable-new-dtags      set DT_RUNPATH instead of DT_RPATH by default]
   --enable-relro          enable -z relro in ELF linker by default
   --enable-textrel-check=[yes|no|warning|error]
@@ -11620,7 +11624,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11623 "configure"
+#line 11627 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11726,7 +11730,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11729 "configure"
+#line 11733 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -15544,6 +15548,15 @@ if test "${enable_compressed_debug_sections+set}" = set; then :
 esac
 fi
 
+# Select default compression algorithm.
+ac_default_compressed_debug_sections_algorithm=COMPRESS_DEBUG_GABI_ZLIB
+# Check whether --enable-default_compressed_debug_sections_algorithm was given.
+if test "${enable_default_compressed_debug_sections_algorithm+set}" = set; then :
+  enableval=$enable_default_compressed_debug_sections_algorithm; case "${enableval}" in
+   zstd) ac_default_compressed_debug_sections_algorithm=COMPRESS_DEBUG_ZSTD ;;
+esac
+fi
+
 # Decide setting DT_RUNPATH instead of DT_RPATH by default
 ac_default_new_dtags=unset
 # Provide a configure time option to override our default.
@@ -17340,6 +17353,12 @@ $as_echo "#define DEFAULT_FLAG_COMPRESS_DEBUG 1" >>confdefs.h
 
 fi
 
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_COMPRESSED_DEBUG_ALGORITHM $ac_default_compressed_debug_sections_algorithm
+_ACEOF
+
+
 if test "${ac_default_new_dtags}" = unset; then
   ac_default_new_dtags=0
 fi
diff --git a/ld/configure.ac b/ld/configure.ac
index f1b2f9897f8..6123ea78611 100644
--- a/ld/configure.ac
+++ b/ld/configure.ac
@@ -163,6 +163,15 @@ AC_ARG_ENABLE(compressed_debug_sections,
   ,no, | ,none,)  ac_default_compressed_debug_sections=no ;;
 esac])dnl
 
+# Select default compression algorithm.
+ac_default_compressed_debug_sections_algorithm=COMPRESS_DEBUG_GABI_ZLIB
+AC_ARG_ENABLE(default_compressed_debug_sections_algorithm,
+	      AS_HELP_STRING([--enable-default-compressed-debug-sections-algorithm={zlib,zstd}],
+	      [Default compression algorithm for --enable-compressed-debug-sections.]),
+[case "${enableval}" in
+   zstd) ac_default_compressed_debug_sections_algorithm=COMPRESS_DEBUG_ZSTD ;;
+esac])dnl
+
 # Decide setting DT_RUNPATH instead of DT_RPATH by default
 ac_default_new_dtags=unset
 # Provide a configure time option to override our default.
@@ -510,6 +519,9 @@ if test x$ac_default_compressed_debug_sections = xyes ; then
   AC_DEFINE(DEFAULT_FLAG_COMPRESS_DEBUG, 1, [Define if you want compressed debug sections by default.])
 fi
 
+AC_DEFINE_UNQUOTED(DEFAULT_COMPRESSED_DEBUG_ALGORITHM, $ac_default_compressed_debug_sections_algorithm,
+		   [Default compression algorithm for --enable-compressed-debug-sections.])
+
 if test "${ac_default_new_dtags}" = unset; then
   ac_default_new_dtags=0
 fi
diff --git a/ld/ldmain.c b/ld/ldmain.c
index d63002c994a..10f7a0538aa 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -352,7 +352,7 @@ main (int argc, char **argv)
   link_info.spare_dynamic_tags = 5;
   link_info.path_separator = ':';
 #ifdef DEFAULT_FLAG_COMPRESS_DEBUG
-  link_info.compress_debug = COMPRESS_DEBUG_GABI_ZLIB;
+  link_info.compress_debug = DEFAULT_COMPRESSED_DEBUG_ALGORITHM;
 #endif
 #ifdef DEFAULT_NEW_DTAGS
   link_info.new_dtags = DEFAULT_NEW_DTAGS;
-- 
2.37.3


  parent reply	other threads:[~2022-10-03  7:50 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-23  4:08 [PATCH v3] binutils, gdb: support zstd compressed debug sections Fangrui Song
2022-09-23 14:32 ` Simon Marchi
2022-09-26  5:12   ` Alan Modra
2022-09-26  7:20     ` Fangrui Song
2022-09-26 13:30       ` Alan Modra
2022-09-26 14:08     ` Simon Marchi
2022-09-27  0:33       ` Alan Modra
2022-09-23 15:45 ` Nick Clifton
2022-09-23 15:58   ` Simon Marchi
2022-09-23 18:20     ` Fangrui Song
2022-09-23 18:57       ` Simon Marchi
2022-09-23 20:34         ` Fangrui Song
2022-09-24  5:43           ` Eli Zaretskii
2022-09-24  6:53 ` Enze Li
2022-09-24  7:13   ` Fangrui Song
2022-09-27 18:06     ` Tom Tromey
2022-09-27 18:08 ` Tom Tromey
2022-09-27 18:53   ` Fangrui Song
2022-09-29 11:43 ` Martin Liška
2022-09-29 20:17   ` Fangrui Song
2022-09-30  9:48     ` [PATCH][RFC] add --enable-zstd-compressed-debug-sections configure option Martin Liška
2022-09-30 11:25       ` Pedro Alves
2022-09-30 12:42         ` Martin Liška
2022-10-01  7:31           ` Fangrui Song
2022-10-03  7:49             ` Martin Liška
2022-10-03  7:50               ` [PATCH 1/2] refactor usage of compressed_debug_section_type Martin Liška
2022-10-11  7:14                 ` Martin Liška
2022-10-11 12:06                   ` Nick Clifton
2022-10-11 13:27                     ` Martin Liška
2022-10-03  7:50               ` Martin Liška [this message]
2022-10-11  7:14                 ` [PATCH 2/2] add --enable-default-compressed-debug-sections-algorithm configure option Martin Liška
2022-10-11 12:08                   ` Nick Clifton

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=b8acdd83-f33a-74b8-e21a-23719a0b1a60@suse.cz \
    --to=mliska@suse.cz \
    --cc=binutils@sourceware.org \
    --cc=maskray@google.com \
    /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).