From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12027 invoked by alias); 2 Mar 2011 19:56:00 -0000 Received: (qmail 12017 invoked by uid 22791); 2 Mar 2011 19:55:58 -0000 X-SWARE-Spam-Status: No, hits=-4.4 required=5.0 tests=AWL,BAYES_00,NO_DNS_FOR_FROM,RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mga01.intel.com (HELO mga01.intel.com) (192.55.52.88) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 02 Mar 2011 19:55:55 +0000 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 02 Mar 2011 11:55:53 -0800 X-ExtLoop1: 1 Received: from gnu-6.sc.intel.com ([10.3.194.135]) by fmsmga001.fm.intel.com with ESMTP; 02 Mar 2011 11:55:53 -0800 Received: by gnu-6.sc.intel.com (Postfix, from userid 500) id A07FF180958; Wed, 2 Mar 2011 11:55:53 -0800 (PST) Date: Wed, 02 Mar 2011 19:56:00 -0000 From: "H.J. Lu" To: binutils@sourceware.org Subject: PATCH: Report plugin symbol status Message-ID: <20110302195553.GA27754@intel.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2011-03/txt/msg00030.txt.bz2 Hi, This patch reports plugin symbol status for --verbose. It can be used to debug LTO plugin symbol issues. OK for trunk? Thanks. H.J. --- diff --git a/ld/ChangeLog.lto-mixed b/ld/ChangeLog.lto-mixed index cbc0733..01c1791 100644 --- a/ld/ChangeLog.lto-mixed +++ b/ld/ChangeLog.lto-mixed @@ -1,3 +1,14 @@ +2011-03-02 H.J. Lu + + * lexsup.c (parse_args): Set report_plugin_symbols to TRUE + for --verbose. + + * plugin.c (report_plugin_symbols): New. + (get_symbols): Report plugin symbols if report_plugin_symbols + is TRUE. + + * plugin.h (report_plugin_symbols): New. + 2011-02-01 H.J. Lu PR ld/12439 diff --git a/ld/lexsup.c b/ld/lexsup.c index 4baef3c..176b39e 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c @@ -1336,6 +1336,7 @@ parse_args (unsigned argc, char **argv) ldversion (1); version_printed = TRUE; trace_file_tries = TRUE; + report_plugin_symbols = TRUE; overflow_cutoff_limit = -2; break; case 'v': diff --git a/ld/plugin.c b/ld/plugin.c index 40acbdb..ab9c339 100644 --- a/ld/plugin.c +++ b/ld/plugin.c @@ -36,6 +36,9 @@ #include #endif +/* Trace plugin symbols. */ +bfd_boolean report_plugin_symbols; + /* Stores a single argument passed to a plugin. */ typedef struct plugin_arg { @@ -460,7 +463,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. */ @@ -468,7 +471,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 @@ -513,7 +516,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 @@ -526,13 +529,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); + +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..5f11cf2 100644 --- a/ld/plugin.h +++ b/ld/plugin.h @@ -21,6 +21,8 @@ #ifndef GLD_PLUGIN_H #define GLD_PLUGIN_H +/* Trace 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. */