binutils/
authorRoland McGrath <roland@gnu.org>
Mon, 7 Jan 2013 17:40:59 +0000 (17:40 +0000)
committerRoland McGrath <roland@gnu.org>
Mon, 7 Jan 2013 17:40:59 +0000 (17:40 +0000)
* objcopy.c (deterministic): Make int rather than bfd_boolean,
initialize to -1.
(strip_options, copy_options): Add -U/--disable-deterministic-archives.
(default_deterministic): New function.
(strip_main, copy_main): Handle -U.  Call default_deterministic.
(copy_usage, strip_usage): Describe -U.  Cite whether -D or -U is
the default based on DEFAULT_AR_DETERMINISTIC.
* doc/binutils.texi (objcopy, strip): Describe -U and effect of
configure options on -D.

* ar.c (default_deterministic): Comment fix.

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

index 2f53ec2..4c279bf 100644 (file)
@@ -1,3 +1,17 @@
+2013-01-07  Roland McGrath  <mcgrathr@google.com>
+
+       * objcopy.c (deterministic): Make int rather than bfd_boolean,
+       initialize to -1.
+       (strip_options, copy_options): Add -U/--disable-deterministic-archives.
+       (default_deterministic): New function.
+       (strip_main, copy_main): Handle -U.  Call default_deterministic.
+       (copy_usage, strip_usage): Describe -U.  Cite whether -D or -U is
+       the default based on DEFAULT_AR_DETERMINISTIC.
+       * doc/binutils.texi (objcopy, strip): Describe -U and effect of
+       configure options on -D.
+
+       * ar.c (default_deterministic): Comment fix.
+
 2013-01-07  Patrice Dumas  <pertusus@free.fr>
 
        * doc/binutils.texi: Fix ordering of top level nodes.
index aceb9d1..0aa1ba3 100644 (file)
@@ -1,6 +1,6 @@
 /* ar.c - Archive modify and extract.
    Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
    Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
@@ -575,7 +575,7 @@ decode_options (int argc, char **argv)
   return &argv[optind];
 }
 
-/* If neither -D nor -U was not specified explicitly,
+/* If neither -D nor -U was specified explicitly,
    then use the configured default.  */
 static void
 default_deterministic (void)
index fb1802b..fbe1f06 100644 (file)
@@ -1069,6 +1069,7 @@ objcopy [@option{-F} @var{bfdname}|@option{--target=}@var{bfdname}]
         [@option{-R} @var{sectionname}|@option{--remove-section=}@var{sectionname}]
         [@option{-p}|@option{--preserve-dates}]
         [@option{-D}|@option{--enable-deterministic-archives}]
+        [@option{-U}|@option{--disable-deterministic-archives}]
         [@option{--debugging}]
         [@option{--gap-fill=}@var{val}]
         [@option{--pad-to=}@var{address}]
@@ -1337,10 +1338,28 @@ as those of the input file.
 
 @item -D
 @itemx --enable-deterministic-archives
+@cindex deterministic archives
+@kindex --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.
 
+If @file{binutils} was configured with
+@option{--enable-deterministic-archives}, then this mode is on by default.
+It can be disabled with the @samp{-U} option, below.
+
+@item -U
+@itemx --disable-deterministic-archives
+@cindex deterministic archives
+@kindex --enable-deterministic-archives
+Do @emph{not} operate in @emph{deterministic} mode.  This is the
+inverse of the @option{-D} option, above: when copying archive members
+and writing the archive index, use their actual UID, GID, timestamp,
+and file mode values.
+
+This is the default unless @file{binutils} was configured with
+@option{--enable-deterministic-archives}.
+
 @item --debugging
 Convert debugging information, if possible.  This is not the default
 because only certain debugging formats are supported, and the
@@ -2718,6 +2737,7 @@ strip [@option{-F} @var{bfdname} |@option{--target=}@var{bfdname}]
       [@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{-U}|@option{--disable-deterministic-archives}]
       [@option{--keep-file-symbols}]
       [@option{--only-keep-debug}]
       [@option{-v} |@option{--verbose}] [@option{-V}|@option{--version}]
@@ -2810,10 +2830,28 @@ Preserve the access and modification dates of the file.
 
 @item -D
 @itemx --enable-deterministic-archives
+@cindex deterministic archives
+@kindex --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.
 
+If @file{binutils} was configured with
+@option{--enable-deterministic-archives}, then this mode is on by default.
+It can be disabled with the @samp{-U} option, below.
+
+@item -U
+@itemx --disable-deterministic-archives
+@cindex deterministic archives
+@kindex --enable-deterministic-archives
+Do @emph{not} operate in @emph{deterministic} mode.  This is the
+inverse of the @option{-D} option, above: when copying archive members
+and writing the archive index, use their actual UID, GID, timestamp,
+and file mode values.
+
+This is the default unless @file{binutils} was configured with
+@option{--enable-deterministic-archives}.
+
 @item -w
 @itemx --wildcard
 Permit regular expressions in @var{symbolname}s used in other command
index 4860864..ead8ff4 100644 (file)
@@ -1,6 +1,6 @@
 /* objcopy.c -- copy object file from input to output, optionally massaging it.
    Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
    Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
@@ -86,7 +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 deterministic = -1;         /* Enable deterministic archives.  */
 static int status = 0;         /* Exit status.  */
 
 enum strip_action
@@ -325,6 +325,7 @@ enum command_line_switch
 
 static struct option strip_options[] =
 {
+  {"disable-deterministic-archives", no_argument, 0, 'U'},
   {"discard-all", no_argument, 0, 'x'},
   {"discard-locals", no_argument, 0, 'X'},
   {"enable-deterministic-archives", no_argument, 0, 'D'},
@@ -376,6 +377,7 @@ static struct option copy_options[] =
   {"compress-debug-sections", no_argument, 0, OPTION_COMPRESS_DEBUG_SECTIONS},
   {"debugging", no_argument, 0, OPTION_DEBUGGING},
   {"decompress-debug-sections", no_argument, 0, OPTION_DECOMPRESS_DEBUG_SECTIONS},
+  {"disable-deterministic-archives", no_argument, 0, 'U'},
   {"discard-all", no_argument, 0, 'x'},
   {"discard-locals", no_argument, 0, 'X'},
   {"enable-deterministic-archives", no_argument, 0, 'D'},
@@ -489,9 +491,20 @@ copy_usage (FILE *stream, int exit_status)
   -B --binary-architecture <arch>  Set output arch, when input is arch-less\n\
   -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\
+  -p --preserve-dates              Copy modified/access timestamps to the output\n"));
+  if (DEFAULT_AR_DETERMINISTIC)
+    fprintf (stream, _("\
+  -D --enable-deterministic-archives\n\
+                                   Produce deterministic output when stripping archives (default)\n\
+  -U --disable-deterministic-archives\n\
+                                   Disable -D behavior\n"));
+  else
+    fprintf (stream, _("\
   -D --enable-deterministic-archives\n\
                                    Produce deterministic output when stripping archives\n\
+  -U --disable-deterministic-archives\n\
+                                   Disable -D behavior (default)\n"));
+  fprintf (stream, _("\
   -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\
@@ -602,8 +615,20 @@ 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\
+"));
+  if (DEFAULT_AR_DETERMINISTIC)
+    fprintf (stream, _("\
+  -D --enable-deterministic-archives\n\
+                                   Produce deterministic output when stripping archives (default)\n\
+  -U --disable-deterministic-archives\n\
+                                   Disable -D behavior\n"));
+  else
+    fprintf (stream, _("\
   -D --enable-deterministic-archives\n\
                                    Produce deterministic output when stripping archives\n\
+  -U --disable-deterministic-archives\n\
+                                   Disable -D behavior (default)\n"));
+  fprintf (stream, _("\
   -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\
@@ -3025,6 +3050,15 @@ write_debugging_info (bfd *obfd, void *dhandle,
   return FALSE;
 }
 
+/* If neither -D nor -U was specified explicitly,
+   then use the configured default.  */
+static void
+default_deterministic (void)
+{
+  if (deterministic < 0)
+    deterministic = DEFAULT_AR_DETERMINISTIC;
+}
+
 static int
 strip_main (int argc, char *argv[])
 {
@@ -3085,6 +3119,9 @@ strip_main (int argc, char *argv[])
        case 'D':
          deterministic = TRUE;
          break;
+       case 'U':
+         deterministic = FALSE;
+         break;
        case 'x':
          discard_locals = LOCALS_ALL;
          break;
@@ -3129,6 +3166,8 @@ strip_main (int argc, char *argv[])
   if (show_version)
     print_version ("strip");
 
+  default_deterministic ();
+
   /* Default is to strip all symbols.  */
   if (strip_symbols == STRIP_UNDEF
       && discard_locals == LOCALS_UNDEF
@@ -3211,7 +3250,7 @@ set_pe_subsystem (const char *s)
     }
   v[] =
     {
-      { "native", 0, IMAGE_SUBSYSTEM_NATIVE },  
+      { "native", 0, IMAGE_SUBSYSTEM_NATIVE },
       { "windows", 0, IMAGE_SUBSYSTEM_WINDOWS_GUI },
       { "console", 0, IMAGE_SUBSYSTEM_WINDOWS_CUI },
       { "posix", 0, IMAGE_SUBSYSTEM_POSIX_CUI },
@@ -3453,6 +3492,10 @@ copy_main (int argc, char *argv[])
          deterministic = TRUE;
          break;
 
+       case 'U':
+         deterministic = FALSE;
+         break;
+
        case 'w':
          wildcard = TRUE;
          break;
@@ -3887,7 +3930,7 @@ copy_main (int argc, char *argv[])
        case OPTION_FILE_ALIGNMENT:
          pe_file_alignment = parse_vma (optarg, "--file-alignment");
          break;
-       
+
        case OPTION_HEAP:
            {
              char *end;
@@ -3905,20 +3948,20 @@ copy_main (int argc, char *argv[])
                }
            }
          break;
-       
+
        case OPTION_IMAGE_BASE:
          pe_image_base = parse_vma (optarg, "--image-base");
          break;
-       
+
        case OPTION_SECTION_ALIGNMENT:
          pe_section_alignment = parse_vma (optarg,
                                            "--section-alignment");
          break;
-       
+
        case OPTION_SUBSYSTEM:
          set_pe_subsystem (optarg);
          break;
-       
+
        case OPTION_STACK:
            {
              char *end;
@@ -3936,7 +3979,7 @@ copy_main (int argc, char *argv[])
                }
            }
          break;
-       
+
        case 0:
          /* We've been given a long option.  */
          break;
@@ -3975,6 +4018,8 @@ copy_main (int argc, char *argv[])
   if (optind + 1 < argc)
     output_filename = argv[optind + 1];
 
+  default_deterministic ();
+
   /* Default is to strip no symbols.  */
   if (strip_symbols == STRIP_UNDEF && discard_locals == LOCALS_UNDEF)
     strip_symbols = STRIP_NONE;