/* Compressed section support (intended for debug sections).
- Copyright (C) 2008-2019 Free Software Foundation, Inc.
+ Copyright (C) 2008-2021 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
break;
rc = inflateReset (&strm);
}
- rc |= inflateEnd (&strm);
- return rc == Z_OK && strm.avail_out == 0;
+ return inflateEnd (&strm) == Z_OK && rc == Z_OK && strm.avail_out == 0;
}
/* Compress data of the size specified in @var{uncompressed_size}
/* PR 24753: Linker created sections can be larger than
the file size, eg if they are being used to hold stubs. */
&& (bfd_section_flags (sec) & SEC_LINKER_CREATED) == 0
+ /* PR 24753: Sections which have no content should also be
+ excluded as they contain no size on disk. */
+ && (bfd_section_flags (sec) & SEC_HAS_CONTENTS) != 0
/* The MMO file format supports its own special compression
technique, but it uses COMPRESS_SECTION_NONE when loading
a section's contents. */
if (compression_header_size == 0)
/* In this case, it should be "ZLIB" followed by the uncompressed
section size, 8 bytes in big-endian order. */
- compressed = CONST_STRNEQ ((char*) header , "ZLIB");
+ compressed = startswith ((char*) header , "ZLIB");
else
compressed = TRUE;
}
{
/* In this case, it should be "ZLIB" followed by the uncompressed
section size, 8 bytes in big-endian order. */
- if (! CONST_STRNEQ ((char*) header, "ZLIB"))
+ if (! startswith ((char*) header, "ZLIB"))
{
bfd_set_error (bfd_error_wrong_format);
return FALSE;