This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Set BFD compression bits in write_object_file
- From: H.J.Lu <hjl at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 21 Feb 2016 14:46:34 -0000
- Subject: [binutils-gdb] Set BFD compression bits in write_object_file
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8ecb73ddd7efde747f9b025cb624e378bc994db5
commit 8ecb73ddd7efde747f9b025cb624e378bc994db5
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Sun Feb 21 06:43:20 2016 -0800
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.
Diff:
---
gas/ChangeLog | 6 ++++++
gas/write.c | 10 +++++++---
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 87eb412..293e00e 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -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>
* config/tc-i386.c (register_number): Check RegVRex.
diff --git a/gas/write.c b/gas/write.c
index 46d8d96..46ce5df 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -1433,14 +1433,12 @@ compress_debug (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED)
if (flag_compress_debug == COMPRESS_DEBUG_GABI_ZLIB)
{
- stdoutput->flags |= BFD_COMPRESS | BFD_COMPRESS_GABI;
compression_header_size
= bfd_get_compression_header_size (stdoutput, NULL);
header_size = compression_header_size;
}
else
{
- stdoutput->flags |= BFD_COMPRESS;
compression_header_size = 0;
header_size = 12;
}
@@ -2216,7 +2214,13 @@ write_object_file (void)
we start writing any sections, because it will affect the file
layout, which is fixed once we start writing contents. */
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);
}