Set BFD compression bits in write_object_file

There is no need to set BFD compression bits for each section.  We
should just set it once in write_object_file.

	* write.c (compress_debug): Move BFD compression bits setting
	to ...
	(write_object_file): Here.
This commit is contained in:
H.J. Lu 2016-02-21 06:43:20 -08:00
parent 95693d0804
commit 8ecb73ddd7
2 changed files with 13 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2016-02-21 H.J. Lu <hongjiu.lu@intel.com>
* write.c (compress_debug): Move BFD compression bits setting
to ...
(write_object_file): Here.
2016-02-20 H.J. Lu <hongjiu.lu@intel.com> 2016-02-20 H.J. Lu <hongjiu.lu@intel.com>
* config/tc-i386.c (register_number): Check RegVRex. * config/tc-i386.c (register_number): Check RegVRex.

View File

@ -1433,14 +1433,12 @@ compress_debug (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED)
if (flag_compress_debug == COMPRESS_DEBUG_GABI_ZLIB) if (flag_compress_debug == COMPRESS_DEBUG_GABI_ZLIB)
{ {
stdoutput->flags |= BFD_COMPRESS | BFD_COMPRESS_GABI;
compression_header_size compression_header_size
= bfd_get_compression_header_size (stdoutput, NULL); = bfd_get_compression_header_size (stdoutput, NULL);
header_size = compression_header_size; header_size = compression_header_size;
} }
else else
{ {
stdoutput->flags |= BFD_COMPRESS;
compression_header_size = 0; compression_header_size = 0;
header_size = 12; header_size = 12;
} }
@ -2216,7 +2214,13 @@ write_object_file (void)
we start writing any sections, because it will affect the file we start writing any sections, because it will affect the file
layout, which is fixed once we start writing contents. */ layout, which is fixed once we start writing contents. */
if (flag_compress_debug) if (flag_compress_debug)
bfd_map_over_sections (stdoutput, compress_debug, (char *) 0); {
if (flag_compress_debug == COMPRESS_DEBUG_GABI_ZLIB)
stdoutput->flags |= BFD_COMPRESS | BFD_COMPRESS_GABI;
else
stdoutput->flags |= BFD_COMPRESS;
bfd_map_over_sections (stdoutput, compress_debug, (char *) 0);
}
bfd_map_over_sections (stdoutput, write_contents, (char *) 0); bfd_map_over_sections (stdoutput, write_contents, (char *) 0);
} }