From dbda9fe8a210d33b08c1674edb956b475f31214a Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 26 May 2009 14:12:03 +0000 Subject: * 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. --- binutils/ar.c | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) (limited to 'binutils/ar.c') diff --git a/binutils/ar.c b/binutils/ar.c index 73ab1d46f0..d28419f4f1 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 #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 ] [-]{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 [ - read options from \n")); - +#if BFD_SUPPORTS_PLUGINS + fprintf (s, _(" optional:\n")); + fprintf (s, _(" --plugin

- 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\ - @ Read options from \n\ - -t Update the archive's symbol map timestamp\n\ + @ Read options from \n" +#if BFD_SUPPORTS_PLUGINS +" --plugin 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 -- cgit v1.2.1