diff options
author | Alan Modra <amodra@gmail.com> | 2010-12-08 05:00:14 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2010-12-08 05:00:14 +0000 |
commit | 90b79792c01821d14248f4cf8c330a599fb5a4be (patch) | |
tree | 14e49ef6e79737b9a0176728d84fb47886b28098 | |
parent | 4e4075512b08d37e1431411d3e59bb3cc25fd490 (diff) | |
download | gdb-90b79792c01821d14248f4cf8c330a599fb5a4be.zip gdb-90b79792c01821d14248f4cf8c330a599fb5a4be.tar.gz gdb-90b79792c01821d14248f4cf8c330a599fb5a4be.tar.bz2 |
* 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'.
-rw-r--r-- | binutils/ChangeLog | 5 | ||||
-rw-r--r-- | binutils/ar.c | 15 |
2 files changed, 16 insertions, 4 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 77b6a51..6ce7950 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,5 +1,10 @@ 2010-12-08 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'. + * ar.c (operation): New global variable. (show_version): Likewise. (show_help): Likewise. 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; |