+2010-09-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ * ar.c (plugin_target): New.
+ (main): Set plugin_target to "plugin" for --plugin.
+ (open_inarch): Initialize target to plugin_target.
+ (replace_members): Pass plugin_target to ar_emul_replace
+ and ar_emul_append.
+
+ * binemul.h (ar_emul_append): Add a target argument.
+ (ar_emul_default_append): Likewise.
+ (ar_emul_replace): Likewise.
+ (ar_emul_default_replace): Likewise.
+ (bin_emulation_xfer_struct): Add a target argument to
+ ar_append and ar_replace.
+
+ * binemul.c (ar_emul_append): Updated. Pass target to bfd_openr.
+ (do_ar_emul_default_append): Likewise.
+ (ar_emul_default_append): Likewise.
+ (ar_emul_replace): Likewise.
+ (ar_emul_default_replace): Likewise.
+
2010-09-10 Ben Gardiner <bengardiner@nanometrics.ca>
* objcopy.c: Add --interleave-width option to allow interleaving
/* Whether to create a "thin" archive (symbol index only -- no files). */
static bfd_boolean make_thin_archive = FALSE;
+static const char *plugin_target = NULL;
+
int interactive = 0;
static void
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);
bfd_set_error (bfd_error_no_error);
- target = NULL;
+ target = plugin_target;
if (stat (archive_filename, &sbuf) != 0)
{
{
bfd *obj;
- obj = bfd_openr (file, NULL);
+ obj = bfd_openr (file, target);
if (obj != NULL)
{
if (bfd_check_format (obj, bfd_object))
after_bfd = get_pos_bfd (&arch->archive_next, pos_after,
current->filename);
if (ar_emul_replace (after_bfd, *files_to_move,
- verbose))
+ plugin_target, verbose))
{
/* Snip out this entry from the chain. */
*current_ptr = (*current_ptr)->archive_next;
/* 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, verbose,
- make_thin_archive))
+ if (ar_emul_append (after_bfd, *files_to_move, plugin_target,
+ verbose, make_thin_archive))
changed = TRUE;
next_file:;
}
bfd_boolean
-ar_emul_append (bfd **after_bfd, char *file_name, bfd_boolean verbose,
- bfd_boolean flatten)
+ar_emul_append (bfd **after_bfd, char *file_name, const char *target,
+ bfd_boolean verbose, bfd_boolean flatten)
{
if (bin_dummy_emulation.ar_append)
- return bin_dummy_emulation.ar_append (after_bfd, file_name, verbose,
- flatten);
+ return bin_dummy_emulation.ar_append (after_bfd, file_name, target,
+ verbose, flatten);
return FALSE;
}
static bfd_boolean
do_ar_emul_default_append (bfd **after_bfd, bfd *new_bfd,
- bfd_boolean verbose, bfd_boolean flatten)
+ bfd_boolean verbose, bfd_boolean flatten)
{
/* When flattening, add the members of an archive instead of the
archive itself. */
bfd_boolean
ar_emul_default_append (bfd **after_bfd, char *file_name,
- bfd_boolean verbose, bfd_boolean flatten)
+ const char *target, bfd_boolean verbose,
+ bfd_boolean flatten)
{
bfd *new_bfd;
- new_bfd = bfd_openr (file_name, NULL);
+ new_bfd = bfd_openr (file_name, target);
AR_EMUL_ELEMENT_CHECK (new_bfd, file_name);
return do_ar_emul_default_append (after_bfd, new_bfd, verbose, flatten);
}
bfd_boolean
-ar_emul_replace (bfd **after_bfd, char *file_name, bfd_boolean verbose)
+ar_emul_replace (bfd **after_bfd, char *file_name, const char *target,
+ bfd_boolean verbose)
{
if (bin_dummy_emulation.ar_replace)
- return bin_dummy_emulation.ar_replace (after_bfd, file_name, verbose);
+ return bin_dummy_emulation.ar_replace (after_bfd, file_name,
+ target, verbose);
return FALSE;
}
bfd_boolean
ar_emul_default_replace (bfd **after_bfd, char *file_name,
- bfd_boolean verbose)
+ const char *target, bfd_boolean verbose)
{
bfd *temp;
temp = *after_bfd;
- *after_bfd = bfd_openr (file_name, NULL);
+ *after_bfd = bfd_openr (file_name, target);
AR_EMUL_ELEMENT_CHECK (*after_bfd, file_name);
AR_EMUL_REPLACE_PRINT_VERBOSE (verbose, file_name);
extern void ar_emul_usage (FILE *);
extern void ar_emul_default_usage (FILE *);
-extern bfd_boolean ar_emul_append (bfd **, char *, bfd_boolean, bfd_boolean);
-extern bfd_boolean ar_emul_default_append (bfd **, char *, bfd_boolean,
- bfd_boolean);
-extern bfd_boolean ar_emul_replace (bfd **, char *, bfd_boolean);
-extern bfd_boolean ar_emul_default_replace (bfd **, char *, bfd_boolean);
+extern bfd_boolean ar_emul_append (bfd **, char *, const char *,
+ bfd_boolean, bfd_boolean);
+extern bfd_boolean ar_emul_default_append (bfd **, char *, const char *,
+ bfd_boolean, bfd_boolean);
+extern bfd_boolean ar_emul_replace (bfd **, char *, const char *,
+ bfd_boolean);
+extern bfd_boolean ar_emul_default_replace (bfd **, char *,
+ const char *, bfd_boolean);
extern bfd_boolean ar_emul_parse_arg (char *);
extern bfd_boolean ar_emul_default_parse_arg (char *);
{
/* Print out the extra options. */
void (* ar_usage) (FILE *fp);
- bfd_boolean (* ar_append) (bfd **, char *, bfd_boolean, bfd_boolean);
- bfd_boolean (* ar_replace) (bfd **, char *, bfd_boolean);
+ bfd_boolean (* ar_append) (bfd **, char *, const char *, bfd_boolean,
+ bfd_boolean);
+ bfd_boolean (* ar_replace) (bfd **, char *, const char *, bfd_boolean);
bfd_boolean (* ar_parse_arg) (char *);
}
bin_emulation_xfer_type;