Blame binutils-2.24-fake-zlib-sections.patch

057864b
*** ../binutils-2.24.orig/bfd/compress.c	2014-04-28 16:35:20.429816317 +0100
057864b
--- bfd/compress.c	2014-04-28 16:36:06.450963028 +0100
057864b
***************
057864b
*** 25,30 ****
057864b
--- 25,31 ----
057864b
  #ifdef HAVE_ZLIB_H
057864b
  #include <zlib.h>
057864b
  #endif
057864b
+ #include "safe-ctype.h"
057864b
  
057864b
  #ifdef HAVE_ZLIB_H
057864b
  static bfd_boolean
057864b
*************** bfd_is_section_compressed (bfd *abfd, se
057864b
*** 304,309 ****
057864b
--- 305,319 ----
057864b
    compressed = (bfd_get_section_contents (abfd, sec, compressed_buffer, 0, 12)
057864b
  		&& CONST_STRNEQ ((char*) compressed_buffer, "ZLIB"));
057864b
  
057864b
+   /* Check for the pathalogical case of a debug string section that
057864b
+      contains the string ZLIB.... as the first entry.  We assume that
057864b
+      no uncompressed .debug_str section would ever be big enough to
057864b
+      have the first byte of its (big-endian) size be non-zero.  */
057864b
+   if (compressed
057864b
+       && strcmp (sec->name, ".debug_str") == 0
057864b
+       && ISPRINT (compressed_buffer[4]))
057864b
+     compressed = FALSE;
057864b
+ 
057864b
    /* Restore compress_status.  */
057864b
    sec->compress_status = saved;
057864b
    return compressed;