summaryrefslogtreecommitdiff
path: root/binutils/ar.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2010-09-15 17:10:15 +0000
committerH.J. Lu <hjl.tools@gmail.com>2010-09-15 17:10:15 +0000
commitae2adb9b2cc7f2e0645867627d0a95aaee8d92d9 (patch)
tree50aef9aa3cbdad51033258a493b1525d48285052 /binutils/ar.c
parenta6cd50a320e37505e68b02b3d287b008da79ccf5 (diff)
downloadbinutils-redhat-ae2adb9b2cc7f2e0645867627d0a95aaee8d92d9.tar.gz
Pass "plugin" as target for "ar --plugin" when opening a BFD file.
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.
Diffstat (limited to 'binutils/ar.c')
-rw-r--r--binutils/ar.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/binutils/ar.c b/binutils/ar.c
index fd1b9ecd17..4c765ca67c 100644
--- a/binutils/ar.c
+++ b/binutils/ar.c
@@ -132,6 +132,8 @@ 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 const char *plugin_target = NULL;
+
int interactive = 0;
static void
@@ -472,6 +474,8 @@ main (int argc, char **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);
@@ -716,7 +720,7 @@ open_inarch (const char *archive_filename, const char *file)
bfd_set_error (bfd_error_no_error);
- target = NULL;
+ target = plugin_target;
if (stat (archive_filename, &sbuf) != 0)
{
@@ -747,7 +751,7 @@ open_inarch (const char *archive_filename, const char *file)
{
bfd *obj;
- obj = bfd_openr (file, NULL);
+ obj = bfd_openr (file, target);
if (obj != NULL)
{
if (bfd_check_format (obj, bfd_object))
@@ -1205,7 +1209,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,
- verbose))
+ plugin_target, verbose))
{
/* Snip out this entry from the chain. */
*current_ptr = (*current_ptr)->archive_next;
@@ -1221,8 +1225,8 @@ 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, verbose,
- make_thin_archive))
+ if (ar_emul_append (after_bfd, *files_to_move, plugin_target,
+ verbose, make_thin_archive))
changed = TRUE;
next_file:;