diff options
author | Nick Clifton <nickc@redhat.com> | 2020-03-30 16:30:02 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2020-03-30 16:30:02 +0100 |
commit | 00386881a3d0f7ac89fcc5cc912da8cd69c04324 (patch) | |
tree | 49d19d14cdb49b7bf0c6fb7f292be780eb385ca3 /ld | |
parent | 227c0bf4b3dd0cf65dceb58e729e9da81b38b5a7 (diff) | |
download | binutils-gdb-00386881a3d0f7ac89fcc5cc912da8cd69c04324.tar.gz |
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.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 10 | ||||
-rw-r--r-- | ld/emultempl/pe.em | 5 | ||||
-rw-r--r-- | ld/emultempl/pep.em | 5 | ||||
-rw-r--r-- | ld/pe-dll.c | 4 |
4 files changed, 21 insertions, 3 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 1227113d00c..15d34bc5a3f 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,13 @@ +2020-03-30 Nick Clifton <nickc@redhat.com> + + PR binutils/25662 + * 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. + 2020-03-28 H.J. Lu <hongjiu.lu@intel.com> PR 25732 diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index db23b221d66..4fe195ec32a 100644 --- a/ld/emultempl/pe.em +++ b/ld/emultempl/pe.em @@ -1375,7 +1375,10 @@ gld_${EMULATION_NAME}_after_open (void) pe_data (link_info.output_bfd)->pe_opthdr = pe; pe_data (link_info.output_bfd)->dll = init[DLLOFF].value; pe_data (link_info.output_bfd)->real_flags |= real_flags; - pe_data (link_info.output_bfd)->insert_timestamp = insert_timestamp; + if (insert_timestamp) + pe_data (link_info.output_bfd)->timestamp = -1; + else + pe_data (link_info.output_bfd)->timestamp = 0; /* At this point we must decide whether to use long section names in the output or not. If the user hasn't explicitly specified diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em index 3d09a0a6b13..3e03eb3a6e0 100644 --- a/ld/emultempl/pep.em +++ b/ld/emultempl/pep.em @@ -1364,7 +1364,10 @@ gld_${EMULATION_NAME}_after_open (void) pe_data (link_info.output_bfd)->pe_opthdr = pep; pe_data (link_info.output_bfd)->dll = init[DLLOFF].value; pe_data (link_info.output_bfd)->real_flags |= real_flags; - pe_data (link_info.output_bfd)->insert_timestamp = insert_timestamp; + if (insert_timestamp) + pe_data (link_info.output_bfd)->timestamp = -1; + else + pe_data (link_info.output_bfd)->timestamp = 0; /* At this point we must decide whether to use long section names in the output or not. If the user hasn't explicitly specified diff --git a/ld/pe-dll.c b/ld/pe-dll.c index 397af8780e4..0addde23186 100644 --- a/ld/pe-dll.c +++ b/ld/pe-dll.c @@ -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) { |