diff options
author | Nick Clifton <nickc@redhat.com> | 2009-05-26 14:12:03 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2009-05-26 14:12:03 +0000 |
commit | ce3c775b8fa618c3002c7017de162f51d022960d (patch) | |
tree | 7dad759c178e50a24b83ef0fec8f5e79c9901042 /binutils | |
parent | 00f3247a62aa73c2cd8f80d8d8614a89bc417301 (diff) | |
download | gdb-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')
-rw-r--r-- | binutils/ChangeLog | 13 | ||||
-rw-r--r-- | binutils/NEWS | 3 | ||||
-rw-r--r-- | binutils/ar.c | 41 | ||||
-rwxr-xr-x | binutils/configure | 45 | ||||
-rw-r--r-- | binutils/configure.in | 13 | ||||
-rw-r--r-- | binutils/doc/binutils.texi | 18 | ||||
-rw-r--r-- | binutils/nm.c | 20 |
7 files changed, 125 insertions, 28 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index ff0e640..12ea1d1 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,16 @@ +2009-05-26 Rafael Avila de Espindola <espindola@google.com> + + * 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. + 2009-05-26 Alan Modra <amodra@bigpond.net.au> * dep-in.sed: Output one filename per line with all lines having diff --git a/binutils/NEWS b/binutils/NEWS index 02d27c4..7ce6d66 100644 --- a/binutils/NEWS +++ b/binutils/NEWS @@ -1,5 +1,8 @@ -*- text -*- +* The plugin target has been added to bfd. It can load the same shared objects + used by gold and uses them to provide basic support for new file formats. + * The verilog memory hex dump file format is now supported as an output format for objcopy. 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 diff --git a/binutils/configure b/binutils/configure index d646ab6..83ba316 100755 --- a/binutils/configure +++ b/binutils/configure @@ -1002,6 +1002,7 @@ Optional Features: --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors + --enable-plugins linker plugins (defaults no) --disable-largefile omit support for large files --enable-shared[=PKGS] build shared libraries [default=yes] @@ -4736,6 +4737,18 @@ _ACEOF +# Check whether --enable-plugins or --disable-plugins was given. +if test "${enable_plugins+set}" = set; then + enableval="$enable_plugins" + case "${enableval}" in + yes | "") plugins=yes ;; + no) plugins=no ;; + *) plugins=yes ;; + esac +else + plugins=no +fi; + case "${target}" in sparc-*-solaris*|i[3-7]86-*-solaris*) # See comment in bfd/configure.in for the reason for this test. @@ -4743,7 +4756,9 @@ case "${target}" in # configure script so that the utilities in this directory agree # on the size of structures used to describe files. if test "${target}" = "${host}" -a "$enable_largefile" != 'yes'; then - enable_largefile="no" + if test "$plugins" = "no"; then + enable_largefile="no" + fi fi ;; esac @@ -5518,13 +5533,13 @@ if test "${lt_cv_nm_interface+set}" = set; then else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:5521: $ac_compile\"" >&5) + (eval echo "\"\$as_me:5536: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:5524: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:5539: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:5527: output\"" >&5) + (eval echo "\"\$as_me:5542: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -6681,7 +6696,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 6684 "configure"' > conftest.$ac_ext + echo '#line 6699 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7987,11 +8002,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7990: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8005: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7994: \$? = $ac_status" >&5 + echo "$as_me:8009: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8326,11 +8341,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8329: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8344: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8333: \$? = $ac_status" >&5 + echo "$as_me:8348: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8431,11 +8446,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8434: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8449: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8438: \$? = $ac_status" >&5 + echo "$as_me:8453: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8486,11 +8501,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8489: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8504: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8493: \$? = $ac_status" >&5 + echo "$as_me:8508: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -11298,7 +11313,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11301 "configure" +#line 11316 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11394,7 +11409,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11397 "configure" +#line 11412 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/binutils/configure.in b/binutils/configure.in index e35b169..3fdb349 100644 --- a/binutils/configure.in +++ b/binutils/configure.in @@ -16,6 +16,15 @@ AC_PROG_CC AC_GNU_SOURCE AC_USE_SYSTEM_EXTENSIONS +AC_ARG_ENABLE([plugins], +AS_HELP_STRING([--enable-plugins], [linker plugins (defaults no)]), +[case "${enableval}" in + yes | "") plugins=yes ;; + no) plugins=no ;; + *) plugins=yes ;; + esac], +[plugins=no]) + case "${target}" in changequote(,)dnl sparc-*-solaris*|i[3-7]86-*-solaris*) @@ -25,7 +34,9 @@ changequote([,])dnl # configure script so that the utilities in this directory agree # on the size of structures used to describe files. if test "${target}" = "${host}" -a "$enable_largefile" != 'yes'; then - enable_largefile="no" + if test "$plugins" = "no"; then + enable_largefile="no" + fi fi ;; esac diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi index cdec81f..39a3806 100644 --- a/binutils/doc/binutils.texi +++ b/binutils/doc/binutils.texi @@ -170,7 +170,7 @@ in the section entitled ``GNU Free Documentation License''. @c man title ar create, modify, and extract from archives @smallexample -ar [-]@var{p}[@var{mod} [@var{relpos}] [@var{count}]] @var{archive} [@var{member}@dots{}] +ar [@option{--plugin} @var{name}] [-]@var{p}[@var{mod} [@var{relpos}] [@var{count}]] @var{archive} [@var{member}@dots{}] ar -M [ <mri-script ] @end smallexample @@ -245,7 +245,7 @@ program. @smallexample @c man begin SYNOPSIS ar -ar [@option{-X32_64}] [@option{-}]@var{p}[@var{mod} [@var{relpos}] [@var{count}]] @var{archive} [@var{member}@dots{}] +ar [@option{--plugin} @var{name}] [@option{-X32_64}] [@option{-}]@var{p}[@var{mod} [@var{relpos}] [@var{count}]] @var{archive} [@var{member}@dots{}] @c man end @end smallexample @@ -488,6 +488,11 @@ default for @sc{gnu} @command{ar}. @command{ar} does not support any of the oth @samp{-X} options; in particular, it does not support @option{-X32} which is the default for AIX @command{ar}. +The optional command line switch @option{--plugin} @var{name} causes +@command{ar} to load the plugin called @var{name} which adds support +for more file formats. This option is only available if the toolchain +has been built with plugin support enabled. + @c man end @ignore @@ -677,7 +682,8 @@ The @sc{gnu} linker @command{ld} is now described in a separate manual. @smallexample @c man begin SYNOPSIS nm -nm [@option{-a}|@option{--debug-syms}] [@option{-g}|@option{--extern-only}] +nm [@option{-a}|@option{--debug-syms}] + [@option{-g}|@option{--extern-only}][@option{--plugin} @var{name}] [@option{-B}] [@option{-C}|@option{--demangle}[=@var{style}]] [@option{-D}|@option{--dynamic}] [@option{-S}|@option{--print-size}] [@option{-s}|@option{--print-armap}] [@option{-A}|@option{-o}|@option{--print-file-name}][@option{--special-syms}] @@ -859,6 +865,12 @@ either upper or lower case. @cindex external symbols Display only external symbols. +@item --plugin @var{name} +@cindex load plugin +Load the plugin called @var{name} to add support for extra target +types. This option is only available if the toolchain has been built +with plugin support enabled. + @item -l @itemx --line-numbers @cindex symbol line numbers diff --git a/binutils/nm.c b/binutils/nm.c index e11568a..b03d1b6 100644 --- a/binutils/nm.c +++ b/binutils/nm.c @@ -1,6 +1,6 @@ /* nm.c -- Describe symbol table of a rel file. Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2007 + 2001, 2002, 2003, 2004, 2005, 2007, 2009 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -31,6 +31,7 @@ #include "elf-bfd.h" #include "elf/common.h" #include "bucomm.h" +#include "plugin.h" /* When sorting by size, we use this structure to hold the size and a pointer to the minisymbol. */ @@ -178,6 +179,7 @@ static bfd *lineno_cache_bfd; static bfd *lineno_cache_rel_bfd; #define OPTION_TARGET 200 +#define OPTION_PLUGIN 201 static struct option long_options[] = { @@ -192,6 +194,7 @@ static struct option long_options[] = {"no-demangle", no_argument, &do_demangle, 0}, {"no-sort", no_argument, &no_sort, 1}, {"numeric-sort", no_argument, &sort_numerically, 1}, + {"plugin", required_argument, 0, OPTION_PLUGIN}, {"portability", no_argument, 0, 'P'}, {"print-armap", no_argument, &print_armap, 1}, {"print-file-name", no_argument, 0, 'o'}, @@ -237,8 +240,11 @@ usage (FILE *stream, int status) -o Same as -A\n\ -p, --no-sort Do not sort the symbols\n\ -P, --portability Same as --format=posix\n\ - -r, --reverse-sort Reverse the sense of the sort\n\ - -S, --print-size Print size of defined symbols\n\ + -r, --reverse-sort Reverse the sense of the sort\n" +#if BFD_SUPPORTS_PLUGINS +" --plugin NAME Load the specified plugin\n" +#endif +" -S, --print-size Print size of defined symbols\n\ -s, --print-armap Include index for symbols from archive members\n\ --size-sort Sort symbols by size\n\ --special-syms Include special symbols in the output\n\ @@ -1608,6 +1614,14 @@ main (int argc, char **argv) target = optarg; break; + case OPTION_PLUGIN: /* --plugin */ +#if BFD_SUPPORTS_PLUGINS + bfd_plugin_set_plugin (optarg); +#else + fatal (_("sorry - this program has been built without plugin support\n")); +#endif + break; + case 0: /* A long option that just sets a flag. */ break; |