From: H.J. Lu Date: Wed, 27 Apr 2016 16:13:10 +0000 (-0700) Subject: Skip debug sections when estimating distances X-Git-Tag: users/ARM/embedded-gdb-2_26-branch-2016q1~6^2~23 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=805af9f6edbc8e1b1fa8fb6b30902decc5433bd0;p=thirdparty%2Fbinutils-gdb.git Skip debug sections when estimating distances Skip debug sections when estimating distances between output sections since compressed_size is used to compress debug sections and debug sections aren't excluded from distances between output sections. Backport from master bfd/ PR ld/20006 * elf64-x86-64.c (elf_x86_64_convert_load): Skip debug sections when estimating distances between output sections. ld/ PR ld/20006 * testsuite/ld-elfvsb/elfvsb.exp (COMPRESS_LDFLAG): New. (visibility_run): Pass COMPRESS_LDFLAG to visibility_test on ELF targets. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 5c0e709c840..571841645dc 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,12 @@ +2016-04-30 H.J. Lu + + Backport from master + 2016-04-27 H.J. Lu + + PR ld/20006 + * elf64-x86-64.c (elf_x86_64_convert_load): Skip debug sections + when estimating distances between output sections. + 2016-03-29 Toni Spets PR 19878 diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index e80fd20db7b..764adc039de 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -3207,17 +3207,20 @@ elf_x86_64_convert_load (bfd *abfd, asection *sec, for (asect = link_info->output_bfd->sections; asect != NULL; asect = asect->next) - { - asection *i; - for (i = asect->map_head.s; - i != NULL; - i = i->map_head.s) - { - size = align_power (size, i->alignment_power); - size += i->size; - } - asect->compressed_size = size; - } + /* Skip debug sections since compressed_size is used to + compress debug sections. */ + if ((asect->flags & SEC_DEBUGGING) == 0) + { + asection *i; + for (i = asect->map_head.s; + i != NULL; + i = i->map_head.s) + { + size = align_power (size, i->alignment_power); + size += i->size; + } + asect->compressed_size = size; + } } /* Don't convert GOTPCREL relocations if TSEC isn't placed diff --git a/ld/ChangeLog b/ld/ChangeLog index c3eeded608b..749dcba42a7 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,13 @@ +2016-04-30 H.J. Lu + + Backport from master + 2016-04-27 H.J. Lu + + PR ld/20006 + * testsuite/ld-elfvsb/elfvsb.exp (COMPRESS_LDFLAG): New. + (visibility_run): Pass COMPRESS_LDFLAG to visibility_test on + ELF targets. + 2016-04-30 H.J. Lu Backport from master @@ -7,9 +17,9 @@ 2016-04-27 H.J. Lu - * ld-elf/compressed1b.d: Pass --compress-debug-sections=none - to ld. - * ld-elf/compressed1c.d: Likewise. + * testsuite/ld-elf/compressed1b.d: Pass + --compress-debug-sections=none to ld. + * testsuite/ld-elf/compressed1c.d: Likewise. 2016-04-04 H.J. Lu diff --git a/ld/testsuite/ld-elfvsb/elfvsb.exp b/ld/testsuite/ld-elfvsb/elfvsb.exp index e02d4faeee2..4766d0e7c44 100644 --- a/ld/testsuite/ld-elfvsb/elfvsb.exp +++ b/ld/testsuite/ld-elfvsb/elfvsb.exp @@ -62,6 +62,7 @@ if ![isnative] then {return} set tmpdir tmpdir set SHCFLAG "" set shared_needs_pic "no" +set COMPRESS_LDFLAG "-Wl,--compress-debug-sections=zlib-gabi" if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } { @@ -228,6 +229,7 @@ proc visibility_run {visibility} { global support_protected global shared_needs_pic global PLT_CFLAGS + global COMPRESS_LDFLAG if [ string match $visibility "hidden" ] { set VSBCFLAG "-DHIDDEN_TEST" @@ -384,7 +386,7 @@ proc visibility_run {visibility} { } else { if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } { visibility_test $visibility vp "visibility ($visibility)" mainnp.o sh1p.o sh2p.o xcoff } else { - visibility_test $visibility vp "visibility ($visibility)" mainnp.o sh1p.o sh2p.o elfvsb + visibility_test $visibility vp "visibility ($visibility)" mainnp.o sh1p.o sh2p.o elfvsb $COMPRESS_LDFLAG } } } }}