From: Jan Beulich <jbeulich@suse.com>
To: Binutils <binutils@sourceware.org>
Cc: Dave Korn <dave.korn.cygwin@gmail.com>
Subject: [PATCH 3/5] COFF/PE: don't leave zero timestamp after objcopy / strip
Date: Fri, 6 May 2022 08:54:49 +0200 [thread overview]
Message-ID: <d8c3ddea-2c88-9051-5e11-070b270212d2@suse.com> (raw)
In-Reply-To: <4242b48a-f2c3-4af2-db1e-35dbbbdc1b2e@suse.com>
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.
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -2747,7 +2747,14 @@ copy_object (bfd *ibfd, bfd *obfd, const
/* 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
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);
next prev parent reply other threads:[~2022-05-06 6:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-06 6:53 [PATCH 0/5] PE/COFF: assorted adjustments Jan Beulich
2022-05-06 6:54 ` [PATCH 1/5] don't over-align file positions of PE executable sections Jan Beulich
2022-05-06 6:54 ` [PATCH 2/5] COFF: make objcopy / strip honor --keep-file-symbols Jan Beulich
2022-05-06 6:54 ` Jan Beulich [this message]
2022-05-06 6:55 ` [PATCH 4/5] COFF/PE: keep linker version during objcopy / strip Jan Beulich
2022-05-06 6:55 ` [PATCH 5/5] COFF: use hash for string table also when copying / stripping Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d8c3ddea-2c88-9051-5e11-070b270212d2@suse.com \
--to=jbeulich@suse.com \
--cc=binutils@sourceware.org \
--cc=dave.korn.cygwin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).