[binutils-gdb] Change ch_type to Elf_Word in struct Chdr_data<64>

H.J.Lu hjl@sourceware.org
Sun Oct 4 13:15:00 GMT 2015


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9706b5e627dfae1ab0a2788dda8a2aa5a0e09af7

commit 9706b5e627dfae1ab0a2788dda8a2aa5a0e09af7
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Oct 4 06:14:13 2015 -0700

    Change ch_type to Elf_Word in struct Chdr_data<64>
    
    The ch_type field in struct Chdr_data<64>  is 4 bytes, followed by a
    4-byte padding.  This change doesn't introduce any functional change
    since only the lower 32 bits of the ch_type field are used.
    
    	PR gold/19060
    	* elfcpp.h (Chdr::get_ch_type): Change return type to Elf_Word.
    	* elfcpp_internal.h (Chdr_data<64>): Change ch_type to 4 bytes
    	and add ch_reserved.

Diff:
---
 elfcpp/ChangeLog         |  7 +++++++
 elfcpp/elfcpp.h          |  2 +-
 elfcpp/elfcpp_internal.h | 20 ++++++++++++++++----
 3 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/elfcpp/ChangeLog b/elfcpp/ChangeLog
index 3342ac9..042d86e 100644
--- a/elfcpp/ChangeLog
+++ b/elfcpp/ChangeLog
@@ -1,3 +1,10 @@
+2015-10-02  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR gold/19060
+	* elfcpp.h (Chdr::get_ch_type): Change return type to Elf_Word.
+	* elfcpp_internal.h (Chdr_data<64>): Change ch_type to 4 bytes
+	and add ch_reserved.
+
 2015-04-08  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* elfcpp.h (Elf_sizes): Add chdr_size.
diff --git a/elfcpp/elfcpp.h b/elfcpp/elfcpp.h
index 722984e..70380a5 100644
--- a/elfcpp/elfcpp.h
+++ b/elfcpp/elfcpp.h
@@ -1302,7 +1302,7 @@ class Chdr
 	   file->view(loc.file_offset, loc.data_size).data()))
   { }
 
-  typename Elf_types<size>::Elf_WXword
+  Elf_Word
   get_ch_type() const
   { return Convert<size, big_endian>::convert_host(this->p_->ch_type); }
 
diff --git a/elfcpp/elfcpp_internal.h b/elfcpp/elfcpp_internal.h
index 424a1f6..6f9dd48 100644
--- a/elfcpp/elfcpp_internal.h
+++ b/elfcpp/elfcpp_internal.h
@@ -82,11 +82,23 @@ struct Shdr_data
 // An ELF compression header.
 
 template<int size>
-struct Chdr_data
+struct Chdr_data;
+
+template<>
+struct Chdr_data<32>
+{
+  Elf_Word ch_type;
+  Elf_Word ch_size;
+  Elf_Word ch_addralign;
+};
+
+template<>
+struct Chdr_data<64>
 {
-  typename Elf_types<size>::Elf_WXword ch_type;
-  typename Elf_types<size>::Elf_WXword ch_size;
-  typename Elf_types<size>::Elf_WXword ch_addralign;
+  Elf_Word ch_type;
+  Elf_Word ch_reserved;
+  Elf_Xword ch_size;
+  Elf_Xword ch_addralign;
 };
 
 // An ELF segment header.  We use template specialization for the



More information about the Binutils-cvs mailing list