aboutsummaryrefslogtreecommitdiff
path: root/elfcpp
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-07-28 13:39:42 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-07-28 13:40:01 -0700
commit49ba15a23a9d3d8a109ce2fd5053822eee7f1fdf (patch)
tree5441efd64dce3456b6fb9e6dbcb941517190a03c /elfcpp
parent894dde0ba7eb0789fbc1009c9541ac6d68389968 (diff)
downloadgdb-49ba15a23a9d3d8a109ce2fd5053822eee7f1fdf.zip
gdb-49ba15a23a9d3d8a109ce2fd5053822eee7f1fdf.tar.gz
gdb-49ba15a23a9d3d8a109ce2fd5053822eee7f1fdf.tar.bz2
gold: Add put_ch_reserved to 64-bit Chdr_write
The 64-bit ELF compression header has a reserved field. It should be cleared to avoid random bits in it. elfcpp/ PR gold/21857 * elfcpp.h (Chdr_write): Add put_ch_reserved. (Chdr_write<64, true>::put_ch_reserved): New. (Chdr_write<64, false>::put_ch_reserved): Likewise. gold/ PR gold/21857 * compressed_output.cc (Output_compressed_section::set_final_data_size): Call put_ch_reserved to clear the reserved field for 64-bit ELF.
Diffstat (limited to 'elfcpp')
-rw-r--r--elfcpp/ChangeLog7
-rw-r--r--elfcpp/elfcpp.h17
2 files changed, 24 insertions, 0 deletions
diff --git a/elfcpp/ChangeLog b/elfcpp/ChangeLog
index fc864bf..f669248 100644
--- a/elfcpp/ChangeLog
+++ b/elfcpp/ChangeLog
@@ -1,3 +1,10 @@
+2017-07-28 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR gold/21857
+ * elfcpp.h (Chdr_write): Add put_ch_reserved.
+ (Chdr_write<64, true>::put_ch_reserved): New.
+ (Chdr_write<64, false>::put_ch_reserved): Likewise.
+
2017-07-03 Alan Modra <amodra@gmail.com>
* dwarf.h (DW_FIRST_IDX, DW_IDX, DW_IDX_DUP, DW_END_IDX): Define,
diff --git a/elfcpp/elfcpp.h b/elfcpp/elfcpp.h
index a57f547..cccec4c 100644
--- a/elfcpp/elfcpp.h
+++ b/elfcpp/elfcpp.h
@@ -1351,10 +1351,27 @@ class Chdr_write
put_ch_addralign(typename Elf_types<size>::Elf_WXword v)
{ this->p_->ch_addralign = Convert<size, big_endian>::convert_host(v); }
+ void
+ put_ch_reserved(Elf_Word);
+
private:
internal::Chdr_data<size>* p_;
};
+template<>
+inline void
+elfcpp::Chdr_write<64, true>::put_ch_reserved(Elf_Word v)
+{
+ this->p_->ch_reserved = v;
+}
+
+template<>
+inline void
+elfcpp::Chdr_write<64, false>::put_ch_reserved(Elf_Word v)
+{
+ this->p_->ch_reserved = v;
+}
+
// Accessor class for an ELF segment header.
template<int size, bool big_endian>