diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2011-03-04 23:44:01 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2011-03-04 23:44:01 +0000 |
commit | 1715a13cc2716b05ab6715f81c5d1f852675ed20 (patch) | |
tree | 75321a4f5b940b002179db047cf2dc0dfa9f90ed /ld | |
parent | 51dc551dc20e8447413408430af80e253f5e872f (diff) | |
download | gdb-1715a13cc2716b05ab6715f81c5d1f852675ed20.zip gdb-1715a13cc2716b05ab6715f81c5d1f852675ed20.tar.gz gdb-1715a13cc2716b05ab6715f81c5d1f852675ed20.tar.bz2 |
Report plugin symbols for --verbose=N.
2011-03-04 H.J. Lu <hongjiu.lu@intel.com>
* ld.texinfo: Document --verbose[=NUMBER].
* lexsup.c (ld_options): Update --verbose.
(parse_args): Set report_plugin_symbols.
* plugin.c (report_plugin_symbols): New.
(get_symbols): Report plugin symbols if report_plugin_symbols
is TRUE.
* plugin.h (report_plugin_symbols): New.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 13 | ||||
-rw-r--r-- | ld/ld.texinfo | 9 | ||||
-rw-r--r-- | ld/lexsup.c | 13 | ||||
-rw-r--r-- | ld/plugin.c | 22 | ||||
-rw-r--r-- | ld/plugin.h | 2 |
5 files changed, 46 insertions, 13 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 4f5f2c8..bdf4b01 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,16 @@ +2011-03-04 H.J. Lu <hongjiu.lu@intel.com> + + * ld.texinfo: Document --verbose[=NUMBER]. + + * lexsup.c (ld_options): Update --verbose. + (parse_args): Set report_plugin_symbols. + + * plugin.c (report_plugin_symbols): New. + (get_symbols): Report plugin symbols if report_plugin_symbols + is TRUE. + + * plugin.h (report_plugin_symbols): New. + 2011-03-01 H.J. Lu <hongjiu.lu@intel.com> PR ld/12529 diff --git a/ld/ld.texinfo b/ld/ld.texinfo index 9957d03..ed79923 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -1851,13 +1851,14 @@ Normally the linker will generate an error message for each reported unresolved symbol but the option @option{--warn-unresolved-symbols} can change this to a warning. -@kindex --verbose -@cindex verbose +@kindex --verbose[=@var{NUMBER}] +@cindex verbose[=@var{NUMBER}] @item --dll-verbose -@itemx --verbose +@itemx --verbose[=@var{NUMBER}] Display the version number for @command{ld} and list the linker emulations supported. Display which input files can and cannot be opened. Display -the linker script being used by the linker. +the linker script being used by the linker. If the optional @var{NUMBER} +argument > 1, plugin symbol status will also be displayed. @kindex --version-script=@var{version-scriptfile} @cindex version script, symbol versions diff --git a/ld/lexsup.c b/ld/lexsup.c index acb63fb..8cf96eb 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c @@ -560,8 +560,9 @@ static const struct ld_option ld_options[] = " ignore-all, report-all, ignore-in-object-files,\n" " ignore-in-shared-libs"), TWO_DASHES }, - { {"verbose", no_argument, NULL, OPTION_VERBOSE}, - '\0', NULL, N_("Output lots of information during link"), TWO_DASHES }, + { {"verbose", optional_argument, NULL, OPTION_VERBOSE}, + '\0', N_("[=NUMBER]"), + N_("Output lots of information during link"), TWO_DASHES }, { {"dll-verbose", no_argument, NULL, OPTION_VERBOSE}, /* Linux. */ '\0', NULL, NULL, NO_HELP }, { {"version-script", required_argument, NULL, OPTION_VERSION_SCRIPT }, @@ -1326,6 +1327,14 @@ parse_args (unsigned argc, char **argv) version_printed = TRUE; trace_file_tries = TRUE; overflow_cutoff_limit = -2; + if (optarg != NULL) + { + char *end; + int level = strtoul (optarg, &end, 0); + if (*end) + einfo (_("%P%F: invalid number `%s'\n"), optarg); + report_plugin_symbols = level > 1; + } break; case 'v': ldversion (0); diff --git a/ld/plugin.c b/ld/plugin.c index 7ac2cb8..a68aea3 100644 --- a/ld/plugin.c +++ b/ld/plugin.c @@ -36,6 +36,9 @@ #include <Windows.h> #endif +/* Report plugin symbols. */ +bfd_boolean report_plugin_symbols; + /* The suffix to append to the name of the real (claimed) object file when generating a dummy BFD to hold the IR symbols sent from the plugin. */ @@ -463,7 +466,7 @@ get_symbols (const void *handle, int nsyms, struct ld_plugin_symbol *syms) if (!blhe) { syms[n].resolution = LDPR_UNKNOWN; - continue; + goto report_symbol; } /* Determine resolution from blhe type and symbol's original type. */ @@ -471,7 +474,7 @@ get_symbols (const void *handle, int nsyms, struct ld_plugin_symbol *syms) || blhe->type == bfd_link_hash_undefweak) { syms[n].resolution = LDPR_UNDEF; - continue; + goto report_symbol; } if (blhe->type != bfd_link_hash_defined && blhe->type != bfd_link_hash_defweak @@ -516,7 +519,7 @@ get_symbols (const void *handle, int nsyms, struct ld_plugin_symbol *syms) syms[n].resolution = LDPR_RESOLVED_DYN; else syms[n].resolution = LDPR_RESOLVED_EXEC; - continue; + goto report_symbol; } /* Was originally def, or weakdef. Does it prevail? If the @@ -529,13 +532,18 @@ get_symbols (const void *handle, int nsyms, struct ld_plugin_symbol *syms) syms[n].resolution = (ironly ? LDPR_PREVAILING_DEF_IRONLY : LDPR_PREVAILING_DEF); - continue; + goto report_symbol; } /* Was originally def, weakdef, or common, but has been pre-empted. */ - syms[n].resolution = is_ir_dummy_bfd (owner_sec->owner) - ? LDPR_PREEMPTED_IR - : LDPR_PREEMPTED_REG; + syms[n].resolution = (is_ir_dummy_bfd (owner_sec->owner) + ? LDPR_PREEMPTED_IR + : LDPR_PREEMPTED_REG); + +report_symbol: + if (report_plugin_symbols) + einfo ("%P: %B: symbol `%s' definition: %d, resolution: %d\n", + abfd, syms[n].name, syms[n].def, syms[n].resolution); } return LDPS_OK; } diff --git a/ld/plugin.h b/ld/plugin.h index 5b340be..6ba8fa8 100644 --- a/ld/plugin.h +++ b/ld/plugin.h @@ -21,6 +21,8 @@ #ifndef GLD_PLUGIN_H #define GLD_PLUGIN_H +/* Report plugin symbols. */ +extern bfd_boolean report_plugin_symbols; /* This is the only forward declaration we need to avoid having to include the plugin-api.h header in order to use this file. */ |