Commit: Use bfd_get_current_time more widely
Nick Clifton
nickc@redhat.com
Mon Oct 2 12:27:15 GMT 2023
More information about the Binutils mailing list
Mon Oct 2 12:27:15 GMT 2023
- Previous message (by thread): [PATCH] libctf: check for problems with error returns
- Next message (by thread): Updating mailman settings to avoid From rewriting
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi Guys,
I am applying the patch below to simplify some of the code in the
linker and the BFD library. There were a couple of places where we
were testing for and using the SOURCE_DATE_EPOCH environment
variable. Since we now have a BFD library function that does this,
there is no need for separate code.
Cheers
Nick
bfd/ChangeLog
* peXXigen.c (_bfd_XXi_only_swap_filehdr_out): Use
bfd_get_current_time when filing in the timestamp.
ld/ChangeLog
* pe-dll.c (fill_edata): Use bfd_get_current_time when filling in
the timestamp.
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index 2f2968d48e8..641c259d04b 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -839,17 +839,7 @@ _bfd_XXi_only_swap_filehdr_out (bfd * abfd, void * in, void * out)
option was chosen. */
if ((pe_data (abfd)->timestamp) == -1)
{
- time_t now;
- char *source_date_epoch;
-
- /* If the SOURCE_DATE_EPOCH environment variable is
- defined then use that as the time, otherwise use
- the current time. */
- source_date_epoch = getenv ("SOURCE_DATE_EPOCH");
- if (source_date_epoch)
- now = (time_t) strtoll (source_date_epoch, NULL, 10);
- else
- now = time (NULL);
+ time_t now = bfd_get_current_time (0);
H_PUT_32 (abfd, now, filehdr_out->f_timdat);
}
else
diff --git a/ld/pe-dll.c b/ld/pe-dll.c
index df08a57e644..fc83f5208d6 100644
--- a/ld/pe-dll.c
+++ b/ld/pe-dll.c
@@ -1232,15 +1232,7 @@ fill_edata (bfd *abfd, struct bfd_link_info *info ATTRIBUTE_UNUSED)
if (pe_data (abfd)->timestamp == -1)
{
- time_t now;
- char *source_date_epoch;
-
- source_date_epoch = getenv ("SOURCE_DATE_EPOCH");
- if (source_date_epoch)
- now = (time_t) strtoll (source_date_epoch, NULL, 10);
- else
- now = time (NULL);
-
+ time_t now = bfd_get_current_time (0);
H_PUT_32 (abfd, now, edata_d + 4);
}
else
- Previous message (by thread): [PATCH] libctf: check for problems with error returns
- Next message (by thread): Updating mailman settings to avoid From rewriting
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list