XCOFF deterministic archives

Message ID 20200707084824.GF28359@bubble.grove.modra.org
State New
Headers show
Series
  • XCOFF deterministic archives
Related show

Commit Message

H.J. Lu via Binutils July 7, 2020, 8:48 a.m.
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.


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index 51fab9f053..00c9d7c7f4 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -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)