mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-20 18:08:24 +08:00
Don't write the zlib header if not used
No need to write the zlib header if compression didn't make the section smaller. PR gas/18087 * write.c (compress_debug): Don't write the zlib header if compression didn't make the section smaller.
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2015-03-24 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
PR gas/18087
|
||||||
|
* write.c (compress_debug): Don't write the zlib header if
|
||||||
|
compression didn't make the section smaller.
|
||||||
|
|
||||||
2015-03-24 Terry Guo <terry.guo@arm.com>
|
2015-03-24 Terry Guo <terry.guo@arm.com>
|
||||||
|
|
||||||
* config/tc-arm.c (no_cpu_selected): Use new macro to compare
|
* config/tc-arm.c (no_cpu_selected): Use new macro to compare
|
||||||
|
25
gas/write.c
25
gas/write.c
@ -1438,15 +1438,6 @@ compress_debug (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED)
|
|||||||
last_newf->fr_type = rs_fill;
|
last_newf->fr_type = rs_fill;
|
||||||
last_newf->fr_fix = 12;
|
last_newf->fr_fix = 12;
|
||||||
header = last_newf->fr_literal;
|
header = last_newf->fr_literal;
|
||||||
memcpy (header, "ZLIB", 4);
|
|
||||||
header[11] = uncompressed_size; uncompressed_size >>= 8;
|
|
||||||
header[10] = uncompressed_size; uncompressed_size >>= 8;
|
|
||||||
header[9] = uncompressed_size; uncompressed_size >>= 8;
|
|
||||||
header[8] = uncompressed_size; uncompressed_size >>= 8;
|
|
||||||
header[7] = uncompressed_size; uncompressed_size >>= 8;
|
|
||||||
header[6] = uncompressed_size; uncompressed_size >>= 8;
|
|
||||||
header[5] = uncompressed_size; uncompressed_size >>= 8;
|
|
||||||
header[4] = uncompressed_size;
|
|
||||||
compressed_size = 12;
|
compressed_size = 12;
|
||||||
|
|
||||||
/* Stream the frags through the compression engine, adding new frags
|
/* Stream the frags through the compression engine, adding new frags
|
||||||
@ -1526,11 +1517,21 @@ compress_debug (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PR binutils/18087: If compression didn't make
|
/* PR binutils/18087: If compression didn't make the section smaller,
|
||||||
the section smaller, just keep it uncompressed. */
|
just keep it uncompressed. */
|
||||||
if (compressed_size > sec->size)
|
if (compressed_size > uncompressed_size)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
memcpy (header, "ZLIB", 4);
|
||||||
|
header[11] = uncompressed_size; uncompressed_size >>= 8;
|
||||||
|
header[10] = uncompressed_size; uncompressed_size >>= 8;
|
||||||
|
header[9] = uncompressed_size; uncompressed_size >>= 8;
|
||||||
|
header[8] = uncompressed_size; uncompressed_size >>= 8;
|
||||||
|
header[7] = uncompressed_size; uncompressed_size >>= 8;
|
||||||
|
header[6] = uncompressed_size; uncompressed_size >>= 8;
|
||||||
|
header[5] = uncompressed_size; uncompressed_size >>= 8;
|
||||||
|
header[4] = uncompressed_size;
|
||||||
|
|
||||||
/* Replace the uncompressed frag list with the compressed frag list. */
|
/* Replace the uncompressed frag list with the compressed frag list. */
|
||||||
seginfo->frchainP->frch_root = first_newf;
|
seginfo->frchainP->frch_root = first_newf;
|
||||||
seginfo->frchainP->frch_last = last_newf;
|
seginfo->frchainP->frch_last = last_newf;
|
||||||
|
Reference in New Issue
Block a user