aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2020-03-30 16:30:02 +0100
committerNick Clifton <nickc@redhat.com>2020-03-30 16:30:02 +0100
commit00386881a3d0f7ac89fcc5cc912da8cd69c04324 (patch)
tree49d19d14cdb49b7bf0c6fb7f292be780eb385ca3 /bfd
parent227c0bf4b3dd0cf65dceb58e729e9da81b38b5a7 (diff)
downloadgdb-00386881a3d0f7ac89fcc5cc912da8cd69c04324.zip
gdb-00386881a3d0f7ac89fcc5cc912da8cd69c04324.tar.gz
gdb-00386881a3d0f7ac89fcc5cc912da8cd69c04324.tar.bz2
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 'bfd')
-rw-r--r--bfd/ChangeLog10
-rw-r--r--bfd/libcoff-in.h4
-rw-r--r--bfd/libcoff.h4
-rw-r--r--bfd/peXXigen.c4
4 files changed, 18 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index d17767f..bd43b67 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,13 @@
+2020-03-30 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/pr25662
+ * 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.
+
2020-03-30 Alan Modra <amodra@gmail.com>
PR 25745
diff --git a/bfd/libcoff-in.h b/bfd/libcoff-in.h
index 3030a65..c86ffc9 100644
--- a/bfd/libcoff-in.h
+++ b/bfd/libcoff-in.h
@@ -128,7 +128,9 @@ typedef struct pe_tdata
int has_reloc_section;
int dont_strip_reloc;
int dos_message[16];
- bfd_boolean insert_timestamp;
+ /* The timestamp to insert into the output file.
+ If the timestamp is -1 then the current time is used. */
+ int timestamp;
bfd_boolean (*in_reloc_p) (bfd *, reloc_howto_type *);
flagword real_flags;
diff --git a/bfd/libcoff.h b/bfd/libcoff.h
index 4c7be6e..eeb7b6b 100644
--- a/bfd/libcoff.h
+++ b/bfd/libcoff.h
@@ -132,7 +132,9 @@ typedef struct pe_tdata
int has_reloc_section;
int dont_strip_reloc;
int dos_message[16];
- bfd_boolean insert_timestamp;
+ /* The timestamp to insert into the output file.
+ If the timestamp is -1 then the current time is used. */
+ int timestamp;
bfd_boolean (*in_reloc_p) (bfd *, reloc_howto_type *);
flagword real_flags;
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index e42d646..b9eeb77 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -876,10 +876,10 @@ _bfd_XXi_only_swap_filehdr_out (bfd * abfd, void * in, void * out)
/* Use a real timestamp by default, unless the no-insert-timestamp
option was chosen. */
- if ((pe_data (abfd)->insert_timestamp))
+ if ((pe_data (abfd)->timestamp) == -1)
H_PUT_32 (abfd, time (0), filehdr_out->f_timdat);
else
- H_PUT_32 (abfd, 0, filehdr_out->f_timdat);
+ H_PUT_32 (abfd, pe_data (abfd)->timestamp, filehdr_out->f_timdat);
PUT_FILEHDR_SYMPTR (abfd, filehdr_in->f_symptr,
filehdr_out->f_symptr);