[build] Handle gas/gld --compress-debug-sections=type

Matthias Klose doko@ubuntu.com
Fri Dec 2 16:40:00 GMT 2016


>From my point of view this should be backported to the active branches.
Building GCC 5 and GCC 6 with binutils >=2.26 now results in

$ gcc -c -gz foo.c
gcc: error: -gz is not supported in this configuration

building these GCC version with binutils 2.25 recognizes this option.

On 30.05.2016 13:32, Rainer Orth wrote:
> * 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

the GNU case now reads

  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
    gcc_cv_ld_compress_debug_option="--compress-debug-sections"
  fi

so you end up with different values depending on the linker default. Is this
intended?

LINK_COMPRESS_DEBUG_SPEC in gcc.c is defined in terms of the linker used at
build time, so currently you get the wrong specs when using the non-default
linker when selecting the linker at runtime using -fuse-ld=...

Matthias



More information about the Gcc-patches mailing list