forked from Imagelibrary/binutils-gdb
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:
@@ -1,3 +1,13 @@
|
||||
2020-03-30 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
PR binutils/25662
|
||||
* 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.
|
||||
|
||||
2020-03-28 Alan Modra <amodra@gmail.com>
|
||||
|
||||
* testsuite/binutils-all/objcopy.exp (objcopy_test): Only
|
||||
|
||||
@@ -2774,6 +2774,11 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
|
||||
|
||||
file_alignment, section_alignment);
|
||||
}
|
||||
|
||||
if (preserve_dates
|
||||
&& bfd_get_flavour (ibfd) == bfd_target_coff_flavour
|
||||
&& bfd_pei_p (ibfd))
|
||||
pe->timestamp = pe_data (ibfd)->coff.timestamp;
|
||||
}
|
||||
|
||||
if (isympp)
|
||||
|
||||
@@ -76,7 +76,7 @@ proc objcopy_test {testname srcfile type asflags ldflags} {
|
||||
unresolved "objcopy $type ($testname)"
|
||||
return
|
||||
}
|
||||
set xflags "-p"
|
||||
set xflags "--preserve-dates"
|
||||
}
|
||||
|
||||
set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS $xflags $t_tempfile $t_copyfile"]
|
||||
|
||||
Reference in New Issue
Block a user