aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog21
-rw-r--r--binutils/ar.c14
-rw-r--r--binutils/binemul.c25
-rw-r--r--binutils/binemul.h18
4 files changed, 55 insertions, 23 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index dbbe42e..d0d5bb6 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,24 @@
+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
diff --git a/binutils/ar.c b/binutils/ar.c
index fd1b9ec..4c765ca 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:;
diff --git a/binutils/binemul.c b/binutils/binemul.c
index 2931bda..35587db 100644
--- a/binutils/binemul.c
+++ b/binutils/binemul.c
@@ -39,19 +39,19 @@ ar_emul_default_usage (FILE *fp)
}
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. */
@@ -84,32 +84,35 @@ do_ar_emul_default_append (bfd **after_bfd, bfd *new_bfd,
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);
diff --git a/binutils/binemul.h b/binutils/binemul.h
index 1b02015..f85cc09 100644
--- a/binutils/binemul.h
+++ b/binutils/binemul.h
@@ -28,11 +28,14 @@
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 *);
@@ -55,8 +58,9 @@ typedef struct bin_emulation_xfer_struct
{
/* 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;