From 6c3bc0f82c625d425b09c01f96b64946abe4118e Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Wed, 21 Oct 2015 13:12:19 +0100 Subject: [PATCH] Reset x86 Linux targets to not compressing debug sections by default. Enable compression of debug sections by default in the linker, if so configured. PR gas/19109 . * configure.ac: Note the 'none' is an acceptable argument to --enable-compressed-debug-sections. * configure: Regenerate. gas * configure.ac: Restore --enable-compressed-debug-sections. Do not enable compressed debug sections by default for x86 Linux targets. * configure: Regenerate. ld * configure.ac: Add --enable-compressed-debug-sections. * configure: Regenerate. * config.in: Regenerate. * ld.texinfo: Document how to determine the default action for debug sections. * ldmain.c (main): If DEFAULT_FLAG_COMPRESS_DEBUG is defined then set the compress_debug field of the link_info structure to zlib-gabi. * lexsup.c (elf_static_list_options): Output the default setting for the --compress-debug-sections option. * NEWS: Mention the new configure option. --- ChangeLog | 7 +++++++ configure | 2 +- configure.ac | 2 +- gas/ChangeLog | 8 ++++++++ gas/configure | 27 +++++++++++++++++++-------- gas/configure.ac | 23 +++++++++++++++-------- ld/ChangeLog | 15 +++++++++++++++ ld/NEWS | 3 +++ ld/config.in | 3 +++ ld/configure | 25 +++++++++++++++++++++++-- ld/configure.ac | 16 ++++++++++++++++ ld/ld.texinfo | 3 +++ ld/ldmain.c | 3 +++ ld/lexsup.c | 7 +++++++ 14 files changed, 124 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 24c462bbe25..514c8739b6f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2015-10-21 Nick Clifton + + PR gas/19109 + * configure.ac: Note the 'none' is an acceptable argument to + --enable-compressed-debug-sections. + * configure: Regenerate. + 2015-10-20 H.J. Lu PR gas/19109 diff --git a/configure b/configure index f66f42474d4..34b66f7ea12 100755 --- a/configure +++ b/configure @@ -1477,7 +1477,7 @@ Optional Features: offload target compiler during the build --enable-gold[=ARG] build gold [ARG={default,yes,no}] --enable-ld[=ARG] build ld [ARG={default,yes,no}] - --enable-compressed-debug-sections={all,gas,gold,ld} + --enable-compressed-debug-sections={all,gas,gold,ld,none} Enable compressed debug sections for gas, gold or ld by default --disable-libquadmath do not build libquadmath directory diff --git a/configure.ac b/configure.ac index cb6ca24458d..4977d97e770 100644 --- a/configure.ac +++ b/configure.ac @@ -397,7 +397,7 @@ esac # Decide the default method for compressing debug sections. # Provide a configure time option to override our default. AC_ARG_ENABLE(compressed_debug_sections, -[AS_HELP_STRING([--enable-compressed-debug-sections={all,gas,gold,ld}], +[AS_HELP_STRING([--enable-compressed-debug-sections={all,gas,gold,ld,none}], [Enable compressed debug sections for gas, gold or ld by default])], [ diff --git a/gas/ChangeLog b/gas/ChangeLog index e6f9c1fe346..6bc22134755 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,11 @@ +2015-10-21 Nick Clifton + + PR gas/19109 + * configure.ac: Restore --enable-compressed-debug-sections. + Do not enable compressed debug sections by default for x86 Linux + targets. + * configure: Regenerate. + 2015-10-20 H.J. Lu PR gas/19109 diff --git a/gas/configure b/gas/configure index 397bb38b16c..e7c6faddc0e 100755 --- a/gas/configure +++ b/gas/configure @@ -764,6 +764,7 @@ enable_plugins enable_largefile enable_targets enable_checking +enable_compressed_debug_sections enable_werror enable_build_warnings enable_nls @@ -1412,6 +1413,7 @@ Optional Features: --disable-largefile omit support for large files --enable-targets alternative target configurations besides the primary --enable-checking enable run-time checks + --enable-compressed-debug-sections compress debug sections by default --enable-werror treat compile warnings as errors --enable-build-warnings enable build-time compiler warnings --disable-nls do not use Native Language Support @@ -10969,7 +10971,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10972 "configure" +#line 10974 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11075,7 +11077,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11078 "configure" +#line 11080 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11664,6 +11666,19 @@ $as_echo "#define ENABLE_CHECKING 1" >>confdefs.h fi +# PR gas/19109 +# Decide the default method for compressing debug sections. +ac_default_compressed_debug_sections=unset +# Provide a configure time option to override our default. +# Check whether --enable-compressed_debug_sections was given. +if test "${enable_compressed_debug_sections+set}" = set; then : + enableval=$enable_compressed_debug_sections; case "${enableval}" in + yes | all | gas) ac_default_compressed_debug_sections=yes ;; + no | none) ac_default_compressed_debug_sections=no ;; + *) ac_default_compressed_debug_sections=unset ;; +esac +fi + using_cgen=no @@ -12489,15 +12504,11 @@ _ACEOF done -# For x86 Linux targets, default to compressing debug sections unless -# configured otherwise. -case x${enable_compressed_debug_sections}-${target_cpu_type}-${target_os} in -x*gas*|xall*|x-i386-linux-gnu) +if test x$ac_default_compressed_debug_sections == xyes ; then $as_echo "#define DEFAULT_FLAG_COMPRESS_DEBUG 1" >>confdefs.h - ;; -esac +fi # Turn on all targets if possible if test ${all_targets} = "yes"; then diff --git a/gas/configure.ac b/gas/configure.ac index b15da9a9c25..278a7fbca7b 100644 --- a/gas/configure.ac +++ b/gas/configure.ac @@ -64,6 +64,18 @@ if test x$ac_checking != x ; then AC_DEFINE(ENABLE_CHECKING, 1, [Define if you want run-time sanity checks.]) fi +# PR gas/19109 +# Decide the default method for compressing debug sections. +ac_default_compressed_debug_sections=unset +# Provide a configure time option to override our default. +AC_ARG_ENABLE(compressed_debug_sections, +[ --enable-compressed-debug-sections compress debug sections by default], +[case "${enableval}" in + yes | all | gas) ac_default_compressed_debug_sections=yes ;; + no | none) ac_default_compressed_debug_sections=no ;; + *) ac_default_compressed_debug_sections=unset ;; +esac])dnl + using_cgen=no AM_BINUTILS_WARNINGS @@ -536,14 +548,9 @@ changequote([,])dnl done -# For x86 Linux targets, default to compressing debug sections unless -# configured otherwise. -case x${enable_compressed_debug_sections}-${target_cpu_type}-${target_os} in -x*gas*|xall*|x-i386-linux-gnu) - AC_DEFINE(DEFAULT_FLAG_COMPRESS_DEBUG, 1, - [Define if you want compressed debug sections by default.]) - ;; -esac +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 # Turn on all targets if possible if test ${all_targets} = "yes"; then diff --git a/ld/ChangeLog b/ld/ChangeLog index 2489e1e34a3..e59e9f88815 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,18 @@ +2015-10-21 Nick Clifton + + PR gas/19109 + * configure.ac: Add --enable-compressed-debug-sections. + * configure: Regenerate. + * config.in: Regenerate. + * ld.texinfo: Document how to determine the default action for + debug sections. + * ldmain.c (main): If DEFAULT_FLAG_COMPRESS_DEBUG is defined then + set the compress_debug field of the link_info structure to + zlib-gabi. + * lexsup.c (elf_static_list_options): Output the default setting + for the --compress-debug-sections option. + * NEWS: Mention the new configure option. + 2015-10-15 H.J. Lu * ld.texinfo: Fix a typo for "-z noextern-protected-data". diff --git a/ld/NEWS b/ld/NEWS index e5dd1a5e8bf..89288d94a53 100644 --- a/ld/NEWS +++ b/ld/NEWS @@ -1,5 +1,8 @@ -*- text -*- +* Add a configure option --enable-compressed-debug-sections={all,ld} to + decide whether DWARF debug sections should be compressed by default. + * Add support for the ARC EM/HS, and ARC600/700 architectures. * Experimental support for linker garbage collection (--gc-sections) diff --git a/ld/config.in b/ld/config.in index a9a37e0dc50..276fb776da0 100644 --- a/ld/config.in +++ b/ld/config.in @@ -7,6 +7,9 @@ #endif #define __CONFIG_H__ 1 +/* Define if you want compressed debug sections by default. */ +#undef DEFAULT_FLAG_COMPRESS_DEBUG + /* Define to 1 if translation of program messages to the user's native language is requested. */ #undef ENABLE_NLS diff --git a/ld/configure b/ld/configure index 1249852284a..c068f6f6e02 100755 --- a/ld/configure +++ b/ld/configure @@ -788,6 +788,7 @@ enable_64_bit_bfd with_sysroot enable_gold enable_got +enable_compressed_debug_sections enable_werror enable_build_warnings enable_nls @@ -1444,6 +1445,7 @@ Optional Features: --enable-gold[=ARG] build gold [ARG={default,yes,no}] --enable-got= GOT handling scheme (target, single, negative, multigot) + --enable-compressed-debug-sections compress debug sections by default --enable-werror treat compile warnings as errors --enable-build-warnings enable build-time compiler warnings --disable-nls do not use Native Language Support @@ -11713,7 +11715,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11716 "configure" +#line 11718 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11819,7 +11821,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11822 "configure" +#line 11824 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -15521,6 +15523,19 @@ $as_echo "#define GOT_HANDLING_DEFAULT GOT_HANDLING_MULTIGOT" >>confdefs.h *) as_fn_error "bad value ${got_handling} for --enable-got option" "$LINENO" 5 ;; esac +# PR gas/19109 +# Decide the default method for compressing debug sections. +ac_default_compressed_debug_sections=unset +# Provide a configure time option to override our default. +# Check whether --enable-compressed_debug_sections was given. +if test "${enable_compressed_debug_sections+set}" = set; then : + enableval=$enable_compressed_debug_sections; case "${enableval}" in + yes | all | ld) ac_default_compressed_debug_sections=yes ;; + no | none) ac_default_compressed_debug_sections=no ;; + *) ac_default_compressed_debug_sections=unset ;; +esac +fi + # Set the 'development' global. . $srcdir/../bfd/development.sh @@ -17118,6 +17133,12 @@ do fi done +if test x$ac_default_compressed_debug_sections == xyes ; then + +$as_echo "#define DEFAULT_FLAG_COMPRESS_DEBUG 1" >>confdefs.h + +fi + diff --git a/ld/configure.ac b/ld/configure.ac index e1d2c8137af..8a9ce2bbc2a 100644 --- a/ld/configure.ac +++ b/ld/configure.ac @@ -143,6 +143,18 @@ case "${got_handling}" in *) AC_MSG_ERROR(bad value ${got_handling} for --enable-got option) ;; esac +# PR gas/19109 +# Decide the default method for compressing debug sections. +ac_default_compressed_debug_sections=unset +# Provide a configure time option to override our default. +AC_ARG_ENABLE(compressed_debug_sections, +[ --enable-compressed-debug-sections compress debug sections by default], +[case "${enableval}" in + yes | all | ld) ac_default_compressed_debug_sections=yes ;; + no | none) ac_default_compressed_debug_sections=no ;; + *) ac_default_compressed_debug_sections=unset ;; +esac])dnl + AM_BINUTILS_WARNINGS AM_LC_MESSAGES @@ -372,6 +384,10 @@ do fi done +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_SUBST(elf_list_options) AC_SUBST(elf_shlib_list_options) AC_SUBST(elf_plt_unwind_list_options) diff --git a/ld/ld.texinfo b/ld/ld.texinfo index 17cd479922d..63760552a6b 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -2275,6 +2275,9 @@ sections and rename debug section names to begin with @samp{.zdebug} instead of @samp{.debug}. @option{--compress-debug-sections=zlib} and @option{--compress-debug-sections=zlib-gabi} compress DWARF debug sections with SHF_COMPRESSED from the ELF ABI. +The default behaviour varies depending upon the target involved and +the configure options used to build the toolchain. The default can be +determined by examing the output from the linker's @option{--help} option. @kindex --reduce-memory-overheads @item --reduce-memory-overheads diff --git a/ld/ldmain.c b/ld/ldmain.c index 96d7fe81ef7..bb0b9ccb2f4 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -281,6 +281,9 @@ main (int argc, char **argv) link_info.pei386_auto_import = -1; link_info.spare_dynamic_tags = 5; link_info.path_separator = ':'; +#ifdef DEFAULT_FLAG_COMPRESS_DEBUG + link_info.compress_debug = COMPRESS_DEBUG_GABI_ZLIB; +#endif ldfile_add_arch (""); emulation = get_emulation (argc, argv); diff --git a/ld/lexsup.c b/ld/lexsup.c index fdd39a73dc2..1dcbf4cfa72 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c @@ -1756,6 +1756,13 @@ elf_static_list_options (FILE *file) fprintf (file, _("\ --compress-debug-sections=[none|zlib|zlib-gnu|zlib-gabi]\n\ Compress DWARF debug sections using zlib\n")); +#ifdef DEFAULT_FLAG_COMPRESS_DEBUG + fprintf (file, _("\ + Default: zlib-gabi\n")); +#else + fprintf (file, _("\ + Default: none\n")); +#endif fprintf (file, _("\ -z common-page-size=SIZE Set common page size to SIZE\n")); fprintf (file, _("\ -- 2.30.2