aboutsummaryrefslogtreecommitdiff
path: root/binutils/ar.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2009-05-26 14:12:03 +0000
committerNick Clifton <nickc@redhat.com>2009-05-26 14:12:03 +0000
commitce3c775b8fa618c3002c7017de162f51d022960d (patch)
tree7dad759c178e50a24b83ef0fec8f5e79c9901042 /binutils/ar.c
parent00f3247a62aa73c2cd8f80d8d8614a89bc417301 (diff)
downloadgdb-ce3c775b8fa618c3002c7017de162f51d022960d.zip
gdb-ce3c775b8fa618c3002c7017de162f51d022960d.tar.gz
gdb-ce3c775b8fa618c3002c7017de162f51d022960d.tar.bz2
* Makefile.am: Run "make dep-am".
(AM_CPPFLAGS): New. (LIBDL): New. (ALL_MACHINES): Add cpu-plugin.lo. (ALL_MACHINES_CFILES): Add cpu-plugin.c. (BFD32_BACKENDS): Add plugin.lo. (BFD32_BACKENDS_CFILES): Add plugin.c. (libbfd_la_LIBADD): Add LIBDL * archures.c (bfd_architecture): Add bfd_arch_plugin. (bfd_plugin_arch): Declare. * bfd-in.h (BFD_SUPPORTS_PLUGINS): New. * bfd.c (bfd): Add plugin_data. * config.bfd: Handle the plugin target. * configure.in: Check for --enable-plugins. (LT_INIT): Use the dlopen option. * cpu-plugin.c: New. * plugin.c: New. * plugin.h: New. * targets.c (plugin_vec): Declare. (_bfd_target_vector): Add plugin_vec. * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * configure: Regenerate. * ar.c: Include plugin.h. (main): Handle the --plugin option. * nm.c: Include plugin.h. (OPTION_PLUGIN): New. (long_options): Add plugin. (main): Handle OPTION_PLUGIN. * NEWS: Mention the new feature. * doc/binutils: Documement the new command line options. * configure.in: Check for --enable-plugins. * configure: Regenerate.
Diffstat (limited to 'binutils/ar.c')
-rw-r--r--binutils/ar.c41
1 files changed, 35 insertions, 6 deletions
diff --git a/binutils/ar.c b/binutils/ar.c
index 73ab1d4..d28419f 100644
--- a/binutils/ar.c
+++ b/binutils/ar.c
@@ -1,6 +1,6 @@
/* ar.c - Archive modify and extract.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -37,6 +37,7 @@
#include "arsup.h"
#include "filenames.h"
#include "binemul.h"
+#include "plugin.h"
#include <sys/stat.h>
#ifdef __GO32___
@@ -230,8 +231,14 @@ usage (int help)
if (! is_ranlib)
{
/* xgettext:c-format */
- fprintf (s, _("Usage: %s [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...\n"),
- program_name);
+ const char * command_line =
+#if BFD_SUPPORTS_PLUGINS
+ _("Usage: %s [emulation options] [--plugin <name>] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...\n");
+#else
+ _("Usage: %s [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...\n");
+#endif
+ fprintf (s, command_line, program_name);
+
/* xgettext:c-format */
fprintf (s, _(" %s -M [<mri-script]\n"), program_name);
fprintf (s, _(" commands:\n"));
@@ -259,7 +266,10 @@ usage (int help)
fprintf (s, _(" [v] - be verbose\n"));
fprintf (s, _(" [V] - display the version number\n"));
fprintf (s, _(" @<file> - read options from <file>\n"));
-
+#if BFD_SUPPORTS_PLUGINS
+ fprintf (s, _(" optional:\n"));
+ fprintf (s, _(" --plugin <p> - load the specified plugin\n"));
+#endif
ar_emul_usage (s);
}
else
@@ -268,8 +278,11 @@ usage (int help)
fprintf (s, _("Usage: %s [options] archive\n"), program_name);
fprintf (s, _(" Generate an index to speed access to archives\n"));
fprintf (s, _(" The options are:\n\
- @<file> Read options from <file>\n\
- -t Update the archive's symbol map timestamp\n\
+ @<file> Read options from <file>\n"
+#if BFD_SUPPORTS_PLUGINS
+" --plugin <name> Load the specified plugin\n"
+#endif
+" -t Update the archive's symbol map timestamp\n\
-h --help Print this help message\n\
-v --version Print version information\n"));
}
@@ -480,6 +493,22 @@ main (int argc, char **argv)
arg_index = 1;
arg_ptr = argv[arg_index];
+ if (strcmp (arg_ptr, "--plugin") == 0)
+ {
+#if BFD_SUPPORTS_PLUGINS
+ if (argc < 4)
+ usage (1);
+
+ bfd_plugin_set_plugin (argv[2]);
+
+ arg_index += 2;
+ arg_ptr = argv[arg_index];
+#else
+ fprintf (stderr, _("sorry - this program has been built without plugin support\n"));
+ xexit (1);
+#endif
+ }
+
if (*arg_ptr == '-')
{
/* When the first option starts with '-' we support POSIX-compatible