[PATCH] Add SHF_COMPRESSED support to gas and objcopy
H.J. Lu
hjl.tools@gmail.com
Wed Apr 8 16:28:00 GMT 2015
On Wed, Apr 8, 2015 at 9:01 AM, Steve Ellcey <sellcey@imgtec.com> wrote:
> On Wed, 2015-04-08 at 08:55 -0700, H.J. Lu wrote:
>
>> >
>> > I think this patch broke the bfd build (depending on what GCC you use to compile).
>> >
>> > /scratch/sellcey/repos/sim-bug/src/binutils/bfd/compress.c: In function 'bfd_init_section_compress_status':
>> > /scratch/sellcey/repos/sim-bug/src/binutils/bfd/compress.c:154:12: error: 'zlib_size' may be used uninitialized in this function [-Werror=uninitialized]
>> > /scratch/sellcey/repos/sim-bug/src/binutils/bfd/compress.c:82:7: note: 'zlib_size' was declared here
>> > cc1: all warnings being treated as errors
>> > make[3]: *** [compress.lo] Error 1
>> >
>>
>> Which GCC are you using?
>
> GCC 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
This is what I checked in.
--
H.J.
---
Subject: [PATCH] Work around a GCC uninitialized warning bug
* compress.c (bfd_compress_section_contents): Work around a GCC
uninitialized warning bug fixed in GCC 4.7.
---
bfd/ChangeLog | 5 +++++
bfd/compress.c | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 68e13c5..c7050af 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
2015-04-08 H.J. Lu <hongjiu.lu@intel.com>
+ * compress.c (bfd_compress_section_contents): Work around a GCC
+ uninitialized warning bug fixed in GCC 4.7.
+
+2015-04-08 H.J. Lu <hongjiu.lu@intel.com>
+
* archive.c (_bfd_get_elt_at_filepos): Also copy BFD_COMPRESS_GABI
bit.
* bfd.c (bfd::flags): Increase size to 18 bits.
diff --git a/bfd/compress.c b/bfd/compress.c
index ba9fc96..17b24e8 100644
--- a/bfd/compress.c
+++ b/bfd/compress.c
@@ -79,7 +79,12 @@ bfd_compress_section_contents (bfd *abfd, sec_ptr sec,
bfd_byte *buffer;
bfd_size_type buffer_size;
bfd_boolean decompress;
+#if defined(__GNUC__) && GCC_VERSION < 4007
+ /* Work around a GCC uninitialized warning bug fixed in GCC 4.7. */
+ int zlib_size = 0;
+#else
int zlib_size;
+#endif
int orig_compression_header_size;
int compression_header_size
= bfd_get_compression_header_size (abfd, NULL);
--
1.9.3
More information about the Binutils
mailing list