public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Using binutils with all target enabled
@ 2010-12-01 19:27 Arnaud Lacombe
  2010-12-01 20:56 ` Andreas Schwab
  2010-12-01 22:06 ` Mike Frysinger
  0 siblings, 2 replies; 15+ messages in thread
From: Arnaud Lacombe @ 2010-12-01 19:27 UTC (permalink / raw)
  To: binutils

Hi,

I'm playing with binutils trunk and it would seems that many tools are
not usable when built with --enable-targets=all.

nm fails with:

all-targets-nm: /linux-2.6/lib/atomic64.o: File format is ambiguous
all-targets-nm: Matching formats: elf32-littlemips
elf32-littlemips-vxworks elf32-tradlittlemips

ar is unable to generate archive index when asked to (tracked down to
an expected failure bfd_check_format_matches() after having read its
associated comment), which leads to ld being unable to use the
archives. ranlib does not work either. I did not get along the other
tool, but I'd expect similar failure.

I'd have hoped that specifying the the format explicits would have
been possible, but very few program seems to support such options.
Actually, only objdump (maybe others) accepts a '-b' flags.

Is this a known limitation of binutils built with --enable-targets=all
? If so, what can be done to fix this ? I'm particularly thinking of a
standard, binutils-wide, flag to pass the expected format.

Thanks in advance,
 - Arnaud

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Using binutils with all target enabled
  2010-12-01 19:27 Using binutils with all target enabled Arnaud Lacombe
@ 2010-12-01 20:56 ` Andreas Schwab
  2010-12-01 22:06 ` Mike Frysinger
  1 sibling, 0 replies; 15+ messages in thread
From: Andreas Schwab @ 2010-12-01 20:56 UTC (permalink / raw)
  To: Arnaud Lacombe; +Cc: binutils

Arnaud Lacombe <lacombar@gmail.com> writes:

> I'd have hoped that specifying the the format explicits would have
> been possible, but very few program seems to support such options.
> Actually, only objdump (maybe others) accepts a '-b' flags.

You can always set the GNUTARGET environment variable.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Using binutils with all target enabled
  2010-12-01 19:27 Using binutils with all target enabled Arnaud Lacombe
  2010-12-01 20:56 ` Andreas Schwab
@ 2010-12-01 22:06 ` Mike Frysinger
  2010-12-01 23:16   ` Arnaud Lacombe
  2010-12-02  0:10   ` Joseph S. Myers
  1 sibling, 2 replies; 15+ messages in thread
From: Mike Frysinger @ 2010-12-01 22:06 UTC (permalink / raw)
  To: binutils; +Cc: Arnaud Lacombe

[-- Attachment #1: Type: Text/Plain, Size: 498 bytes --]

On Wednesday, December 01, 2010 14:27:10 Arnaud Lacombe wrote:
> I'd have hoped that specifying the the format explicits would have
> been possible, but very few program seems to support such options.
> Actually, only objdump (maybe others) accepts a '-b' flags.

ld has -m, objcopy/strip have -F/-O/-I, readelf doesnt care, addr2line/nm/size 
have --target.  seems like just as, ar, and ranlib are missing command line 
flags, and --target might be the logical flag to add to them.
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Using binutils with all target enabled
  2010-12-01 22:06 ` Mike Frysinger
@ 2010-12-01 23:16   ` Arnaud Lacombe
  2010-12-04  3:37     ` [PATCH 2/3] binutils/ar: use getopt_long() for options parsing Arnaud Lacombe
                       ` (3 more replies)
  2010-12-02  0:10   ` Joseph S. Myers
  1 sibling, 4 replies; 15+ messages in thread
From: Arnaud Lacombe @ 2010-12-01 23:16 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: binutils

Hi,

On Wed, Dec 1, 2010 at 5:01 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Wednesday, December 01, 2010 14:27:10 Arnaud Lacombe wrote:
>> I'd have hoped that specifying the the format explicits would have
>> been possible, but very few program seems to support such options.
>> Actually, only objdump (maybe others) accepts a '-b' flags.
>
> ld has -m, objcopy/strip have -F/-O/-I, readelf doesnt care, addr2line/nm/size
> have --target.  seems like just as, ar, and ranlib are missing command line
> flags, and --target might be the logical flag to add to them.
thanks... that would have been trivial to add if ar/ranlib's options
parsing did not look so fragile :(

I suspect the following:

  if (argc == 2 && strcmp (argv[1], "-M") == 0)
    {
      mri_emul ();
      xexit (0);
    }

is already broken when --plugin <plugin> is used.

Is there any interest to see "--target" taught to ar/ranlib in
mainstream's binutils (in which can I can spend some time to write a
patch) or is it not worth it (in which case I'll just do a nasty local
hack) ?

Thanks,
 - Arnaud

ps: actually, GNUTARGET did the job, but I'm afraid in a cross
environment where both native and cross-toolchain are used, that might
have non-wanted side effect.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Using binutils with all target enabled
  2010-12-01 22:06 ` Mike Frysinger
  2010-12-01 23:16   ` Arnaud Lacombe
@ 2010-12-02  0:10   ` Joseph S. Myers
  2010-12-02  0:17     ` Arnaud Lacombe
  1 sibling, 1 reply; 15+ messages in thread
From: Joseph S. Myers @ 2010-12-02  0:10 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: binutils, Arnaud Lacombe

On Wed, 1 Dec 2010, Mike Frysinger wrote:

> On Wednesday, December 01, 2010 14:27:10 Arnaud Lacombe wrote:
> > I'd have hoped that specifying the the format explicits would have
> > been possible, but very few program seems to support such options.
> > Actually, only objdump (maybe others) accepts a '-b' flags.
> 
> ld has -m, objcopy/strip have -F/-O/-I, readelf doesnt care, addr2line/nm/size 
> have --target.  seems like just as, ar, and ranlib are missing command line 
> flags, and --target might be the logical flag to add to them.

I don't think as has any useful multi-target support; the code is full of 
uses of macros defined in target-specific headers.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Using binutils with all target enabled
  2010-12-02  0:10   ` Joseph S. Myers
@ 2010-12-02  0:17     ` Arnaud Lacombe
  0 siblings, 0 replies; 15+ messages in thread
From: Arnaud Lacombe @ 2010-12-02  0:17 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: Mike Frysinger, binutils

Hi,

On Wed, Dec 1, 2010 at 7:10 PM, Joseph S. Myers <joseph@codesourcery.com> wrote:
> On Wed, 1 Dec 2010, Mike Frysinger wrote:
>
>> On Wednesday, December 01, 2010 14:27:10 Arnaud Lacombe wrote:
>> > I'd have hoped that specifying the the format explicits would have
>> > been possible, but very few program seems to support such options.
>> > Actually, only objdump (maybe others) accepts a '-b' flags.
>>
>> ld has -m, objcopy/strip have -F/-O/-I, readelf doesnt care, addr2line/nm/size
>> have --target.  seems like just as, ar, and ranlib are missing command line
>> flags, and --target might be the logical flag to add to them.
>
> I don't think as has any useful multi-target support; the code is full of
> uses of macros defined in target-specific headers.
>
I was talking about ar/ranlib here, not `as'. I'm fine with having a
target specific `as'.

 - Arnaud

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/3] binutils/ar: split ar/ranlib path
  2010-12-01 23:16   ` Arnaud Lacombe
  2010-12-04  3:37     ` [PATCH 2/3] binutils/ar: use getopt_long() for options parsing Arnaud Lacombe
@ 2010-12-04  3:37     ` Arnaud Lacombe
  2010-12-04 10:45       ` Mike Frysinger
  2010-12-04  3:38     ` [PATCH 3/3] binutils/ar: learn --target Arnaud Lacombe
  2010-12-04  3:47     ` Using binutils with all target enabled Arnaud Lacombe
  3 siblings, 1 reply; 15+ messages in thread
From: Arnaud Lacombe @ 2010-12-04  3:37 UTC (permalink / raw)
  To: binutils; +Cc: Arnaud Lacombe

2010-12-02  Arnaud Lacombe  <lacombar@gmail.com>

	* ar.c (main): Split ranlib path.
	(ranlib_usage): New
	(ranlib_main): New
---
 binutils/ar.c |  197 ++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 111 insertions(+), 86 deletions(-)

diff --git a/binutils/ar.c b/binutils/ar.c
index a08a991..29dcb4a 100644
--- a/binutils/ar.c
+++ b/binutils/ar.c
@@ -225,67 +225,78 @@ usage (int help)
 
   s = help ? stdout : stderr;
 
-  if (! is_ranlib)
-    {
-      /* xgettext:c-format */
-      const char * command_line =
+  /* xgettext:c-format */
+  const char * command_line =
 #if BFD_SUPPORTS_PLUGINS
 	_("Usage: %s [emulation options] [--plugin <name>] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...\n");
 #else
 	_("Usage: %s [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...\n");
 #endif
-      fprintf (s, command_line, program_name);
-
-      /* xgettext:c-format */
-      fprintf (s, _("       %s -M [<mri-script]\n"), program_name);
-      fprintf (s, _(" commands:\n"));
-      fprintf (s, _("  d            - delete file(s) from the archive\n"));
-      fprintf (s, _("  m[ab]        - move file(s) in the archive\n"));
-      fprintf (s, _("  p            - print file(s) found in the archive\n"));
-      fprintf (s, _("  q[f]         - quick append file(s) to the archive\n"));
-      fprintf (s, _("  r[ab][f][u]  - replace existing or insert new file(s) into the archive\n"));
-      fprintf (s, _("  s            - act as ranlib\n"));
-      fprintf (s, _("  t            - display contents of archive\n"));
-      fprintf (s, _("  x[o]         - extract file(s) from the archive\n"));
-      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"));
-      fprintf (s, _("  [o]          - preserve original dates\n"));
-      fprintf (s, _("  [u]          - only replace files that are newer than current archive contents\n"));
-      fprintf (s, _(" generic modifiers:\n"));
-      fprintf (s, _("  [c]          - do not warn if the library had to be created\n"));
-      fprintf (s, _("  [s]          - create an archive index (cf. ranlib)\n"));
-      fprintf (s, _("  [S]          - do not build a symbol table\n"));
-      fprintf (s, _("  [T]          - make a thin archive\n"));
-      fprintf (s, _("  [v]          - be verbose\n"));
-      fprintf (s, _("  [V]          - display the version number\n"));
-      fprintf (s, _("  @<file>      - read options from <file>\n"));
+  fprintf (s, command_line, program_name);
+
+  /* xgettext:c-format */
+  fprintf (s, _("       %s -M [<mri-script]\n"), program_name);
+  fprintf (s, _(" commands:\n"));
+  fprintf (s, _("  d            - delete file(s) from the archive\n"));
+  fprintf (s, _("  m[ab]        - move file(s) in the archive\n"));
+  fprintf (s, _("  p            - print file(s) found in the archive\n"));
+  fprintf (s, _("  q[f]         - quick append file(s) to the archive\n"));
+  fprintf (s, _("  r[ab][f][u]  - replace existing or insert new file(s) into the archive\n"));
+  fprintf (s, _("  s            - act as ranlib\n"));
+  fprintf (s, _("  t            - display contents of archive\n"));
+  fprintf (s, _("  x[o]         - extract file(s) from the archive\n"));
+  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"));
+  fprintf (s, _("  [o]          - preserve original dates\n"));
+  fprintf (s, _("  [u]          - only replace files that are newer than current archive contents\n"));
+  fprintf (s, _(" generic modifiers:\n"));
+  fprintf (s, _("  [c]          - do not warn if the library had to be created\n"));
+  fprintf (s, _("  [s]          - create an archive index (cf. ranlib)\n"));
+  fprintf (s, _("  [S]          - do not build a symbol table\n"));
+  fprintf (s, _("  [T]          - make a thin archive\n"));
+  fprintf (s, _("  [v]          - be verbose\n"));
+  fprintf (s, _("  [V]          - display the version number\n"));
+  fprintf (s, _("  @<file>      - read options from <file>\n"));
 #if BFD_SUPPORTS_PLUGINS
-      fprintf (s, _(" optional:\n"));
-      fprintf (s, _("  --plugin <p> - load the specified plugin\n"));
+  fprintf (s, _(" optional:\n"));
+  fprintf (s, _("  --plugin <p> - load the specified plugin\n"));
 #endif
-      ar_emul_usage (s);
-    }
-  else
-    {
-      /* xgettext:c-format */
-      fprintf (s, _("Usage: %s [options] archive\n"), program_name);
-      fprintf (s, _(" Generate an index to speed access to archives\n"));
-      fprintf (s, _(" The options are:\n\
+
+  ar_emul_usage (s);
+
+  list_supported_targets (program_name, s);
+
+  if (REPORT_BUGS_TO[0] && help)
+    fprintf (s, _("Report bugs to %s\n"), REPORT_BUGS_TO);
+
+  xexit (help ? 0 : 1);
+}
+
+static void
+ranlib_usage(int help)
+{
+  FILE *s;
+
+  s = help ? stdout : stderr;
+
+  /* xgettext:c-format */
+  fprintf (s, _("Usage: %s [options] archive\n"), program_name);
+  fprintf (s, _(" Generate an index to speed access to archives\n"));
+  fprintf (s, _(" The options are:\n\
   @<file>                      Read options from <file>\n"));
 #if BFD_SUPPORTS_PLUGINS
-      fprintf (s, _("\
+  fprintf (s, _("\
   --plugin <name>              Load the specified plugin\n"));
 #endif
-      fprintf (s, _("\
+  fprintf (s, _("\
   -t                           Update the archive's symbol map timestamp\n\
   -h --help                    Print this help message\n\
   -v --version                 Print version information\n"));
-    }
 
   list_supported_targets (program_name, s);
 
@@ -343,6 +354,52 @@ remove_output (void)
     }
 }
 
+static void
+ranlib_main(int argc, char **argv)
+{
+  int arg_index, status = 0;
+  bfd_boolean touch = FALSE;
+
+  if (argc > 1 && argv[1][0] == '-')
+    {
+      if (strcmp (argv[1], "--help") == 0)
+	ranlib_usage (1);
+      else if (strcmp (argv[1], "--version") == 0)
+	{
+	  print_version ("ranlib");
+	}
+    }
+
+  if (argc < 2
+      || strcmp (argv[1], "--help") == 0
+      || strcmp (argv[1], "-h") == 0
+      || strcmp (argv[1], "-H") == 0)
+    ranlib_usage (0);
+
+  if (strcmp (argv[1], "-V") == 0
+      || strcmp (argv[1], "-v") == 0
+      || CONST_STRNEQ (argv[1], "--v"))
+    print_version ("ranlib");
+  arg_index = 1;
+
+  if (strcmp (argv[1], "-t") == 0)
+    {
+      ++arg_index;
+      touch = TRUE;
+    }
+
+  while (arg_index < argc)
+    {
+      if (! touch)
+        status |= ranlib_only (argv[arg_index]);
+      else
+        status |= ranlib_touch (argv[arg_index]);
+      ++arg_index;
+    }
+
+  xexit (status);
+}
+
 /* The option parsing should be in its own function.
    It will be when I have getopt working.  */
 
@@ -394,18 +451,6 @@ main (int argc, char **argv)
 	is_ranlib = 0;
     }
 
-  if (argc > 1 && argv[1][0] == '-')
-    {
-      if (strcmp (argv[1], "--help") == 0)
-	usage (1);
-      else if (strcmp (argv[1], "--version") == 0)
-	{
-	  if (is_ranlib)
-	    print_version ("ranlib");
-	  else
-	    print_version ("ar");
-	}
-    }
 
   START_PROGRESS (program_name, 0);
 
@@ -423,34 +468,14 @@ main (int argc, char **argv)
   argc -= (i - 1);
 
   if (is_ranlib)
+    ranlib_main(argc, argv);
+
+  if (argc > 1 && argv[1][0] == '-')
     {
-      int status = 0;
-      bfd_boolean touch = FALSE;
-
-      if (argc < 2
-	  || strcmp (argv[1], "--help") == 0
-	  || strcmp (argv[1], "-h") == 0
-	  || strcmp (argv[1], "-H") == 0)
-	usage (0);
-      if (strcmp (argv[1], "-V") == 0
-	  || strcmp (argv[1], "-v") == 0
-	  || CONST_STRNEQ (argv[1], "--v"))
-	print_version ("ranlib");
-      arg_index = 1;
-      if (strcmp (argv[1], "-t") == 0)
-	{
-	  ++arg_index;
-	  touch = TRUE;
-	}
-      while (arg_index < argc)
-	{
-	  if (! touch)
-	    status |= ranlib_only (argv[arg_index]);
-	  else
-	    status |= ranlib_touch (argv[arg_index]);
-	  ++arg_index;
-	}
-      xexit (status);
+      if (strcmp (argv[1], "--help") == 0)
+	usage (1);
+      else if (strcmp (argv[1], "--version") == 0)
+	print_version ("ar");
     }
 
   if (argc == 2 && strcmp (argv[1], "-M") == 0)
-- 
1.7.2.30.gc37d7.dirty

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 2/3] binutils/ar: use getopt_long() for options parsing
  2010-12-01 23:16   ` Arnaud Lacombe
@ 2010-12-04  3:37     ` Arnaud Lacombe
  2010-12-04  3:37     ` [PATCH 1/3] binutils/ar: split ar/ranlib path Arnaud Lacombe
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 15+ messages in thread
From: Arnaud Lacombe @ 2010-12-04  3:37 UTC (permalink / raw)
  To: binutils; +Cc: Arnaud Lacombe

	* ar.c (operation): New global variable.
	(show_version): Likewise.
	(show_help): Likewise.
	(long_options): Likewise.
	(usage): Fix help string argument order.
	(decode_options): New.
	(ranlib_main): Use getopt_long().
	(main): Use decode_options().
---
 binutils/ar.c |  410 +++++++++++++++++++++++++++++++--------------------------
 1 files changed, 223 insertions(+), 187 deletions(-)

diff --git a/binutils/ar.c b/binutils/ar.c
index 29dcb4a..de2f631 100644
--- a/binutils/ar.c
+++ b/binutils/ar.c
@@ -21,16 +21,15 @@
    MA 02110-1301, USA.  */
 \f
 /*
-   Bugs: should use getopt the way tar does (complete w/optional -) and
-   should have long options too. GNU ar used to check file against filesystem
-   in quick_update and replace operations (would check mtime). Doesn't warn
-   when name truncated. No way to specify pos_end. Error messages should be
-   more consistent.  */
+   Bugs: GNU ar used to check file against filesystem in quick_update and
+   replace operations (would check mtime). Doesn't warn when name truncated.
+   No way to specify pos_end. Error messages should be more consistent.  */
 
 #include "sysdep.h"
 #include "bfd.h"
 #include "libiberty.h"
 #include "progress.h"
+#include "getopt.h"
 #include "aout/ar.h"
 #include "libbfd.h"
 #include "bucomm.h"
@@ -113,6 +112,12 @@ enum pos
     pos_default, pos_before, pos_after, pos_end
   } postype = pos_default;
 
+enum operations
+  {
+    none = 0, del, replace, print_table,
+    print_files, extract, move, quick_append
+  } operation = none;
+
 static bfd **
 get_pos_bfd (bfd **, enum pos, const char *);
 
@@ -132,8 +137,22 @@ static bfd_boolean full_pathname = FALSE;
 /* Whether to create a "thin" archive (symbol index only -- no files).  */
 static bfd_boolean make_thin_archive = FALSE;
 
+static int show_version = 0;
+
+static int show_help = 0;
+
 static const char *plugin_target = NULL;
 
+#define OPTION_PLUGIN 201
+
+static struct option long_options[] =
+{
+  {"help", no_argument, &show_help, 1},
+  {"plugin", required_argument, NULL, OPTION_PLUGIN},
+  {"version", no_argument, &show_version, 1},
+  {NULL, no_argument, NULL, 0}
+};
+
 int interactive = 0;
 
 static void
@@ -228,7 +247,7 @@ usage (int help)
   /* xgettext:c-format */
   const char * command_line =
 #if BFD_SUPPORTS_PLUGINS
-	_("Usage: %s [emulation options] [--plugin <name>] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...\n");
+	_("Usage: %s [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [--plugin <name>] [member-name] [count] archive-file file...\n");
 #else
 	_("Usage: %s [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...\n");
 #endif
@@ -354,39 +373,209 @@ remove_output (void)
     }
 }
 
+static char **
+decode_options(int argc, char **argv)
+{
+  int c;
+
+  /* Convert old-style tar call by exploding option element and rearranging
+     options accordingly.  */
+
+  if (argc > 1 && argv[1][0] != '-')
+    {
+      int new_argc;		/* argc value for rearranged arguments */
+      char **new_argv;		/* argv value for rearranged arguments */
+      char *const *in;		/* cursor into original argv */
+      char **out;		/* cursor into rearranged argv */
+      const char *letter;	/* cursor into old option letters */
+      char buffer[3];		/* constructed option buffer */
+
+      /* Initialize a constructed option.  */
+
+      buffer[0] = '-';
+      buffer[2] = '\0';
+
+      /* Allocate a new argument array, and copy program name in it.  */
+
+      new_argc = argc - 1 + strlen (argv[1]);
+      new_argv = xmalloc ((new_argc + 1) * sizeof (*argv));
+      in = argv;
+      out = new_argv;
+      *out++ = *in++;
+
+      /* Copy each old letter option as a separate option.  */
+
+      for (letter = *in++; *letter; letter++)
+	{
+	  buffer[1] = *letter;
+	  *out++ = xstrdup (buffer);
+	}
+
+      /* Copy all remaining options.  */
+
+      while (in < argv + argc)
+	*out++ = *in++;
+      *out = NULL;
+
+      /* Replace the old option list by the new one.  */
+
+      argc = new_argc;
+      argv = new_argv;
+    }
+
+  while ((c = getopt_long (argc, argv, "hdmpqrstxabcfilNoPsSuvV",
+			   long_options, NULL)) != EOF)
+    {
+      switch (c)
+        {
+        case 'd':
+        case 'm':
+        case 'p':
+        case 'q':
+        case 'r':
+        case 't':
+        case 'x':
+          if (operation != none)
+            fatal (_("two different operation options specified"));
+	  break;
+	}
+
+      switch (c)
+        {
+        case 'h':
+	  show_help = 1;
+	  break;
+        case 'd':
+          operation = del;
+          operation_alters_arch = TRUE;
+          break;
+        case 'm':
+          operation = move;
+          operation_alters_arch = TRUE;
+          break;
+        case 'p':
+          operation = print_files;
+          break;
+        case 'q':
+          operation = quick_append;
+          operation_alters_arch = TRUE;
+          break;
+        case 'r':
+          operation = replace;
+          operation_alters_arch = TRUE;
+          break;
+        case 't':
+          operation = print_table;
+          break;
+        case 'x':
+          operation = extract;
+          break;
+        case 'l':
+          break;
+        case 'c':
+          silent_create = 1;
+          break;
+        case 'o':
+          preserve_dates = 1;
+          break;
+        case 'V':
+          show_version = TRUE;
+          break;
+        case 's':
+          write_armap = 1;
+          break;
+        case 'S':
+          write_armap = -1;
+          break;
+        case 'u':
+          newer_only = 1;
+          break;
+        case 'v':
+          verbose = 1;
+          break;
+        case 'a':
+          postype = pos_after;
+          break;
+        case 'b':
+          postype = pos_before;
+          break;
+        case 'i':
+          postype = pos_before;
+          break;
+        case 'M':
+          mri_mode = 1;
+          break;
+        case 'N':
+          counted_name_mode = TRUE;
+          break;
+        case 'f':
+          ar_truncate = TRUE;
+          break;
+        case 'P':
+          full_pathname = TRUE;
+          break;
+        case 'T':
+          make_thin_archive = TRUE;
+          break;
+        case 'D':
+          deterministic = TRUE;
+          break;
+	case OPTION_PLUGIN:
+#if BFD_SUPPORTS_PLUGINS
+	  plugin_target = "plugin";
+	  bfd_plugin_set_plugin (optarg);
+#else
+	  fprintf (stderr, _("sorry - this program has been built without plugin support\n"));
+	  xexit (1);
+#endif
+	  break;
+	case 0:		/* A long option that just sets a flag.  */
+	  break;
+        default:
+          /* xgettext:c-format */
+          non_fatal (_("illegal option -- '%d'"), c);
+          usage (0);
+        }
+    }
+
+  return &argv[optind];
+}
+
 static void
 ranlib_main(int argc, char **argv)
 {
   int arg_index, status = 0;
   bfd_boolean touch = FALSE;
+  int c;
 
-  if (argc > 1 && argv[1][0] == '-')
+  while ((c = getopt_long (argc, argv, "hHvVt", long_options, NULL)) != EOF)
     {
-      if (strcmp (argv[1], "--help") == 0)
-	ranlib_usage (1);
-      else if (strcmp (argv[1], "--version") == 0)
-	{
-	  print_version ("ranlib");
-	}
+      switch (c)
+        {
+	case 'h':
+	case 'H':
+	  show_help = 1;
+	  break;
+	case 't':
+	  touch = TRUE;
+	  break;
+	case 'v':
+	case 'V':
+	  show_version = 1;
+	  break;
+        }
     }
 
-  if (argc < 2
-      || strcmp (argv[1], "--help") == 0
-      || strcmp (argv[1], "-h") == 0
-      || strcmp (argv[1], "-H") == 0)
+  if (argc < 2)
     ranlib_usage (0);
 
-  if (strcmp (argv[1], "-V") == 0
-      || strcmp (argv[1], "-v") == 0
-      || CONST_STRNEQ (argv[1], "--v"))
+  if (show_help)
+    usage(1);
+
+  if (show_version)
     print_version ("ranlib");
-  arg_index = 1;
 
-  if (strcmp (argv[1], "-t") == 0)
-    {
-      ++arg_index;
-      touch = TRUE;
-    }
+  arg_index = 1;
 
   while (arg_index < argc)
     {
@@ -408,20 +597,11 @@ int main (int, char **);
 int
 main (int argc, char **argv)
 {
-  char *arg_ptr;
-  char c;
-  enum
-    {
-      none = 0, del, replace, print_table,
-      print_files, extract, move, quick_append
-    } operation = none;
   int arg_index;
   char **files;
   int file_count;
   char *inarch_filename;
-  int show_version;
   int i;
-  int do_posix = 0;
 
 #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
   setlocale (LC_MESSAGES, "");
@@ -451,14 +631,11 @@ main (int argc, char **argv)
 	is_ranlib = 0;
     }
 
-
   START_PROGRESS (program_name, 0);
 
   bfd_init ();
   set_default_bfd_target ();
 
-  show_version = 0;
-
   xatexit (remove_output);
 
   for (i = 1; i < argc; i++)
@@ -470,14 +647,6 @@ main (int argc, char **argv)
   if (is_ranlib)
     ranlib_main(argc, argv);
 
-  if (argc > 1 && argv[1][0] == '-')
-    {
-      if (strcmp (argv[1], "--help") == 0)
-	usage (1);
-      else if (strcmp (argv[1], "--version") == 0)
-	print_version ("ar");
-    }
-
   if (argc == 2 && strcmp (argv[1], "-M") == 0)
     {
       mri_emul ();
@@ -487,150 +656,15 @@ main (int argc, char **argv)
   if (argc < 2)
     usage (0);
 
-  arg_index = 1;
-  arg_ptr = argv[arg_index];
-
-  if (strcmp (arg_ptr, "--plugin") == 0)
-    {
-#if BFD_SUPPORTS_PLUGINS
-      if (argc < 4)
-	usage (1);
-
-      bfd_plugin_set_plugin (argv[2]);
+  argv = decode_options(argc, argv);
 
-      arg_index += 2;
-      arg_ptr = argv[arg_index];
-
-      plugin_target = "plugin";
-#else
-      fprintf (stderr, _("sorry - this program has been built without plugin support\n"));
-      xexit (1);
-#endif
-    }
-
-  if (*arg_ptr == '-')
-    {
-      /* When the first option starts with '-' we support POSIX-compatible
-	 option parsing.  */
-      do_posix = 1;
-      ++arg_ptr;			/* compatibility */
-    }
-
-  do
-    {
-      while ((c = *arg_ptr++) != '\0')
-	{
-	  switch (c)
-	    {
-	    case 'd':
-	    case 'm':
-	    case 'p':
-	    case 'q':
-	    case 'r':
-	    case 't':
-	    case 'x':
-	      if (operation != none)
-		fatal (_("two different operation options specified"));
-	      switch (c)
-		{
-		case 'd':
-		  operation = del;
-		  operation_alters_arch = TRUE;
-		  break;
-		case 'm':
-		  operation = move;
-		  operation_alters_arch = TRUE;
-		  break;
-		case 'p':
-		  operation = print_files;
-		  break;
-		case 'q':
-		  operation = quick_append;
-		  operation_alters_arch = TRUE;
-		  break;
-		case 'r':
-		  operation = replace;
-		  operation_alters_arch = TRUE;
-		  break;
-		case 't':
-		  operation = print_table;
-		  break;
-		case 'x':
-		  operation = extract;
-		  break;
-		}
-	    case 'l':
-	      break;
-	    case 'c':
-	      silent_create = 1;
-	      break;
-	    case 'o':
-	      preserve_dates = 1;
-	      break;
-	    case 'V':
-	      show_version = TRUE;
-	      break;
-	    case 's':
-	      write_armap = 1;
-	      break;
-	    case 'S':
-	      write_armap = -1;
-	      break;
-	    case 'u':
-	      newer_only = 1;
-	      break;
-	    case 'v':
-	      verbose = 1;
-	      break;
-	    case 'a':
-	      postype = pos_after;
-	      break;
-	    case 'b':
-	      postype = pos_before;
-	      break;
-	    case 'i':
-	      postype = pos_before;
-	      break;
-	    case 'M':
-	      mri_mode = 1;
-	      break;
-	    case 'N':
-	      counted_name_mode = TRUE;
-	      break;
-	    case 'f':
-	      ar_truncate = TRUE;
-	      break;
-	    case 'P':
-	      full_pathname = TRUE;
-	      break;
-	    case 'T':
-	      make_thin_archive = TRUE;
-	      break;
-	    case 'D':
-	      deterministic = TRUE;
-	      break;
-	    default:
-	      /* xgettext:c-format */
-	      non_fatal (_("illegal option -- %c"), c);
-	      usage (0);
-	    }
-	}
-
-      /* With POSIX-compatible option parsing continue with the next
-	 argument if it starts with '-'.  */
-      if (do_posix && arg_index + 1 < argc && argv[arg_index + 1][0] == '-')
-	arg_ptr = argv[++arg_index] + 1;
-      else
-	do_posix = 0;
-    }
-  while (do_posix);
+  if (show_help)
+    usage(1);
 
   if (show_version)
     print_version ("ar");
 
-  ++arg_index;
-  if (arg_index >= argc)
-    usage (0);
+  arg_index = 0;
 
   if (mri_mode)
     {
@@ -676,8 +710,10 @@ main (int argc, char **argv)
 
       inarch_filename = argv[arg_index++];
 
-      files = arg_index < argc ? argv + arg_index : NULL;
-      file_count = argc - arg_index;
+      for (file_count = 0; argv[arg_index + file_count] != NULL; file_count++)
+	      continue;
+
+      files = (file_count > 0) ? argv + arg_index : NULL;
 
       arch = open_inarch (inarch_filename,
 			  files == NULL ? (char *) NULL : files[0]);
-- 
1.7.2.30.gc37d7.dirty

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 3/3] binutils/ar: learn --target
  2010-12-01 23:16   ` Arnaud Lacombe
  2010-12-04  3:37     ` [PATCH 2/3] binutils/ar: use getopt_long() for options parsing Arnaud Lacombe
  2010-12-04  3:37     ` [PATCH 1/3] binutils/ar: split ar/ranlib path Arnaud Lacombe
@ 2010-12-04  3:38     ` Arnaud Lacombe
  2010-12-08  5:08       ` Alan Modra
  2010-12-15 19:58       ` H.J. Lu
  2010-12-04  3:47     ` Using binutils with all target enabled Arnaud Lacombe
  3 siblings, 2 replies; 15+ messages in thread
From: Arnaud Lacombe @ 2010-12-04  3:38 UTC (permalink / raw)
  To: binutils; +Cc: Arnaud Lacombe

2010-12-02  Arnaud Lacombe  <lacombar@gmail.com>

	* ar.c (long_options): Add target.
	(decode_options): Handle the --target option.
	(open_inarch): Check for plugin's target, default to --target
	(replace_members): Use generic `target'.
---
 binutils/ar.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/binutils/ar.c b/binutils/ar.c
index de2f631..a5ae4f0 100644
--- a/binutils/ar.c
+++ b/binutils/ar.c
@@ -143,12 +143,16 @@ static int show_help = 0;
 
 static const char *plugin_target = NULL;
 
+static const char *target = NULL;
+
 #define OPTION_PLUGIN 201
+#define OPTION_TARGET 202
 
 static struct option long_options[] =
 {
   {"help", no_argument, &show_help, 1},
   {"plugin", required_argument, NULL, OPTION_PLUGIN},
+  {"target", required_argument, NULL, OPTION_TARGET},
   {"version", no_argument, &show_version, 1},
   {NULL, no_argument, NULL, 0}
 };
@@ -529,6 +533,9 @@ decode_options(int argc, char **argv)
 	  xexit (1);
 #endif
 	  break;
+	case OPTION_TARGET:
+	  target = optarg;
+	  break;
 	case 0:		/* A long option that just sets a flag.  */
 	  break;
         default:
@@ -773,7 +780,6 @@ main (int argc, char **argv)
 bfd *
 open_inarch (const char *archive_filename, const char *file)
 {
-  const char *target;
   bfd **last_one;
   bfd *next_one;
   struct stat sbuf;
@@ -782,7 +788,8 @@ open_inarch (const char *archive_filename, const char *file)
 
   bfd_set_error (bfd_error_no_error);
 
-  target = plugin_target;
+  if (target == NULL)
+    target = plugin_target;
 
   if (stat (archive_filename, &sbuf) != 0)
     {
@@ -1270,7 +1277,7 @@ replace_members (bfd *arch, char **files_to_move, bfd_boolean quick)
 		  after_bfd = get_pos_bfd (&arch->archive_next, pos_after,
 					   current->filename);
 		  if (ar_emul_replace (after_bfd, *files_to_move,
-				       plugin_target, verbose))
+				       target, verbose))
 		    {
 		      /* Snip out this entry from the chain.  */
 		      *current_ptr = (*current_ptr)->archive_next;
@@ -1286,7 +1293,7 @@ replace_members (bfd *arch, char **files_to_move, bfd_boolean quick)
       /* Add to the end of the archive.  */
       after_bfd = get_pos_bfd (&arch->archive_next, pos_end, NULL);
 
-      if (ar_emul_append (after_bfd, *files_to_move, plugin_target,
+      if (ar_emul_append (after_bfd, *files_to_move, target,
 			  verbose, make_thin_archive))
 	changed = TRUE;
 
-- 
1.7.2.30.gc37d7.dirty

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Using binutils with all target enabled
  2010-12-01 23:16   ` Arnaud Lacombe
                       ` (2 preceding siblings ...)
  2010-12-04  3:38     ` [PATCH 3/3] binutils/ar: learn --target Arnaud Lacombe
@ 2010-12-04  3:47     ` Arnaud Lacombe
  3 siblings, 0 replies; 15+ messages in thread
From: Arnaud Lacombe @ 2010-12-04  3:47 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: binutils

Hi all,

On Wed, Dec 1, 2010 at 6:16 PM, Arnaud Lacombe <lacombar@gmail.com> wrote:
> Hi,
>
> On Wed, Dec 1, 2010 at 5:01 PM, Mike Frysinger <vapier@gentoo.org> wrote:
>> On Wednesday, December 01, 2010 14:27:10 Arnaud Lacombe wrote:
>>> I'd have hoped that specifying the the format explicits would have
>>> been possible, but very few program seems to support such options.
>>> Actually, only objdump (maybe others) accepts a '-b' flags.
>>
>> ld has -m, objcopy/strip have -F/-O/-I, readelf doesnt care, addr2line/nm/size
>> have --target.  seems like just as, ar, and ranlib are missing command line
>> flags, and --target might be the logical flag to add to them.
> thanks... that would have been trivial to add if ar/ranlib's options
> parsing did not look so fragile :(
>
> I suspect the following:
>
>  if (argc == 2 && strcmp (argv[1], "-M") == 0)
>    {
>      mri_emul ();
>      xexit (0);
>    }
>
> is already broken when --plugin <plugin> is used.
>
> Is there any interest to see "--target" taught to ar/ranlib in
> mainstream's binutils (in which can I can spend some time to write a
> patch) or is it not worth it (in which case I'll just do a nasty local
> hack) ?
>
I just sent the patches teaching the --target flag to binutils/ar (and
doing a bit of refactoring). They are certainly not regressions-free,
and certainly not enough commented/documented. Anyway, I leave them
open to comment if anybody cares.

 - Arnaud

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/3] binutils/ar: split ar/ranlib path
  2010-12-04  3:37     ` [PATCH 1/3] binutils/ar: split ar/ranlib path Arnaud Lacombe
@ 2010-12-04 10:45       ` Mike Frysinger
  0 siblings, 0 replies; 15+ messages in thread
From: Mike Frysinger @ 2010-12-04 10:45 UTC (permalink / raw)
  To: binutils; +Cc: Arnaud Lacombe

[-- Attachment #1: Type: Text/Plain, Size: 336 bytes --]

On Friday, December 03, 2010 22:36:52 Arnaud Lacombe wrote:
> 2010-12-02  Arnaud Lacombe  <lacombar@gmail.com>
> 
> 	* ar.c (main): Split ranlib path.
> 	(ranlib_usage): New
> 	(ranlib_main): New

usually these e-mails contain an explanation of what you're trying to 
accomplish and why you coded things the way you did
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/3] binutils/ar: learn --target
  2010-12-04  3:38     ` [PATCH 3/3] binutils/ar: learn --target Arnaud Lacombe
@ 2010-12-08  5:08       ` Alan Modra
  2010-12-15 19:58       ` H.J. Lu
  1 sibling, 0 replies; 15+ messages in thread
From: Alan Modra @ 2010-12-08  5:08 UTC (permalink / raw)
  To: Arnaud Lacombe; +Cc: binutils

Applied, with this followup patch to fix ar -T and ar -D regressions.

	* ar.c: Formatting.
	(usage): Correct help strings.
	(decode_options): Correct getopt_long short options.  Remove
	duplicate non-handled option message.
	(main): Don't handle -M specially.

Index: binutils/ar.c
===================================================================
RCS file: /cvs/src/src/binutils/ar.c,v
retrieving revision 1.71
diff -u -p -r1.71 ar.c
--- binutils/ar.c	8 Dec 2010 05:00:14 -0000	1.71
+++ binutils/ar.c	8 Dec 2010 05:05:15 -0000
@@ -216,8 +216,8 @@ map_over_members (bfd *arch, void (*func
 	      filename = normalize (filename, arch);
 	    }
 
-	  if ((filename != NULL) &&
-	      (!FILENAME_CMP (normalize (*files, arch), filename)))
+	  if (filename != NULL
+	      && !FILENAME_CMP (normalize (*files, arch), filename))
 	    {
 	      ++match_count;
 	      if (counted_name_mode
@@ -248,12 +248,17 @@ usage (int help)
 
   s = help ? stdout : stderr;
 
-  /* xgettext:c-format */
-  const char * command_line =
 #if BFD_SUPPORTS_PLUGINS
-	_("Usage: %s [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [--plugin <name>] [member-name] [count] archive-file file...\n");
+  /* xgettext:c-format */
+  const char *command_line
+    = _("Usage: %s [emulation options] [-]{dmpqrstx}[abcDfilMNoPsSTuvV]"
+	" [--plugin <name>] [member-name] [count] archive-file file...\n");
+
 #else
-	_("Usage: %s [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...\n");
+  /* xgettext:c-format */
+  const char *command_line
+    = _("Usage: %s [emulation options] [-]{dmpqrstx}[abcDfilMNoPsSTuvV]"
+	" [member-name] [count] archive-file file...\n");
 #endif
   fprintf (s, command_line, program_name);
 
@@ -301,7 +306,7 @@ usage (int help)
 }
 
 static void
-ranlib_usage(int help)
+ranlib_usage (int help)
 {
   FILE *s;
 
@@ -378,7 +383,7 @@ remove_output (void)
 }
 
 static char **
-decode_options(int argc, char **argv)
+decode_options (int argc, char **argv)
 {
   int c;
 
@@ -427,7 +432,7 @@ decode_options(int argc, char **argv)
       argv = new_argv;
     }
 
-  while ((c = getopt_long (argc, argv, "hdmpqrstxabcfilNoPsSuvV",
+  while ((c = getopt_long (argc, argv, "hdmpqrtxlcoVsSuvabiMNfPTD",
 			   long_options, NULL)) != EOF)
     {
       switch (c)
@@ -539,8 +544,6 @@ decode_options(int argc, char **argv)
 	case 0:		/* A long option that just sets a flag.  */
 	  break;
         default:
-          /* xgettext:c-format */
-          non_fatal (_("illegal option -- '%d'"), c);
           usage (0);
         }
     }
@@ -549,7 +552,7 @@ decode_options(int argc, char **argv)
 }
 
 static void
-ranlib_main(int argc, char **argv)
+ranlib_main (int argc, char **argv)
 {
   int arg_index, status = 0;
   bfd_boolean touch = FALSE;
@@ -577,7 +580,7 @@ ranlib_main(int argc, char **argv)
     ranlib_usage (0);
 
   if (show_help)
-    usage(1);
+    usage (1);
 
   if (show_version)
     print_version ("ranlib");
@@ -596,9 +599,6 @@ ranlib_main(int argc, char **argv)
   xexit (status);
 }
 
-/* The option parsing should be in its own function.
-   It will be when I have getopt working.  */
-
 int main (int, char **);
 
 int
@@ -652,21 +652,15 @@ main (int argc, char **argv)
   argc -= (i - 1);
 
   if (is_ranlib)
-    ranlib_main(argc, argv);
-
-  if (argc == 2 && strcmp (argv[1], "-M") == 0)
-    {
-      mri_emul ();
-      xexit (0);
-    }
+    ranlib_main (argc, argv);
 
   if (argc < 2)
     usage (0);
 
-  argv = decode_options(argc, argv);
+  argv = decode_options (argc, argv);
 
   if (show_help)
-    usage(1);
+    usage (1);
 
   if (show_version)
     print_version ("ar");
@@ -709,7 +703,7 @@ main (int argc, char **argv)
       if (counted_name_mode)
 	{
 	  if (operation != extract && operation != del)
-	     fatal (_("`N' is only meaningful with the `x' and `d' options."));
+	    fatal (_("`N' is only meaningful with the `x' and `d' options."));
 	  counted_name_counter = atoi (argv[arg_index++]);
 	  if (counted_name_counter <= 0)
 	    fatal (_("Value for `N' must be positive."));
@@ -718,7 +712,7 @@ main (int argc, char **argv)
       inarch_filename = argv[arg_index++];
 
       for (file_count = 0; argv[arg_index + file_count] != NULL; file_count++)
-	      continue;
+	continue;
 
       files = (file_count > 0) ? argv + arg_index : NULL;
 
@@ -800,8 +794,8 @@ open_inarch (const char *archive_filenam
 	 stat() works just fine in v2.x, so I think this should be
 	 removed.  For now, I enable it for DJGPP v2. -- EZ.  */
 
-/* KLUDGE ALERT! Temporary fix until I figger why
-   stat() is wrong ... think it's buried in GO32's IDT - Jax */
+      /* KLUDGE ALERT! Temporary fix until I figger why
+	 stat() is wrong ... think it's buried in GO32's IDT - Jax */
       if (errno != ENOENT)
 	bfd_fatal (archive_filename);
 #endif

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/3] binutils/ar: learn --target
  2010-12-04  3:38     ` [PATCH 3/3] binutils/ar: learn --target Arnaud Lacombe
  2010-12-08  5:08       ` Alan Modra
@ 2010-12-15 19:58       ` H.J. Lu
  2010-12-15 20:09         ` Arnaud Lacombe
  1 sibling, 1 reply; 15+ messages in thread
From: H.J. Lu @ 2010-12-15 19:58 UTC (permalink / raw)
  To: Arnaud Lacombe; +Cc: binutils

On Fri, Dec 3, 2010 at 7:36 PM, Arnaud Lacombe <lacombar@gmail.com> wrote:
> 2010-12-02  Arnaud Lacombe  <lacombar@gmail.com>
>
>        * ar.c (long_options): Add target.
>        (decode_options): Handle the --target option.
>        (open_inarch): Check for plugin's target, default to --target
>        (replace_members): Use generic `target'.

There is no document for this new option:

http://sourceware.org/bugzilla/show_bug.cgi?id=12325


-- 
H.J.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/3] binutils/ar: learn --target
  2010-12-15 19:58       ` H.J. Lu
@ 2010-12-15 20:09         ` Arnaud Lacombe
  2010-12-16  1:23           ` H.J. Lu
  0 siblings, 1 reply; 15+ messages in thread
From: Arnaud Lacombe @ 2010-12-15 20:09 UTC (permalink / raw)
  To: H.J. Lu; +Cc: binutils

Hi,

On Wed, Dec 15, 2010 at 2:30 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Fri, Dec 3, 2010 at 7:36 PM, Arnaud Lacombe <lacombar@gmail.com> wrote:
>> 2010-12-02  Arnaud Lacombe  <lacombar@gmail.com>
>>
>>        * ar.c (long_options): Add target.
>>        (decode_options): Handle the --target option.
>>        (open_inarch): Check for plugin's target, default to --target
>>        (replace_members): Use generic `target'.
>
> There is no document for this new option:
>
> http://sourceware.org/bugzilla/show_bug.cgi?id=12325
>
Will do.

Btw. does the logic wrt. the --plugin option suits you ? That is that
the --target override any --plugin ? Maybe the two should be mutually
exclusive. I do not have any strong feelings about this.

Thanks,
 - Arnaud

>
> --
> H.J.
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/3] binutils/ar: learn --target
  2010-12-15 20:09         ` Arnaud Lacombe
@ 2010-12-16  1:23           ` H.J. Lu
  0 siblings, 0 replies; 15+ messages in thread
From: H.J. Lu @ 2010-12-16  1:23 UTC (permalink / raw)
  To: Arnaud Lacombe; +Cc: binutils

On Wed, Dec 15, 2010 at 11:58 AM, Arnaud Lacombe <lacombar@gmail.com> wrote:
> Hi,
>
> On Wed, Dec 15, 2010 at 2:30 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Fri, Dec 3, 2010 at 7:36 PM, Arnaud Lacombe <lacombar@gmail.com> wrote:
>>> 2010-12-02  Arnaud Lacombe  <lacombar@gmail.com>
>>>
>>>        * ar.c (long_options): Add target.
>>>        (decode_options): Handle the --target option.
>>>        (open_inarch): Check for plugin's target, default to --target
>>>        (replace_members): Use generic `target'.
>>
>> There is no document for this new option:
>>
>> http://sourceware.org/bugzilla/show_bug.cgi?id=12325
>>
> Will do.
>
> Btw. does the logic wrt. the --plugin option suits you ? That is that
> the --target override any --plugin ? Maybe the two should be mutually
> exclusive. I do not have any strong feelings about this.
>

I think --target  and --plugin should override each other.



-- 
H.J.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2010-12-15 20:09 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-01 19:27 Using binutils with all target enabled Arnaud Lacombe
2010-12-01 20:56 ` Andreas Schwab
2010-12-01 22:06 ` Mike Frysinger
2010-12-01 23:16   ` Arnaud Lacombe
2010-12-04  3:37     ` [PATCH 2/3] binutils/ar: use getopt_long() for options parsing Arnaud Lacombe
2010-12-04  3:37     ` [PATCH 1/3] binutils/ar: split ar/ranlib path Arnaud Lacombe
2010-12-04 10:45       ` Mike Frysinger
2010-12-04  3:38     ` [PATCH 3/3] binutils/ar: learn --target Arnaud Lacombe
2010-12-08  5:08       ` Alan Modra
2010-12-15 19:58       ` H.J. Lu
2010-12-15 20:09         ` Arnaud Lacombe
2010-12-16  1:23           ` H.J. Lu
2010-12-04  3:47     ` Using binutils with all target enabled Arnaud Lacombe
2010-12-02  0:10   ` Joseph S. Myers
2010-12-02  0:17     ` Arnaud Lacombe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).