XCOFF deterministic archives
authorAlan Modra <amodra@gmail.com>
Tue, 7 Jul 2020 00:22:21 +0000 (09:52 +0930)
committerAlan Modra <amodra@gmail.com>
Tue, 7 Jul 2020 08:56:33 +0000 (18:26 +0930)
Adds support for "ar -D".

* coff-rs6000.c (xcoff_write_archive_contents_old): Set default
time, uid, gid and mode for deterministic archive.
(xcoff_write_archive_contents_big): Likewise.

bfd/ChangeLog
bfd/coff-rs6000.c

index 057bc05aa8097f2ea1077811c6090b381cfe02c3..580edfe41ea943ddc16998dad21a4cc34077226b 100644 (file)
@@ -1,3 +1,9 @@
+2020-07-07  Alan Modra  <amodra@gmail.com>
+
+       * coff-rs6000.c (xcoff_write_archive_contents_old): Set default
+       time, uid, gid and mode for deterministic archive.
+       (xcoff_write_archive_contents_big): Likewise.
+
 2020-07-07  Alan Modra  <amodra@gmail.com>
 
        * coffcode.h (coff_classify_symbol): Handle C_HIDEXT and
index 51fab9f0536309bcc8b952e6e0b5d9eabd4f5d57..00c9d7c7f4b94463aed185fda9dfdb94d6e4aca2 100644 (file)
@@ -2101,6 +2101,13 @@ xcoff_write_archive_contents_old (bfd *abfd)
              bfd_set_error (bfd_error_system_call);
              return FALSE;
            }
+         if ((abfd->flags & BFD_DETERMINISTIC_OUTPUT) != 0)
+           {
+             s.st_mtime = 0;
+             s.st_uid = 0;
+             s.st_gid = 0;
+             s.st_mode = 0644;
+           }
 
          ahdrp = bfd_zalloc (sub, sizeof (*ahdrp));
          if (ahdrp == NULL)
@@ -2321,6 +2328,13 @@ xcoff_write_archive_contents_big (bfd *abfd)
              bfd_set_error (bfd_error_system_call);
              return FALSE;
            }
+         if ((abfd->flags & BFD_DETERMINISTIC_OUTPUT) != 0)
+           {
+             s.st_mtime = 0;
+             s.st_uid = 0;
+             s.st_gid = 0;
+             s.st_mode = 0644;
+           }
 
          ahdrp = bfd_zalloc (current_bfd, sizeof (*ahdrp));
          if (ahdrp == NULL)