* doc/binutils.texi: Add -D/--enable-deterministic-archives option
authorCary Coutant <ccoutant@google.com>
Wed, 25 Apr 2012 17:50:14 +0000 (17:50 +0000)
committerCary Coutant <ccoutant@google.com>
Wed, 25 Apr 2012 17:50:14 +0000 (17:50 +0000)
to strip and objcopy.
* objcopy.c (deterministic): New global variable.
(strip_options): Add --enable-deterministic-archives.
(copy_options): Likewise.
(copy_usage): Likewise.
(strip_usage): Likewise.
(copy_archive): When stripping all, don't add archive map; set
deterministic output when requested.
(strip_main): Add -D/--enable-deterministic-archives option.
(copy_main): Likewise.

binutils/ChangeLog
binutils/doc/binutils.texi
binutils/objcopy.c

index 7b6c2191f746d23ef10016b717ec26b37ef7991c..01104a1e1cf1d189a59e6220cb3642cd4940f555 100644 (file)
@@ -1,3 +1,17 @@
+2012-04-25  Cary Coutant  <ccoutant@google.com>
+
+       * doc/binutils.texi: Add -D/--enable-deterministic-archives option
+       to strip and objcopy.
+       * objcopy.c (deterministic): New global variable.
+       (strip_options): Add --enable-deterministic-archives.
+       (copy_options): Likewise.
+       (copy_usage): Likewise.
+       (strip_usage): Likewise.
+       (copy_archive): When stripping all, don't add archive map; set
+       deterministic output when requested.
+       (strip_main): Add -D/--enable-deterministic-archives option.
+       (copy_main): Likewise.
+
 2012-04-12  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR binutils/13947
index 4aeadcf7d886c309a95428bb1967daa4f0b3ca87..b90d4f6222f5b22f4c5104fc764504292a354619 100644 (file)
@@ -1059,6 +1059,7 @@ objcopy [@option{-F} @var{bfdname}|@option{--target=}@var{bfdname}]
         [@option{-j} @var{sectionname}|@option{--only-section=}@var{sectionname}]
         [@option{-R} @var{sectionname}|@option{--remove-section=}@var{sectionname}]
         [@option{-p}|@option{--preserve-dates}]
+        [@option{-D}|@option{--enable-deterministic-archives}]
         [@option{--debugging}]
         [@option{--gap-fill=}@var{val}]
         [@option{--pad-to=}@var{address}]
@@ -1323,6 +1324,12 @@ commands.  If the input was '12345678' then the outputs would be
 Set the access and modification dates of the output file to be the same
 as those of the input file.
 
+@item -D
+@itemx --enable-deterministic-archives
+Operate in @emph{deterministic} mode.  When copying archive members
+and writing the archive index, use zero for UIDs, GIDs, timestamps,
+and use consistent file modes for all files.
+
 @item --debugging
 Convert debugging information, if possible.  This is not the default
 because only certain debugging formats are supported, and the
@@ -2679,6 +2686,7 @@ strip [@option{-F} @var{bfdname} |@option{--target=}@var{bfdname}]
       [@option{-x}|@option{--discard-all}] [@option{-X} |@option{--discard-locals}]
       [@option{-R} @var{sectionname} |@option{--remove-section=}@var{sectionname}]
       [@option{-o} @var{file}] [@option{-p}|@option{--preserve-dates}]
+      [@option{-D}|@option{--enable-deterministic-archives}]
       [@option{--keep-file-symbols}]
       [@option{--only-keep-debug}]
       [@option{-v} |@option{--verbose}] [@option{-V}|@option{--version}]
@@ -2763,6 +2771,12 @@ argument may be specified.
 @itemx --preserve-dates
 Preserve the access and modification dates of the file.
 
+@item -D
+@itemx --enable-deterministic-archives
+Operate in @emph{deterministic} mode.  When copying archive members
+and writing the archive index, use zero for UIDs, GIDs, timestamps,
+and use consistent file modes for all files.
+
 @item -w
 @itemx --wildcard
 Permit regular expressions in @var{symbolname}s used in other command
index a48ac4338d5368589da344a98140b658a58f3e77..bd93d000057e728209f4aa9321a785a5025bdde6 100644 (file)
@@ -86,6 +86,7 @@ static int copy_width = 1;
 
 static bfd_boolean verbose;            /* Print file and target names.  */
 static bfd_boolean preserve_dates;     /* Preserve input file timestamp.  */
+static bfd_boolean deterministic;      /* Enable deterministic archives.  */
 static int status = 0;         /* Exit status.  */
 
 enum strip_action
@@ -322,6 +323,7 @@ static struct option strip_options[] =
 {
   {"discard-all", no_argument, 0, 'x'},
   {"discard-locals", no_argument, 0, 'X'},
+  {"enable-deterministic-archives", no_argument, 0, 'D'},
   {"format", required_argument, 0, 'F'}, /* Obsolete */
   {"help", no_argument, 0, 'h'},
   {"info", no_argument, 0, OPTION_FORMATS_INFO},
@@ -371,6 +373,7 @@ static struct option copy_options[] =
   {"decompress-debug-sections", no_argument, 0, OPTION_DECOMPRESS_DEBUG_SECTIONS},
   {"discard-all", no_argument, 0, 'x'},
   {"discard-locals", no_argument, 0, 'X'},
+  {"enable-deterministic-archives", no_argument, 0, 'D'},
   {"extract-symbol", no_argument, 0, OPTION_EXTRACT_SYMBOL},
   {"format", required_argument, 0, 'F'}, /* Obsolete */
   {"gap-fill", required_argument, 0, OPTION_GAP_FILL},
@@ -480,6 +483,8 @@ copy_usage (FILE *stream, int exit_status)
   -F --target <bfdname>            Set both input and output format to <bfdname>\n\
      --debugging                   Convert debugging information, if possible\n\
   -p --preserve-dates              Copy modified/access timestamps to the output\n\
+  -D --enable-deterministic-archives\n\
+                                   Produce deterministic output when stripping archives\n\
   -j --only-section <name>         Only copy section <name> into the output\n\
      --add-gnu-debuglink=<file>    Add section .gnu_debuglink linking to <file>\n\
   -R --remove-section <name>       Remove section <name> from the output\n\
@@ -588,6 +593,8 @@ strip_usage (FILE *stream, int exit_status)
   -O --output-target=<bfdname>     Create an output file in format <bfdname>\n\
   -F --target=<bfdname>            Set both input and output format to <bfdname>\n\
   -p --preserve-dates              Copy modified/access timestamps to the output\n\
+  -D --enable-deterministic-archives\n\
+                                   Produce deterministic output when stripping archives\n\
   -R --remove-section=<name>       Remove section <name> from the output\n\
   -s --strip-all                   Remove all symbol and relocation information\n\
   -g -S -d --strip-debug           Remove all debugging symbols & sections\n\
@@ -2030,9 +2037,15 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
       fatal (_("cannot create tempdir for archive copying (error: %s)"),
           strerror (errno));
 
-  obfd->has_armap = ibfd->has_armap;
+  if (strip_symbols == STRIP_ALL)
+    obfd->has_armap = FALSE;
+  else
+    obfd->has_armap = ibfd->has_armap;
   obfd->is_thin_archive = ibfd->is_thin_archive;
 
+  if (deterministic)
+    obfd->flags |= BFD_DETERMINISTIC_OUTPUT;
+
   list = NULL;
 
   this_element = bfd_openr_next_archived_file (ibfd, NULL);
@@ -3024,6 +3037,9 @@ strip_main (int argc, char *argv[])
        case 'p':
          preserve_dates = TRUE;
          break;
+       case 'D':
+         deterministic = TRUE;
+         break;
        case 'x':
          discard_locals = LOCALS_ALL;
          break;
@@ -3384,6 +3400,10 @@ copy_main (int argc, char *argv[])
          preserve_dates = TRUE;
          break;
 
+       case 'D':
+         deterministic = TRUE;
+         break;
+
        case 'w':
          wildcard = TRUE;
          break;
This page took 0.035393 seconds and 4 git commands to generate.