aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-10-24 21:36:50 +0000
committerH.J. Lu <hjl.tools@gmail.com>2012-10-24 21:36:50 +0000
commit64f401629ba3680d49952c5e96ff88cd4103a156 (patch)
tree76ac97b922f7f354438100cc1ab2de8c2b6f99c8 /bfd
parent2590b6456f77cd232d154e0930510c02a01e5be7 (diff)
downloadgdb-64f401629ba3680d49952c5e96ff88cd4103a156.zip
gdb-64f401629ba3680d49952c5e96ff88cd4103a156.tar.gz
gdb-64f401629ba3680d49952c5e96ff88cd4103a156.tar.bz2
Don't decompress the section in bfd_is_section_compressed
* compress.c (bfd_is_section_compressed): Don't decompress the section.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/compress.c13
2 files changed, 16 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 599e0bf..6125ab5 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2012-10-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ * compress.c (bfd_is_section_compressed): Don't decompress the
+ section.
+
2012-10-23 Nathan Sidwell <nathan@codesourcery.com>
* bfd-in.h (bfd_elf_stack_segment_size): Declare.
diff --git a/bfd/compress.c b/bfd/compress.c
index 7f94781..75d54e4 100644
--- a/bfd/compress.c
+++ b/bfd/compress.c
@@ -292,11 +292,20 @@ bfd_boolean
bfd_is_section_compressed (bfd *abfd, sec_ptr sec)
{
bfd_byte compressed_buffer [12];
+ unsigned int saved = sec->compress_status;
+ bfd_boolean compressed;
+
+ /* Don't decompress the section. */
+ sec->compress_status = COMPRESS_SECTION_NONE;
/* Read the zlib header. In this case, it should be "ZLIB" followed
by the uncompressed section size, 8 bytes in big-endian order. */
- return (bfd_get_section_contents (abfd, sec, compressed_buffer, 0, 12)
- && CONST_STRNEQ ((char*) compressed_buffer, "ZLIB"));
+ compressed = (bfd_get_section_contents (abfd, sec, compressed_buffer, 0, 12)
+ && CONST_STRNEQ ((char*) compressed_buffer, "ZLIB"));
+
+ /* Restore compress_status. */
+ sec->compress_status = saved;
+ return compressed;
}
/*