This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Add SHF_COMPRESSED support to gas and objcopy
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: sellcey at imgtec dot com
- Cc: Binutils <binutils at sourceware dot org>
- Date: Wed, 8 Apr 2015 09:28:26 -0700
- Subject: Re: [PATCH] Add SHF_COMPRESSED support to gas and objcopy
- Authentication-results: sourceware.org; auth=none
- References: <CAMe9rOr2L_BfEG4JgEUbqQs8regCyNXW3-+J0cMcCW3RiOL1aw at mail dot gmail dot com> <1428508446 dot 30498 dot 91 dot camel at ubuntu-sellcey> <CAMe9rOq7VH6PM+tRbz+zqUhw7NPWXbEYnrUg8o1jnxwo8HF76w at mail dot gmail dot com> <1428508893 dot 30498 dot 93 dot camel at ubuntu-sellcey>
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