From b0c295e1b8d0ec8af33c502a6b00b260d0425c04 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 3 Oct 2022 09:42:20 +0200 Subject: add --enable-default-compressed-debug-sections-algorithm configure option 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. --- gas/NEWS | 3 +++ gas/as.c | 2 +- gas/config.in | 3 +++ gas/configure | 23 +++++++++++++++++++++-- gas/configure.ac | 12 ++++++++++++ 5 files changed, 40 insertions(+), 3 deletions(-) (limited to 'gas') diff --git a/gas/NEWS b/gas/NEWS index cc0c62d..16cb347 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. * Add support for various T-Head extensions (XTheadBa, XTheadBb, XTheadBs, XTheadCmo, XTheadCondMov, XTheadFMemIdx, XTheadMemIdx, XTheadMemPair, diff --git a/gas/as.c b/gas/as.c index a5c2d24..d42dd53 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 0d1668a..232bc35 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 02cded5..cae14c0 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 e6f3298..feb4339 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 -- cgit v1.1