I noticed that, while gcc.c is already prepared for it, gcc/configure doesn't yet detect the full ELF gABI compression support introduced in GNU binutils 2.26.
The following patch adds the missing pieces. While mostly straightforward, there are two noteworthy issues: * I'm removing the `extra switches' arg to gcc_GAS_CHECK_FEATURES. This would cause HAVE_AS_COMPRESS_DEBUG to be set to "no" instead of one of the numeric values when testing /bin/as on Solaris. In the future, this might cause to misdetect assembler compression support requiring a different option. * When I removed the default in the gcc_cv_ld_compress test, the outcome always was 0, irrespective of the linker tested. Before, it would almost always have been 1 if testing GNU ld. It turns out that in this (and numerous other) cases the nesting of tests using ld_date was wrong. I believe most if not all of those ld_date tests can go, being only relevant for truly prehistoric versions of GNU ld not in use anymore. I'll probably submit a followup to remove them, simplifying several ld tests. Bootstrapped without regressions on i386-pc-solaris2.1[02] with various as/ld combinations and checking that the tests yielded the expected results: gcc_cv_as_compress_debug/gcc_cv_ld_compress_debug as/ld 2.10 0/0 as/ld 2.12 0/3 gas 2.26/ld 2.10 2/0 gas 2.26/ld 2.12 2/3 gas 2.26/gld 2.26 2/3 gas 2.25/gld 2.25 1/1 I've also compiled and linked a test program and checked that assembler and linker were invoked as expected for -gz/-gz=none/-gz=zlib/-gz=zlib-gnu and yielded either errors or output with compressed debug sections as should be. Ok for mainline? Rainer 2016-05-26 Rainer Orth <r...@cebitec.uni-bielefeld.de> * configure.ac (gcc_cv_as_compress_debug): Remove --compress-debug-sections as extra as switch. Handle gas --compress-debug-sections=type. (gcc_cv_ld_compess_debug): Remove bogus ld_date check. Handle gld --compress-debug-sections=type. * configure: Regenerate.
# HG changeset patch # Parent 42e566f9c2ba3a71305b2db7875ea2e5fe2df2c2 Handle gas/gld --compress-debug-sections=type diff --git a/gcc/configure.ac b/gcc/configure.ac --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -4731,12 +4731,21 @@ if test x"$insn" != x; then fi gcc_GAS_CHECK_FEATURE([compressed debug sections], - gcc_cv_as_compress_debug,,[--compress-debug-sections],, + gcc_cv_as_compress_debug,,,, [# gas compiled without zlib cannot compress debug sections and warns # about it, but still exits successfully. So check for this, too. if $gcc_cv_as --compress-debug-sections -o conftest.o conftest.s 2>&1 | grep -i warning > /dev/null then gcc_cv_as_compress_debug=0 + # Since binutils 2.26, gas supports --compress-debug-sections=type, + # defaulting to the ELF gABI format. + elif $gcc_cv_as --compress-debug-sections=zlib-gnu -o conftest.o conftest.s > /dev/null 2>&1 + then + gcc_cv_as_compress_debug=2 + gcc_cv_as_compress_debug_option="--compress-debug-sections" + gcc_cv_as_no_compress_debug_option="--nocompress-debug-sections" + # Before binutils 2.26, gas only supported --compress-debug-options and + # emitted the traditional GNU format. elif $gcc_cv_as --compress-debug-sections -o conftest.o conftest.s > /dev/null 2>&1 then gcc_cv_as_compress_debug=1 @@ -4744,8 +4753,6 @@ gcc_GAS_CHECK_FEATURE([compressed debug gcc_cv_as_no_compress_debug_option="--nocompress-debug-sections" else gcc_cv_as_compress_debug=0 - # FIXME: Future gas versions will support ELF gABI style via - # --compress-debug-sections[=type]. fi]) AC_DEFINE_UNQUOTED(HAVE_AS_COMPRESS_DEBUG, $gcc_cv_as_compress_debug, [Define to the level of your assembler's compressed debug section support.]) @@ -5120,27 +5127,30 @@ AC_MSG_RESULT($gcc_cv_ld_eh_gc_sections_ AC_MSG_CHECKING(linker for compressed debug sections) # gold/gld support compressed debug sections since binutils 2.19/2.21 +# In binutils 2.26, gld gained support for the ELF gABI format. if test $in_tree_ld = yes ; then gcc_cv_ld_compress_debug=0 if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 19 -o "$gcc_cv_gld_major_version" -gt 2 \ && test $in_tree_ld_is_elf = yes && test $ld_is_gold = yes; then gcc_cv_ld_compress_debug=2 gcc_cv_ld_compress_debug_option="--compress-debug-sections" + elif test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 26 -o "$gcc_cv_gld_major_version" -gt 2 \ + && test $in_tree_ld_is_elf = yes && test $ld_is_gold = no; then + gcc_cv_ld_compress_debug=3 + gcc_cv_ld_compress_debug_option="--compress-debug-sections" elif test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 21 -o "$gcc_cv_gld_major_version" -gt 2 \ && test $in_tree_ld_is_elf = yes; then gcc_cv_ld_compress_debug=1 fi elif echo "$ld_ver" | grep GNU > /dev/null; then - gcc_cv_ld_compress_debug=1 - if test 0"$ld_date" -lt 20050308; then - if test -n "$ld_date"; then - # If there was date string, but was earlier than 2005-03-08, fail - gcc_cv_ld_compress_debug=0 - elif test "$ld_vers_major" -lt 2; then - gcc_cv_ld_compress_debug=0 - elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 21; then - gcc_cv_ld_compress_debug=0 - fi + if test "$ld_vers_major" -lt 2 \ + || test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 21; then + gcc_cv_ld_compress_debug=0 + elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 26; then + gcc_cv_ld_compress_debug=1 + else + gcc_cv_ld_compress_debug=3 + gcc_cv_ld_compress_debug_option="--compress-debug-sections" fi if test $ld_is_gold = yes; then gcc_cv_ld_compress_debug=2
-- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University