add --enable-default-compressed-debug-sections-algorithm configure option
authorMartin Liska <mliska@suse.cz>
Mon, 3 Oct 2022 07:42:20 +0000 (09:42 +0200)
committerMartin Liska <mliska@suse.cz>
Tue, 11 Oct 2022 12:15:04 +0000 (14:15 +0200)
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.

12 files changed:
configure
configure.ac
gas/NEWS
gas/as.c
gas/config.in
gas/configure
gas/configure.ac
ld/NEWS
ld/config.in
ld/configure
ld/configure.ac
ld/ldmain.c

index 4d530e6d21d8bb06499f54f839f1e64aaff16384..d7d9770056305bd6dff195a4ce04cec3950171ea 100755 (executable)
--- a/configure
+++ b/configure
@@ -804,6 +804,7 @@ enable_gold
 enable_ld
 enable_gprofng
 enable_compressed_debug_sections
+enable_default_compressed_debug_sections_algorithm
 enable_year2038
 enable_libquadmath
 enable_libquadmath_support
@@ -1543,6 +1544,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
@@ -3148,6 +3152,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
index f9a224eb21f1471d0b50c440fc78c792d242da25..47931ff4e9e997e9490323e61b0d5db256fb6327 100644 (file)
@@ -426,6 +426,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
index cc0c62d7f1801be5dd2660b382966d1fbfae3c13..16cb347e775251271455d32a44f9e734c1eb9917 100644 (file)
--- 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.
 
 * Add support for various T-Head extensions (XTheadBa, XTheadBb, XTheadBs,
   XTheadCmo, XTheadCondMov, XTheadFMemIdx, XTheadMemIdx, XTheadMemPair,
index a5c2d2459f7d885495317349137e2d2cb6bbe7f1..d42dd5394b597eef0eae5bf50675774fe77df22b 100644 (file)
--- 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
index 0d1668a3eacf4b9d3795f16482288795dde54cb3..232bc35075914861a80bbbacc2664ddd0bea0ff1 100644 (file)
@@ -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
 
index 02cded59b6a492fce5cc6d21de571d9c7da58c6f..cae14c066d2df04c1d43bd4aeefc91cf94558765 100755 (executable)
@@ -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
index e6f3298cb3ec2188434e896794c10d342011b20e..feb43399ce80542dfe72dbb8de011765cc5143b1 100644 (file)
@@ -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 dfe2690d9f2a6e1973762d1c8c404e1f3fbb99bc..d7ceb0c68b6a7ff7bd0136cc7e8378f9627f81ba 100644 (file)
--- 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:
 
index 3916740eee43466a76641a77e8ccf4abe632ec49..ad0dc6a106cc04cff4a324631b80e72616e83810 100644 (file)
@@ -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
 
index 9dd3ed5f1e76b4312b9b0b063b0b07e1e645d517..7906f52aadfbab1782b44c1bb5226093c1a54fde 100755 (executable)
@@ -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
index f1b2f9897f823d0732529707eeebc01cc6458f29..6123ea786112a0d5ce5d0ced44a613a28a8e5648 100644 (file)
@@ -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
index d63002c994a23d6ed41acf73aed33007335c2245..10f7a0538aab75330ba2e285751111e7490fa503 100644 (file)
@@ -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;