forked from Imagelibrary/binutils-gdb
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user