aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2022-05-19 12:44:32 +0200
committerJan Beulich <jbeulich@suse.com>2022-05-19 12:44:32 +0200
commit6db1e45d7b85634679bc6dedf4e4a2c78fed74d4 (patch)
tree73e31ac40a3a154155bf5a2064498f0967da2775 /binutils
parentce462d043509df3f3384decdf2019a1c85051640 (diff)
downloadfsf-binutils-gdb-6db1e45d7b85634679bc6dedf4e4a2c78fed74d4.zip
fsf-binutils-gdb-6db1e45d7b85634679bc6dedf4e4a2c78fed74d4.tar.gz
fsf-binutils-gdb-6db1e45d7b85634679bc6dedf4e4a2c78fed74d4.tar.bz2
COFF/PE: don't leave zero timestamp after objcopy / strip
Fill the timestamp field suitably for _bfd_XXi_only_swap_filehdr_out(). Instead of re-arranging the present if(), fold this logic with that of copying the optional header.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/objcopy.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 6fb31c8..7ad39e8 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -2747,7 +2747,14 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
/* Copy PE parameters before changing them. */
if (bfd_get_flavour (ibfd) == bfd_target_coff_flavour
&& bfd_pei_p (ibfd))
- pe->pe_opthdr = pe_data (ibfd)->pe_opthdr;
+ {
+ pe->pe_opthdr = pe_data (ibfd)->pe_opthdr;
+
+ if (preserve_dates)
+ pe->timestamp = pe_data (ibfd)->coff.timestamp;
+ else
+ pe->timestamp = -1;
+ }
if (pe_file_alignment != (bfd_vma) -1)
pe->pe_opthdr.FileAlignment = pe_file_alignment;
@@ -2793,11 +2800,6 @@ 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;
}
free (isympp);