From: Arnaud Lacombe <lacombar@gmail.com>
To: binutils@sourceware.org
Cc: Arnaud Lacombe <lacombar@gmail.com>
Subject: [PATCH 3/3] binutils/ar: learn --target
Date: Sat, 04 Dec 2010 03:38:00 -0000 [thread overview]
Message-ID: <1291433814-27666-3-git-send-email-lacombar@gmail.com> (raw)
In-Reply-To: <AANLkTi=8AJtMnjea3S=vA7zk0Ymm6iWVSoG+tM76k-5R@mail.gmail.com>
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
next prev parent reply other threads:[~2010-12-04 3:38 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Arnaud Lacombe [this message]
2010-12-08 5:08 ` [PATCH 3/3] binutils/ar: learn --target 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1291433814-27666-3-git-send-email-lacombar@gmail.com \
--to=lacombar@gmail.com \
--cc=binutils@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).