From a0346b11fd7259e092fd519224f4be7d45c46cd4 Mon Sep 17 00:00:00 2001 From: Chris Demetriou Date: Wed, 11 Mar 2009 04:36:40 +0000 Subject: [bfd/ChangeLog] 2009-03-11 Chris Demetriou * bfd.c (BFD_DETERMINISTIC_OUTPUT): New flag. * bfd-in2.h: Regenerate. * archive.c (bfd_ar_hdr_from_filesystem): If BFD_DETERMINISTIC_OUTPUT flag is set, use 0 for uid, gid, and timestamp, and use 0644 for file mode. (bsd_write_armap): Likewise. (_bfd_archive_bsd_update_armap_timestamp): If BFD_DETERMINISTIC_OUTPUT flag is set, do nothing. (coff_write_armap): If BFD_DETERMINISTIC_OUTPUT flag is set, use 0 for timestamp. [binutils/ChangeLog] 2009-03-11 Chris Demetriou * ar.c (deterministic): New global variable. (main): Recognize new 'D' option, which enables 'deterministic mode'. (usage): Document new 'D' option. (write_archive): Set BFD_DETERMINISTIC_OUTPUT in output archive's flags if deterministic mode was requested. * doc/binutils.texi (ar): Document deterministic mode ('D' option). [binutils/testsuite/ChangeLog] 2009-03-11 Chris Demetriou * binutils-all/ar.exp (deterministic_archive): New test. --- binutils/ar.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'binutils/ar.c') diff --git a/binutils/ar.c b/binutils/ar.c index f4932219b7..73ab1d46f0 100644 --- a/binutils/ar.c +++ b/binutils/ar.c @@ -99,6 +99,11 @@ int newer_only = 0; if any of the members are object files. */ int write_armap = 0; +/* Operate in deterministic mode: write zero for timestamps, uids, + and gids for archive members and the archive symbol table, and write + consistent file modes. */ +int deterministic = 0; + /* Nonzero means it's the name of an existing member; position new or moved files with respect to this one. */ char *posname = NULL; @@ -240,6 +245,7 @@ usage (int help) fprintf (s, _(" command specific modifiers:\n")); fprintf (s, _(" [a] - put file(s) after [member-name]\n")); fprintf (s, _(" [b] - put file(s) before [member-name] (same as [i])\n")); + fprintf (s, _(" [D] - use zero for timestamps and uids/gids\n")); fprintf (s, _(" [N] - use instance [count] of name\n")); fprintf (s, _(" [f] - truncate inserted file names\n")); fprintf (s, _(" [P] - use full path names when matching\n")); @@ -572,6 +578,9 @@ main (int argc, char **argv) case 'T': make_thin_archive = TRUE; break; + case 'D': + deterministic = TRUE; + break; default: /* xgettext:c-format */ non_fatal (_("illegal option -- %c"), c); @@ -622,6 +631,9 @@ main (int argc, char **argv) if (newer_only && operation != replace) fatal (_("`u' is only meaningful with the `r' option.")); + if (newer_only && deterministic) + fatal (_("`u' is not meaningful with the `D' option.")); + if (postype != pos_default) posname = argv[arg_index++]; @@ -972,6 +984,9 @@ write_archive (bfd *iarch) obfd->flags |= BFD_TRADITIONAL_FORMAT; } + if (deterministic) + obfd->flags |= BFD_DETERMINISTIC_OUTPUT; + if (make_thin_archive || bfd_is_thin_archive (iarch)) bfd_is_thin_archive (obfd) = 1; -- cgit v1.2.1