mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-25 21:41:47 +08:00
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.
This commit is contained in:
@ -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>
|
2010-09-10 Ben Gardiner <bengardiner@nanometrics.ca>
|
||||||
|
|
||||||
* objcopy.c: Add --interleave-width option to allow interleaving
|
* objcopy.c: Add --interleave-width option to allow interleaving
|
||||||
|
@ -132,6 +132,8 @@ static bfd_boolean full_pathname = FALSE;
|
|||||||
/* Whether to create a "thin" archive (symbol index only -- no files). */
|
/* Whether to create a "thin" archive (symbol index only -- no files). */
|
||||||
static bfd_boolean make_thin_archive = FALSE;
|
static bfd_boolean make_thin_archive = FALSE;
|
||||||
|
|
||||||
|
static const char *plugin_target = NULL;
|
||||||
|
|
||||||
int interactive = 0;
|
int interactive = 0;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -472,6 +474,8 @@ main (int argc, char **argv)
|
|||||||
|
|
||||||
arg_index += 2;
|
arg_index += 2;
|
||||||
arg_ptr = argv[arg_index];
|
arg_ptr = argv[arg_index];
|
||||||
|
|
||||||
|
plugin_target = "plugin";
|
||||||
#else
|
#else
|
||||||
fprintf (stderr, _("sorry - this program has been built without plugin support\n"));
|
fprintf (stderr, _("sorry - this program has been built without plugin support\n"));
|
||||||
xexit (1);
|
xexit (1);
|
||||||
@ -716,7 +720,7 @@ open_inarch (const char *archive_filename, const char *file)
|
|||||||
|
|
||||||
bfd_set_error (bfd_error_no_error);
|
bfd_set_error (bfd_error_no_error);
|
||||||
|
|
||||||
target = NULL;
|
target = plugin_target;
|
||||||
|
|
||||||
if (stat (archive_filename, &sbuf) != 0)
|
if (stat (archive_filename, &sbuf) != 0)
|
||||||
{
|
{
|
||||||
@ -747,7 +751,7 @@ open_inarch (const char *archive_filename, const char *file)
|
|||||||
{
|
{
|
||||||
bfd *obj;
|
bfd *obj;
|
||||||
|
|
||||||
obj = bfd_openr (file, NULL);
|
obj = bfd_openr (file, target);
|
||||||
if (obj != NULL)
|
if (obj != NULL)
|
||||||
{
|
{
|
||||||
if (bfd_check_format (obj, bfd_object))
|
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,
|
after_bfd = get_pos_bfd (&arch->archive_next, pos_after,
|
||||||
current->filename);
|
current->filename);
|
||||||
if (ar_emul_replace (after_bfd, *files_to_move,
|
if (ar_emul_replace (after_bfd, *files_to_move,
|
||||||
verbose))
|
plugin_target, verbose))
|
||||||
{
|
{
|
||||||
/* Snip out this entry from the chain. */
|
/* Snip out this entry from the chain. */
|
||||||
*current_ptr = (*current_ptr)->archive_next;
|
*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. */
|
/* Add to the end of the archive. */
|
||||||
after_bfd = get_pos_bfd (&arch->archive_next, pos_end, NULL);
|
after_bfd = get_pos_bfd (&arch->archive_next, pos_end, NULL);
|
||||||
|
|
||||||
if (ar_emul_append (after_bfd, *files_to_move, verbose,
|
if (ar_emul_append (after_bfd, *files_to_move, plugin_target,
|
||||||
make_thin_archive))
|
verbose, make_thin_archive))
|
||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
|
|
||||||
next_file:;
|
next_file:;
|
||||||
|
@ -39,12 +39,12 @@ ar_emul_default_usage (FILE *fp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bfd_boolean
|
bfd_boolean
|
||||||
ar_emul_append (bfd **after_bfd, char *file_name, bfd_boolean verbose,
|
ar_emul_append (bfd **after_bfd, char *file_name, const char *target,
|
||||||
bfd_boolean flatten)
|
bfd_boolean verbose, bfd_boolean flatten)
|
||||||
{
|
{
|
||||||
if (bin_dummy_emulation.ar_append)
|
if (bin_dummy_emulation.ar_append)
|
||||||
return bin_dummy_emulation.ar_append (after_bfd, file_name, verbose,
|
return bin_dummy_emulation.ar_append (after_bfd, file_name, target,
|
||||||
flatten);
|
verbose, flatten);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -84,32 +84,35 @@ do_ar_emul_default_append (bfd **after_bfd, bfd *new_bfd,
|
|||||||
|
|
||||||
bfd_boolean
|
bfd_boolean
|
||||||
ar_emul_default_append (bfd **after_bfd, char *file_name,
|
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;
|
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);
|
AR_EMUL_ELEMENT_CHECK (new_bfd, file_name);
|
||||||
return do_ar_emul_default_append (after_bfd, new_bfd, verbose, flatten);
|
return do_ar_emul_default_append (after_bfd, new_bfd, verbose, flatten);
|
||||||
}
|
}
|
||||||
|
|
||||||
bfd_boolean
|
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)
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bfd_boolean
|
bfd_boolean
|
||||||
ar_emul_default_replace (bfd **after_bfd, char *file_name,
|
ar_emul_default_replace (bfd **after_bfd, char *file_name,
|
||||||
bfd_boolean verbose)
|
const char *target, bfd_boolean verbose)
|
||||||
{
|
{
|
||||||
bfd *temp;
|
bfd *temp;
|
||||||
|
|
||||||
temp = *after_bfd;
|
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_ELEMENT_CHECK (*after_bfd, file_name);
|
||||||
AR_EMUL_REPLACE_PRINT_VERBOSE (verbose, file_name);
|
AR_EMUL_REPLACE_PRINT_VERBOSE (verbose, file_name);
|
||||||
|
@ -28,11 +28,14 @@
|
|||||||
|
|
||||||
extern void ar_emul_usage (FILE *);
|
extern void ar_emul_usage (FILE *);
|
||||||
extern void ar_emul_default_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_append (bfd **, char *, const char *,
|
||||||
extern bfd_boolean ar_emul_default_append (bfd **, char *, bfd_boolean,
|
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);
|
bfd_boolean);
|
||||||
extern bfd_boolean ar_emul_replace (bfd **, char *, bfd_boolean);
|
extern bfd_boolean ar_emul_default_replace (bfd **, char *,
|
||||||
extern bfd_boolean ar_emul_default_replace (bfd **, char *, bfd_boolean);
|
const char *, bfd_boolean);
|
||||||
extern bfd_boolean ar_emul_parse_arg (char *);
|
extern bfd_boolean ar_emul_parse_arg (char *);
|
||||||
extern bfd_boolean ar_emul_default_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. */
|
/* Print out the extra options. */
|
||||||
void (* ar_usage) (FILE *fp);
|
void (* ar_usage) (FILE *fp);
|
||||||
bfd_boolean (* ar_append) (bfd **, char *, bfd_boolean, bfd_boolean);
|
bfd_boolean (* ar_append) (bfd **, char *, const char *, bfd_boolean,
|
||||||
bfd_boolean (* ar_replace) (bfd **, char *, bfd_boolean);
|
bfd_boolean);
|
||||||
|
bfd_boolean (* ar_replace) (bfd **, char *, const char *, bfd_boolean);
|
||||||
bfd_boolean (* ar_parse_arg) (char *);
|
bfd_boolean (* ar_parse_arg) (char *);
|
||||||
}
|
}
|
||||||
bin_emulation_xfer_type;
|
bin_emulation_xfer_type;
|
||||||
|
Reference in New Issue
Block a user