Fix objcopy's --preserve-dates command line option so that it will work with PE format files.

PR binutils/pr25662
bfd	* libcoff-in.h (struct pe_tdata): Rename the insert_timestamp
	field to timestamp and make it an integer.
	* libcoff.h: Regenerate.
	* peXXigen.c (_bfd_XXi_only_swap_filehdr_out): Test the timestamp
	field in the pe_data structure rather than the insert_timestamp
	field.

binutils* objcopy.c (copy_object): When copying PE format files set the
	timestamp field in the pe_data structure if the preserve_dates
	flag is set.
	* testsuite/binutils-all/objcopy.exp (objcopy_test) Use
	--preserve-dates in place of the -p option, in order to make its
	effect more obvious.

ld	* emultempl/pe.em (after_open): Replace initialisation of the
	insert_timestamp field in the pe_data structure with an
	initialisation of the timestamp field.
	* emultemp/pep.em: Likewise.
	* pe-dll.c (fill_edata): Use the timestamp field in the pe_data
	structure instead of the insert_timestamp field.
This commit is contained in:
Nick Clifton
2020-03-30 16:30:02 +01:00
parent 227c0bf4b3
commit 00386881a3
11 changed files with 55 additions and 8 deletions

View File

@@ -1211,8 +1211,10 @@ fill_edata (bfd *abfd, struct bfd_link_info *info ATTRIBUTE_UNUSED)
memset (edata_d, 0, edata_sz);
if (pe_data (abfd)->insert_timestamp)
if (pe_data (abfd)->timestamp == -1)
H_PUT_32 (abfd, time (0), edata_d + 4);
else
H_PUT_32 (abfd, pe_data (abfd)->timestamp, edata_d + 4);
if (pe_def_file->version_major != -1)
{