diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2015-03-18 15:47:13 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2015-03-18 15:47:13 +0000 |
commit | 273a49858fa9c8d73de87167618ef99d70f9731a (patch) | |
tree | f003dbb576f1e259d8a68250ba039550f6608fee /gas | |
parent | 670f82d437c21ec9c8f59a365336163e0381149d (diff) | |
download | gdb-273a49858fa9c8d73de87167618ef99d70f9731a.zip gdb-273a49858fa9c8d73de87167618ef99d70f9731a.tar.gz gdb-273a49858fa9c8d73de87167618ef99d70f9731a.tar.bz2 |
Fix debug section compression so that it is only performed if it would make the section smaller.
PR binutils/18087
gas * doc/as.texinfo: Note that when gas compresses debug sections the
compression is only performed if it makes the section smaller.
* write.c (compress_debug): Do not compress a debug section if
doing so would make it larger.
tests * gas/i386/dw2-compress-1.d: Do not expect the .debug_abbrev or
.debug_info sections to be compressed.
binu * doc/binutils.texi: Note that when objcopy compresses debug
sections the compression is only performed if it makes the section
smaller.
bfd * coffgen.c (make_a_section_from_file): Only prepend a z to a
debug section's name if the section was actually compressed.
* elf.c (_bfd_elf_make_section_from_shdr): Likewise.
* compress.c (bfd_init_section_compress_status): Do not compress
the section if doing so would make it bigger. In such cases leave
the section alone and return COMPRESS_SECTION_NONE.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 9 | ||||
-rw-r--r-- | gas/doc/as.texinfo | 3 | ||||
-rw-r--r-- | gas/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/dw2-compress-1.d | 4 | ||||
-rw-r--r-- | gas/write.c | 5 |
5 files changed, 25 insertions, 3 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index bccf7b30..7bf7794 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,12 @@ +2015-03-18 Jon Turney <jon.turney@dronecode.org.uk> + Nick Clifton <nickc@redhat.com> + + PR binutils/18087 + * doc/as.texinfo: Note that when gas compresses debug sections the + compression is only performed if it makes the section smaller. + * write.c (compress_debug): Do not compress a debug section if + doing so would make it larger. + 2015-03-17 Ganesh Gopalasubramanian <Ganesh.Gopalasubramanian@amd.com> * config/tc-i386.c (cpu_arch): Add PROCESSOR_ZNVER flags. diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo index 36c2207..bedb4d5 100644 --- a/gas/doc/as.texinfo +++ b/gas/doc/as.texinfo @@ -627,7 +627,8 @@ Begin in alternate macro mode. @item --compress-debug-sections Compress DWARF debug sections using zlib. The debug sections are renamed to begin with @samp{.zdebug}, and the resulting object file may not be -compatible with older linkers and object file utilities. +compatible with older linkers and object file utilities. Note if compression +would make a given section @emph{larger} then it is not compressed or renamed. @item --nocompress-debug-sections Do not compress DWARF debug sections. This is the default. diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 3b58c97..5b16085 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2015-03-18 Jon Turney <jon.turney@dronecode.org.uk> + Nick Clifton <nickc@redhat.com> + + PR binutils/18087 + * gas/i386/dw2-compress-1.d: Do not expect the .debug_abbrev or + .debug_info sections to be compressed. + 2015-03-17 Ganesh Gopalasubramanian <Ganesh.Gopalasubramanian@amd.com> * gas/i386/i386.exp: Add new znver1 test cases. diff --git a/gas/testsuite/gas/i386/dw2-compress-1.d b/gas/testsuite/gas/i386/dw2-compress-1.d index 4d1a393..2b2fd8d 100644 --- a/gas/testsuite/gas/i386/dw2-compress-1.d +++ b/gas/testsuite/gas/i386/dw2-compress-1.d @@ -2,7 +2,7 @@ #readelf: -w #name: DWARF2 debugging information 1 -Contents of the .zdebug_info section: +Contents of the .debug_info section: Compilation Unit @ offset 0x0: Length: 0x4e \(32-bit\) @@ -31,7 +31,7 @@ Contents of the .zdebug_info section: <50> DW_AT_encoding : 5 \(signed\) <1><51>: Abbrev Number: 0 -Contents of the .zdebug_abbrev section: +Contents of the .debug_abbrev section: Number TAG \(0x0\) 1 DW_TAG_compile_unit \[has children\] diff --git a/gas/write.c b/gas/write.c index 949ae92..e3570ac 100644 --- a/gas/write.c +++ b/gas/write.c @@ -1526,6 +1526,11 @@ compress_debug (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) break; } + /* PR binutils/18087: If compression didn't make + the section smaller, just keep it uncompressed. */ + if (compressed_size > sec->size) + return; + /* Replace the uncompressed frag list with the compressed frag list. */ seginfo->frchainP->frch_root = first_newf; seginfo->frchainP->frch_last = last_newf; |