argument. Set DEFAULT_AR_DETERMINISTIC to 1 or 0 accordingly.
* configure: Regenerated.
* config.in: Regenerated.
* ar.c (deterministic): Initialize to -1.
(decode_options, ranlib_main): Grok U option.
(usage, ranlib_usage): Mention U; say for D and U which is the default.
(default_deterministic): New function.
(ranlib_main): Call it.
(main): Likewise. Make newer_only && deterministic error
non-fatal if it was just DEFAULT_AR_DETERMINISTIC and not the D option.
* doc/binutils.texi (ar cmdline, ranlib): Document U modifier and
--enable-deterministic-archives behavior.
+2011-12-20 Roland McGrath <mcgrathr@google.com>
+
+ * configure.in (--enable-deterministic-archives): Grok new
+ argument. Set DEFAULT_AR_DETERMINISTIC to 1 or 0 accordingly.
+ * configure: Regenerated.
+ * config.in: Regenerated.
+ * ar.c (deterministic): Initialize to -1.
+ (decode_options, ranlib_main): Grok U option.
+ (usage, ranlib_usage): Mention U; say for D and U which is the default.
+ (default_deterministic): New function.
+ (ranlib_main): Call it.
+ (main): Likewise. Make newer_only && deterministic error
+ non-fatal if it was just DEFAULT_AR_DETERMINISTIC and not the D option.
+ * doc/binutils.texi (ar cmdline, ranlib): Document U modifier and
+ --enable-deterministic-archives behavior.
+
2011-12-16 Tristan Gingold <gingold@adacore.com>
* od-macho.c: Include mach-o/codesign.h
/* 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;
+int deterministic = -1; /* Determinism indeterminate. */
/* Nonzero means it's the name of an existing member; position new or moved
files with respect to this one. */
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"));
+ if (DEFAULT_AR_DETERMINISTIC)
+ {
+ fprintf (s, _("\
+ [D] - use zero for timestamps and uids/gids (default)\n"));
+ fprintf (s, _("\
+ [U] - use actual timestamps and uids/gids\n"));
+ }
+ else
+ {
+ fprintf (s, _("\
+ [D] - use zero for timestamps and uids/gids\n"));
+ fprintf (s, _("\
+ [U] - use actual timestamps and uids/gids (default)\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"));
fprintf (s, _("\
--plugin <name> Load the specified plugin\n"));
#endif
+ if (DEFAULT_AR_DETERMINISTIC)
+ fprintf (s, _("\
+ -D Use zero for symbol map timestamp (default)\n\
+ -U Use an actual symbol map timestamp\n"));
+ else
+ fprintf (s, _("\
+ -D Use zero for symbol map timestamp\n\
+ -U Use actual symbol map timestamp (default)\n"));
fprintf (s, _("\
-t Update the archive's symbol map timestamp\n\
- -D Use zero for the symbol map timestamp\n\
-h --help Print this help message\n\
-v --version Print version information\n"));
argv = new_argv;
}
- while ((c = getopt_long (argc, argv, "hdmpqrtxlcoVsSuvabiMNfPTD",
+ while ((c = getopt_long (argc, argv, "hdmpqrtxlcoVsSuvabiMNfPTDU",
long_options, NULL)) != EOF)
{
switch (c)
case 'D':
deterministic = TRUE;
break;
+ case 'U':
+ deterministic = FALSE;
+ break;
case OPTION_PLUGIN:
#if BFD_SUPPORTS_PLUGINS
plugin_target = "plugin";
return &argv[optind];
}
+/* If neither -D nor -U was not specified explicitly,
+ then use the configured default. */
+static void
+default_deterministic (void)
+{
+ if (deterministic < 0)
+ deterministic = DEFAULT_AR_DETERMINISTIC;
+}
+
static void
ranlib_main (int argc, char **argv)
{
bfd_boolean touch = FALSE;
int c;
- while ((c = getopt_long (argc, argv, "DhHvVt", long_options, NULL)) != EOF)
+ while ((c = getopt_long (argc, argv, "DhHUvVt", long_options, NULL)) != EOF)
{
switch (c)
{
case 'D':
deterministic = TRUE;
break;
+ case 'U':
+ deterministic = FALSE;
+ break;
case 'h':
case 'H':
show_help = 1;
if (show_version)
print_version ("ranlib");
+ default_deterministic ();
+
arg_index = optind;
while (arg_index < argc)
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 (newer_only && deterministic > 0)
+ fatal (_("`u' is not meaningful with the `D' option."));
+
+ if (newer_only && deterministic < 0 && DEFAULT_AR_DETERMINISTIC)
+ non_fatal (_("\
+`u' modifier ignored since `D' is the default (see `U')"));
+
+ default_deterministic ();
if (postype != pos_default)
posname = argv[arg_index++];
/* Define to 1 if using `alloca.c'. */
#undef C_ALLOCA
+/* Should ar and ranlib use -D behavior by default? */
+#undef DEFAULT_AR_DETERMINISTIC
+
/* Define to 1 if translation of program messages to the user's native
language is requested. */
#undef ENABLE_NLS
with_gnu_ld
enable_libtool_lock
enable_targets
+enable_deterministic_archives
enable_werror
enable_build_warnings
enable_nls
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
--enable-targets alternative target configurations
+ --enable-deterministic-archives
+ ar and ranlib default to -D behavior
--enable-werror treat compile warnings as errors
--enable-build-warnings enable build-time compiler warnings
--disable-nls do not use Native Language Support
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11202 "configure"
+#line 11205 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11308 "configure"
+#line 11311 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
esac
fi
+# Check whether --enable-deterministic-archives was given.
+if test "${enable_deterministic_archives+set}" = set; then :
+ enableval=$enable_deterministic_archives;
+if test "${enableval}" = no; then
+ default_ar_deterministic=0
+else
+ default_ar_deterministic=1
+fi
+else
+ default_ar_deterministic=0
+fi
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_AR_DETERMINISTIC $default_ar_deterministic
+_ACEOF
+
+
GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
*) enable_targets=$enableval ;;
esac])dnl
+AC_ARG_ENABLE(deterministic-archives,
+[AS_HELP_STRING([--enable-deterministic-archives],
+ [ar and ranlib default to -D behavior])], [
+if test "${enableval}" = no; then
+ default_ar_deterministic=0
+else
+ default_ar_deterministic=1
+fi], [default_ar_deterministic=0])
+
+AC_DEFINE_UNQUOTED(DEFAULT_AR_DETERMINISTIC, $default_ar_deterministic,
+ [Should ar and ranlib use -D behavior by default?])
+
AM_BINUTILS_WARNINGS
-
+
AC_CONFIG_HEADERS(config.h:config.in)
if test -z "$target" ; then
else
case $targ in
changequote(,)dnl
- i[3-7]86*-*-netware*)
+ i[3-7]86*-*-netware*)
changequote([,])dnl
BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
[Define to 1 if user symbol names have a leading underscore, 0 if not.])
-# Emulation
+# Emulation
targ=$target
. ${srcdir}/configure.tgt
EMULATION=$targ_emul
-EMULATION_VECTOR=$targ_emul_vector
+EMULATION_VECTOR=$targ_emul_vector
AC_SUBST(EMULATION)
AC_SUBST(EMULATION_VECTOR)
@item D
@cindex deterministic archives
+@kindex --enable-deterministic-archives
Operate in @emph{deterministic} mode. When adding files and the archive
index use zero for UIDs, GIDs, timestamps, and use consistent file modes
for all files. When this option is used, if @command{ar} is used with
identical output files regardless of the input files' owners, groups,
file modes, or modification times.
+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} modifier, below.
+
@item f
Truncate names in the archive. @sc{gnu} @command{ar} will normally permit file
names of any length. This will cause it to create archives which are
not allowed, since checking the timestamps would lose any speed
advantage from the operation @samp{q}.
+@item U
+@cindex deterministic archives
+@kindex --enable-deterministic-archives
+Do @emph{not} operate in @emph{deterministic} mode. This is the inverse
+of the @samp{D} modifier, above: added files and the archive index will
+get their actual UID, GID, timestamp, and file mode values.
+
+This is the default unless @file{binutils} was configured with
+@option{--enable-deterministic-archives}.
+
@item v
This modifier requests the @emph{verbose} version of an operation. Many
operations display additional information, such as filenames processed,
@item -D
@cindex deterministic archives
+@kindex --enable-deterministic-archives
Operate in @emph{deterministic} mode. The symbol map archive member's
header will show zero for the UID, GID, and timestamp. When this
option is used, multiple runs will produce identical output files.
+This is the default unless @file{binutils} was configured with
+@option{--enable-deterministic-archives}.
+
@item -t
Update the timestamp of the symbol map of an archive.
+
+@item -U
+@cindex deterministic archives
+@kindex --enable-deterministic-archives
+Do @emph{not} operate in @emph{deterministic} mode. This is the
+inverse of the @samp{-D} option, above: the archive index will get
+actual UID, GID, timestamp, and file mode values.
+
+This is the default unless @file{binutils} was configured with
+@option{--enable-deterministic-archives}.
@end table
@c man end