--- cc1111-2.9.0.orig/as/asranlib/asranlib.c
+++ cc1111-2.9.0/as/asranlib/asranlib.c
@@ -22,6 +22,8 @@ along with this program.  If not, see <h
 #include <assert.h>
 #include <time.h>
 #include <sys/stat.h>
+#include <errno.h>
+#include <limits.h>
 #include "dbuf_string.h"
 #include "lkar.h"
 
@@ -593,6 +595,47 @@ do_ranlib (const char *archive)
       char tmpfile[] = "arXXXXXX";
       struct stat stat_buf;
       int can_stat;
+      time_t now;
+      char *endptr;
+      char *source_date_epoch;
+      unsigned long long epoch;
+
+      source_date_epoch = getenv ("SOURCE_DATE_EPOCH");
+
+      if (source_date_epoch)
+        {
+          errno = 0;
+          epoch = strtoull (source_date_epoch, &endptr, 10);
+
+          if ((errno == ERANGE && (epoch == ULLONG_MAX || epoch == 0))
+                        || (errno != 0 && epoch == 0))
+            {
+              fprintf (stderr, "Environment variable $SOURCE_DATE_EPOCH: strtoull: %s\n", strerror(errno));
+              exit (1);
+            }
+
+          if (endptr == source_date_epoch)
+            {
+              fprintf (stderr, "Environment variable $SOURCE_DATE_EPOCH: No digits were found: %s\n", endptr);
+              exit (1);
+            }
+
+          if (*endptr != '\0')
+            {
+              fprintf (stderr, "Environment variable $SOURCE_DATE_EPOCH: Trailing garbage: %s\n", endptr);
+              exit (1);
+            }
+
+          if (epoch > ULONG_MAX)
+            {
+              fprintf (stderr, "Environment variable $SOURCE_DATE_EPOCH: value must be smaller than or equal to: %lu but was found to be: %llu \n", ULONG_MAX, epoch);
+              exit (1);
+            }
+
+          now = epoch;
+        }
+      else
+        now = time (NULL);
 
 #ifdef _WIN32
       if (NULL == _mktemp (tmpfile) || NULL == (outfp = fopen (tmpfile, "wb")))
@@ -628,7 +671,7 @@ do_ranlib (const char *archive)
 
       symtab_size = 4 + 4 * nsym + str_length;
 
-      fprintf (outfp, ARMAG AR_SYMBOL_TABLE_NAME "%-12d%-6d%-6d%-8d%-10d" ARFMAG, (int) time (NULL), 0, 0, 0, symtab_size);
+      fprintf (outfp, ARMAG AR_SYMBOL_TABLE_NAME "%-12d%-6d%-6d%-8d%-10d" ARFMAG, (int) now, 0, 0, 0, symtab_size);
 
       if (symtab_size & 1)
         {
