Patchwork PATCH RFA: plugin: Don't use -pass-through for gold >= 1.11

login
register
mail settings
Submitter Ian Taylor
Date Jan. 24, 2011, 10:36 p.m.
Message ID <mcrfwsi6i9w.fsf@google.com>
Download mbox | patch
Permalink /patch/80283/
State New
Headers show

Comments

Ian Taylor - Jan. 24, 2011, 10:36 p.m.
With the patches I just committed to gold, it is no longer necessary for
the plugin to honor the -pass-through option when using gold 1.11 or
later.  This patch implements that in the LTO plugin.

Background: the plugin -pass-through option exists to tell the linker to
re-search archives such as libc.a and libgcc.a in case the LTO pass of
gcc added some new function references, not previously seen, due to
optimizations.  I just changed gold so that when using a plugin it will
automatically re-search any previous archives when a file added by a
plugin introduces new undefined references.  So the plugin's
-pass-through option is no longer necessary when using this version of
gold.

Bootstrapped and ran lto.exp tests on x86_64-unknown-linux-gnu.

OK for mainline?

Ian


2011-01-24  Ian Lance Taylor  <iant@google.com>

	* lto-plugin.c (gold_version): New static variable.
	(all_symbols_read_handler): Don't check pass_through_items if
	using gold 1.11 or later.
	(onload): Set gold_version if we see LDPT_GOLD_VERSION.
Richard Guenther - Jan. 25, 2011, 12:06 p.m.
On Mon, Jan 24, 2011 at 11:36 PM, Ian Lance Taylor <iant@google.com> wrote:
> With the patches I just committed to gold, it is no longer necessary for
> the plugin to honor the -pass-through option when using gold 1.11 or
> later.  This patch implements that in the LTO plugin.
>
> Background: the plugin -pass-through option exists to tell the linker to
> re-search archives such as libc.a and libgcc.a in case the LTO pass of
> gcc added some new function references, not previously seen, due to
> optimizations.  I just changed gold so that when using a plugin it will
> automatically re-search any previous archives when a file added by a
> plugin introduces new undefined references.  So the plugin's
> -pass-through option is no longer necessary when using this version of
> gold.
>
> Bootstrapped and ran lto.exp tests on x86_64-unknown-linux-gnu.
>
> OK for mainline?

Ok.

Thanks,
Richard.

> Ian
>
>
> 2011-01-24  Ian Lance Taylor  <iant@google.com>
>
>        * lto-plugin.c (gold_version): New static variable.
>        (all_symbols_read_handler): Don't check pass_through_items if
>        using gold 1.11 or later.
>        (onload): Set gold_version if we see LDPT_GOLD_VERSION.
>
>
>

Patch

Index: lto-plugin.c
===================================================================
--- lto-plugin.c	(revision 169182)
+++ lto-plugin.c	(working copy)
@@ -152,6 +152,10 @@  static char debug;
 static char nop;
 static char *resolution_file = NULL;
 
+/* The version of gold being used, or -1 if not gold.  The number is
+   MAJOR * 100 + MINOR.  */
+static int gold_version = -1;
+
 /* Not used by default, but can be overridden at runtime
    by using -plugin-opt=-sym-style={none,win32,underscore|uscore}
    (in fact, only first letter of style arg is checked.)  */
@@ -622,7 +626,8 @@  all_symbols_read_handler (void)
 
   free (lto_argv);
 
-  if (pass_through_items)
+  /* --pass-through is not needed when using gold 1.11 or later.  */
+  if (pass_through_items && gold_version < 111)
     {
       unsigned int i;
       for (i = 0; i < num_pass_through_items; i++)
@@ -998,6 +1003,9 @@  onload (struct ld_plugin_tv *tv)
 	case LDPT_OPTION:
 	  process_option (p->tv_u.tv_string);
 	  break;
+	case LDPT_GOLD_VERSION:
+	  gold_version = p->tv_u.tv_val;
+	  break;
 	default:
 	  break;
 	}