aboutsummaryrefslogtreecommitdiff
path: root/gold/compressed_output.cc
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 /gold/compressed_output.cc
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 'gold/compressed_output.cc')
-rw-r--r--gold/compressed_output.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/gold/compressed_output.cc b/gold/compressed_output.cc
index 4374ba1..45077f7 100644
--- a/gold/compressed_output.cc
+++ b/gold/compressed_output.cc
@@ -286,6 +286,8 @@ Output_compressed_section::set_final_data_size()
chdr.put_ch_type(elfcpp::ELFCOMPRESS_ZLIB);
chdr.put_ch_size(uncompressed_size);
chdr.put_ch_addralign(addralign);
+ // Clear the reserved field.
+ chdr.put_ch_reserved(0);
}
else
{
@@ -293,6 +295,8 @@ Output_compressed_section::set_final_data_size()
chdr.put_ch_type(elfcpp::ELFCOMPRESS_ZLIB);
chdr.put_ch_size(uncompressed_size);
chdr.put_ch_addralign(addralign);
+ // Clear the reserved field.
+ chdr.put_ch_reserved(0);
}
}
else