Sophie

Sophie

distrib > Mandriva > cooker > i586 > media > main-release-src > by-pkgid > fdc679d57ec35811c1a23f980c836273 > files > 9

gcc-4.7.3_2012.10-3.1.src.rpm

--- gcc-linaro-4.7-2012.06/gcc/collect2.c.linker-selection~	2012-06-12 01:29:29.000000000 +0200
+++ gcc-linaro-4.7-2012.06/gcc/collect2.c	2012-07-01 19:40:55.720773888 +0200
@@ -1021,6 +1021,8 @@ int
 main (int argc, char **argv)
 {
   static const char *const ld_suffix	= "ld";
+  static const char *const gold_suffix	= "ld.gold";
+  static const char *const bfd_ld_suffix	= "ld.bfd";
   static const char *const plugin_ld_suffix = PLUGIN_LD;
   static const char *const real_ld_suffix = "real-ld";
   static const char *const collect_ld_suffix = "collect-ld";
@@ -1040,6 +1042,10 @@ main (int argc, char **argv)
 
   const char *const full_ld_suffix =
     concat(target_machine, "-", ld_suffix, NULL);
+  const char *const full_gold_suffix =
+    concat(target_machine, "-", gold_suffix, NULL);
+  const char *const full_bfd_ld_suffix =
+    concat(target_machine, "-", bfd_ld_suffix, NULL);
   const char *const full_plugin_ld_suffix =
     concat(target_machine, "-", plugin_ld_suffix, NULL);
   const char *const full_nm_suffix =
@@ -1056,6 +1062,8 @@ main (int argc, char **argv)
     concat (target_machine, "-", gstrip_suffix, NULL);
 #else
   const char *const full_ld_suffix	= ld_suffix;
+  const char *const full_gold_suffix	= gold_suffix;
+  const char *const full_bfd_ld_suffix	= bfd_ld_suffix;
   const char *const full_plugin_ld_suffix = plugin_ld_suffix;
   const char *const full_nm_suffix	= nm_suffix;
   const char *const full_gnm_suffix	= gnm_suffix;
@@ -1077,7 +1085,13 @@ main (int argc, char **argv)
   const char **c_ptr;
   char **ld1_argv;
   const char **ld1;
-  bool use_plugin = false;
+  enum linker_select
+  {
+    DEF_LINKER,
+    PLUGIN_LINKER,
+    GOLD_LINKER,
+    BFD_LINKER
+  } selected_linker = DEF_LINKER;
 
   /* The kinds of symbols we will have to consider when scanning the
      outcome of a first pass link.  This is ALL to start with, then might
@@ -1168,15 +1182,19 @@ main (int argc, char **argv)
         else if (! strcmp (argv[i], "-flto-partition=none"))
 	  no_partition = true;
         else if ((! strncmp (argv[i], "-flto=", 6)
-		  || ! strcmp (argv[i], "-flto")) && ! use_plugin)
+		  || ! strcmp (argv[i], "-flto")) && selected_linker != PLUGIN_LINKER)
 	  lto_mode = LTO_MODE_WHOPR;
 	else if (!strncmp (argv[i], "-fno-lto", 8))
 	  lto_mode = LTO_MODE_NONE;
         else if (! strcmp (argv[i], "-plugin"))
 	  {
-	    use_plugin = true;
+	    selected_linker = PLUGIN_LINKER;
 	    lto_mode = LTO_MODE_NONE;
 	  }
+        else if (! strcmp (argv[i], "-use-gold"))
+          selected_linker = GOLD_LINKER;
+        else if (! strcmp (argv[i], "-use-ld"))
+          selected_linker = BFD_LINKER;
 #ifdef COLLECT_EXPORT_LIST
 	/* since -brtl, -bexport, -b64 are not position dependent
 	   also check for them here */
@@ -1276,17 +1294,94 @@ main (int argc, char **argv)
   /* Search the compiler directories for `ld'.  We have protection against
      recursive calls in find_a_file.  */
   if (ld_file_name == 0)
-    ld_file_name = find_a_file (&cpath,
-				use_plugin
-				? plugin_ld_suffix
-				: ld_suffix);
+    {
+      switch (selected_linker)
+        {
+        default:
+        case DEF_LINKER:
+          ld_file_name = find_a_file (&cpath, ld_suffix);
+          break;
+        case PLUGIN_LINKER:
+          ld_file_name = find_a_file (&cpath, plugin_ld_suffix);
+          break;
+        case GOLD_LINKER:
+          ld_file_name = find_a_file (&cpath, gold_suffix);
+          break;
+        case BFD_LINKER:
+          ld_file_name = find_a_file (&cpath, bfd_ld_suffix);
+          break;
+        }
+    }
   /* Search the ordinary system bin directories
      for `ld' (if native linking) or `TARGET-ld' (if cross).  */
   if (ld_file_name == 0)
-    ld_file_name = find_a_file (&path,
-				use_plugin
-				? full_plugin_ld_suffix
-				: full_ld_suffix);
+    {
+      switch (selected_linker)
+        {
+        default:
+        case DEF_LINKER:
+          ld_file_name = find_a_file (&path, full_ld_suffix);
+          break;
+        case PLUGIN_LINKER:
+          ld_file_name = find_a_file (&path, full_plugin_ld_suffix);
+          break;
+        case GOLD_LINKER:
+          ld_file_name = find_a_file (&path, full_gold_suffix);
+          break;
+        case BFD_LINKER:
+          ld_file_name = find_a_file (&path, full_bfd_ld_suffix);
+          break;
+        }
+    }
+
+  /* If we failed to find a plugin-capable linker, try the ordinary one. */
+  if (ld_file_name == NULL && selected_linker == PLUGIN_LINKER)
+    ld_file_name = find_a_file (&cpath, ld_suffix);
+
+  if ((vflag || debug) && ld_file_name == NULL)
+    {
+      struct prefix_list * p;
+      const char * s;
+
+      notice ("collect2: warning: unable to find linker.\n");
+
+#ifdef DEFAULT_LINKER
+      notice (" Searched for this absolute executable:\n");
+      notice (" %s\n", DEFAULT_LINKER);
+#endif
+
+      notice (" Searched in these paths:\n");
+      for (p = cpath.plist ; p != NULL; p = p->next)
+        notice ( "  %s\n", p->prefix);
+      notice ( " For these executables:\n");
+      notice ( "  %s\n", real_ld_suffix);
+      notice ( "  %s\n", collect_ld_suffix);
+      switch(selected_linker)
+        {
+        default:
+        case DEF_LINKER:	s = ld_suffix; break;
+        case PLUGIN_LINKER:	s = plugin_ld_suffix; break;
+        case GOLD_LINKER:	s = gold_suffix; break;
+        case BFD_LINKER:	s = bfd_ld_suffix; break;
+	}
+      notice ( "  %s\n", s);
+      notice ( " And searched in these paths:\n");
+      for (p = path.plist; p != NULL; p = p->next)
+        notice ( "  %s\n", p->prefix);
+      notice ( " For these executables:\n");
+#ifdef REAL_LD_FILE_NAME
+      notice (" %s\n", REAL_LD_FILE_NAME);
+#endif
+      switch(selected_linker)
+        {
+        default:
+        case DEF_LINKER:	s = full_ld_suffix; break;
+        case PLUGIN_LINKER:	s = full_plugin_ld_suffix; break;
+        case GOLD_LINKER:	s = full_gold_suffix; break;
+        case BFD_LINKER:	s = full_bfd_ld_suffix; break;
+	}
+      notice ( "  %s\n", s);
+    }
 
 #ifdef REAL_NM_FILE_NAME
   nm_file_name = find_a_file (&path, REAL_NM_FILE_NAME);
--- gcc-linaro-4.7-2012.06/gcc/common.opt.linker-selection~	2012-06-12 01:29:29.000000000 +0200
+++ gcc-linaro-4.7-2012.06/gcc/common.opt	2012-07-01 19:40:55.720773888 +0200
@@ -2099,6 +2099,9 @@ funwind-tables
 Common Report Var(flag_unwind_tables) Optimization
 Just generate unwind tables for exception handling
 
+fuse-ld=
+Common Joined Undocumented
+
 fuse-linker-plugin
 Common Undocumented
 
--- gcc-linaro-4.7-2012.06/gcc/configure.ac.linker-selection~	2012-06-12 01:29:29.000000000 +0200
+++ gcc-linaro-4.7-2012.06/gcc/configure.ac	2012-07-01 19:40:55.988773889 +0200
@@ -2037,6 +2037,16 @@ case "$ORIGINAL_LD_FOR_TARGET" in
   *) AC_CONFIG_FILES(collect-ld:exec-tool.in, [chmod +x collect-ld]) ;;
 esac 
 
+if test "$ld_is_gold" = "yes"; then
+  ORIGINAL_GOLD_FOR_TARGET=$ORIGINAL_LD_FOR_TARGET
+  ORIGINAL_BFD_LD_FOR_TARGET=$ORIGINAL_LD_FOR_TARGET.bfd
+else
+  ORIGINAL_BFD_LD_FOR_TARGET=$ORIGINAL_LD_FOR_TARGET
+  ORIGINAL_GOLD_FOR_TARGET=$ORIGINAL_LD_FOR_TARGET.gold
+fi
+AC_SUBST(ORIGINAL_GOLD_FOR_TARGET)
+AC_SUBST(ORIGINAL_BFD_LD_FOR_TARGET)
+
 AC_MSG_CHECKING(what linker to use)
 if test "$gcc_cv_ld" = ../ld/ld-new$build_exeext \
    || test "$gcc_cv_ld" = ../gold/ld-new$build_exeext; then
--- gcc-linaro-4.7-2012.06/gcc/doc/invoke.texi.linker-selection~	2012-06-12 01:29:29.000000000 +0200
+++ gcc-linaro-4.7-2012.06/gcc/doc/invoke.texi	2012-07-01 19:40:55.990773889 +0200
@@ -415,7 +415,7 @@ Objective-C and Objective-C++ Dialects}.
 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
 -funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
 -fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb @gol
--fwhole-program -fwpa -fuse-linker-plugin @gol
+-fwhole-program -fwpa -fuse-linker-plugin -fuse-ld @gol
 --param @var{name}=@var{value}
 -O  -O0  -O1  -O2  -O3  -Os -Ofast}
 
@@ -7967,6 +7967,17 @@ GNU make.
 
 This option is disabled by default
 
+@item -fuse-ld=gold
+Use the @command{ld.gold} linker instead of the default linker.
+This option is only necessary if GCC has been configured with
+@option{--enable-gold=both} or @option{--enable-gold=both/ld}.
+
+@item -fuse-ld=bfd
+Use the @command{ld.bfd} linker instead of the default linker.
+This option is only necessary if GCC has been configured with
+@option{--enable-gold=both/gold}.
+
+
 @item -flto-partition=@var{alg}
 @opindex flto-partition
 Specify the partitioning algorithm used by the link-time optimizer.
--- gcc-linaro-4.7-2012.06/gcc/exec-tool.in.linker-selection~	2012-06-12 01:29:29.000000000 +0200
+++ gcc-linaro-4.7-2012.06/gcc/exec-tool.in	2012-07-01 19:40:55.990773889 +0200
@@ -21,11 +21,14 @@
 
 ORIGINAL_AS_FOR_TARGET="@ORIGINAL_AS_FOR_TARGET@"
 ORIGINAL_LD_FOR_TARGET="@ORIGINAL_LD_FOR_TARGET@"
+ORIGINAL_GOLD_FOR_TARGET="@ORIGINAL_GOLD_FOR_TARGET@"
+ORIGINAL_BFD_LD_FOR_TARGET="@ORIGINAL_BFD_LD_FOR_TARGET@"
 ORIGINAL_PLUGIN_LD_FOR_TARGET="@ORIGINAL_PLUGIN_LD_FOR_TARGET@"
 ORIGINAL_NM_FOR_TARGET="@ORIGINAL_NM_FOR_TARGET@"
 exeext=@host_exeext@
 fast_install=@enable_fast_install@
 objdir=@objdir@
+version="1.1"
 
 invoked=`basename "$0"`
 id=$invoked
@@ -36,15 +39,24 @@ case "$invoked" in
     dir=gas
     ;;
   collect-ld)
-    # when using a linker plugin, gcc will always pass '-plugin' as the
-    # first or second option to the linker.
-    if test x"$1" = "x-plugin" || test x"$2" = "x-plugin"; then
-      original=$ORIGINAL_PLUGIN_LD_FOR_TARGET
-    else
-      original=$ORIGINAL_LD_FOR_TARGET
-    fi
-    prog=ld-new$exeext
-    dir=ld
+    case " $* " in
+      *\ -use-gold\ * | *\ -use-ld.gold\ *)
+        original=$ORIGINAL_GOLD_FOR_TARGET
+        dir=gold
+        ;;
+      *\ -use-ld\ * | *\ -use-ld.bfd\ *)
+        original=$ORIGINAL_BFD_LD_FOR_TARGET
+        dir=ld
+        ;;
+      *\ -plugin\ *)
+        original=$ORIGINAL_PLUGIN_LD_FOR_TARGET
+        dir=ld
+        ;;
+      *)
+        original=$ORIGINAL_LD_FOR_TARGET
+        dir=ld
+        ;;
+    esac
     id=ld
     ;;
   nm)
--- gcc-linaro-4.7-2012.06/gcc/gcc.c.linker-selection~	2012-06-12 01:29:29.000000000 +0200
+++ gcc-linaro-4.7-2012.06/gcc/gcc.c	2012-07-01 19:43:25.171774623 +0200
@@ -671,6 +671,9 @@ proper position among the other output f
     LINK_PLUGIN_SPEC \
     "%{flto|flto=*:%<fcompare-debug*} \
     %{flto} %{flto=*} %l " LINK_PIE_SPEC \
+   "%{fuse-ld=gold:%{fuse-ld=bfd:%e-fuse-ld=gold and -fuse-ld=bfd may not be used together}} \
+    %{fuse-ld=gold:-use-gold} \
+    %{fuse-ld=bfd:-use-ld}" \
    "%X %{o*} %{e*} %{N} %{n} %{r}\
     %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}}\
     %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\
--- gcc-linaro-4.7-2012.06/gcc/opts.c.linker-selection~	2012-06-12 01:29:29.000000000 +0200
+++ gcc-linaro-4.7-2012.06/gcc/opts.c	2012-07-01 19:40:55.991773889 +0200
@@ -1735,8 +1735,9 @@ common_handle_option (struct gcc_options
       dc->max_errors = value;
       break;
 
+    case OPT_fuse_ld_:
     case OPT_fuse_linker_plugin:
-      /* No-op. Used by the driver and passed to us because it starts with f.*/
+      /* No-op. Used by the driver and passed to us because it starts with f. */
       break;
 
     case OPT_Wuninitialized: