Blame SOURCES/gcc8-rh1670535.patch

f56e54
2018-11-08  Roman Geissler  <roman.geissler@amadeus.com>
f56e54
f56e54
	* collect2.c (linker_select):  Add USE_LLD_LD.
f56e54
	(ld_suffixes): Add ld.lld.
f56e54
	(main): Handle -fuse-ld=lld.
f56e54
	* common.opt (-fuse-ld=lld): New option.
f56e54
	* doc/invoke.texi (-fuse-ld=lld): Document.
f56e54
	* opts.c (common_handle_option): Handle OPT_fuse_ld_lld.
f56e54
	
f56e54
--- gcc/collect2.c
f56e54
+++ gcc/collect2.c
f56e54
@@ -831,6 +831,7 @@ main (int argc, char **argv)
f56e54
       USE_PLUGIN_LD,
f56e54
       USE_GOLD_LD,
f56e54
       USE_BFD_LD,
f56e54
+      USE_LLD_LD,
f56e54
       USE_LD_MAX
f56e54
     } selected_linker = USE_DEFAULT_LD;
f56e54
   static const char *const ld_suffixes[USE_LD_MAX] =
f56e54
@@ -838,7 +839,8 @@ main (int argc, char **argv)
f56e54
       "ld",
f56e54
       PLUGIN_LD_SUFFIX,
f56e54
       "ld.gold",
f56e54
-      "ld.bfd"
f56e54
+      "ld.bfd",
f56e54
+      "ld.lld"
f56e54
     };
f56e54
   static const char *const real_ld_suffix = "real-ld";
f56e54
   static const char *const collect_ld_suffix = "collect-ld";
f56e54
@@ -1007,6 +1009,8 @@ main (int argc, char **argv)
f56e54
 	  selected_linker = USE_BFD_LD;
f56e54
 	else if (strcmp (argv[i], "-fuse-ld=gold") == 0)
f56e54
 	  selected_linker = USE_GOLD_LD;
f56e54
+  else if (strcmp (argv[i], "-fuse-ld=lld") == 0)
f56e54
+    selected_linker = USE_LLD_LD;
f56e54
 
f56e54
 #ifdef COLLECT_EXPORT_LIST
f56e54
 	/* These flags are position independent, although their order
f56e54
@@ -1096,7 +1100,8 @@ main (int argc, char **argv)
f56e54
   /* Maybe we know the right file to use (if not cross).  */
f56e54
   ld_file_name = 0;
f56e54
 #ifdef DEFAULT_LINKER
f56e54
-  if (selected_linker == USE_BFD_LD || selected_linker == USE_GOLD_LD)
f56e54
+  if (selected_linker == USE_BFD_LD || selected_linker == USE_GOLD_LD ||
f56e54
+      selected_linker == USE_LLD_LD)
f56e54
     {
f56e54
       char *linker_name;
f56e54
 # ifdef HOST_EXECUTABLE_SUFFIX
f56e54
@@ -1315,7 +1320,7 @@ main (int argc, char **argv)
f56e54
 	      else if (!use_collect_ld
f56e54
 		       && strncmp (arg, "-fuse-ld=", 9) == 0)
f56e54
 		{
f56e54
-		  /* Do not pass -fuse-ld={bfd|gold} to the linker. */
f56e54
+		  /* Do not pass -fuse-ld={bfd|gold|lld} to the linker. */
f56e54
 		  ld1--;
f56e54
 		  ld2--;
f56e54
 		}
f56e54
--- gcc/common.opt
f56e54
+++ gcc/common.opt
f56e54
@@ -2732,6 +2732,10 @@ fuse-ld=gold
f56e54
 Common Driver Negative(fuse-ld=bfd)
f56e54
 Use the gold linker instead of the default linker.
f56e54
 
f56e54
+fuse-ld=lld
f56e54
+Common Driver Negative(fuse-ld=lld)
f56e54
+Use the lld LLVM linker instead of the default linker.
f56e54
+
f56e54
 fuse-linker-plugin
f56e54
 Common Undocumented Var(flag_use_linker_plugin)
f56e54
 
f56e54
--- gcc/doc/invoke.texi
f56e54
+++ gcc/doc/invoke.texi
f56e54
@@ -12610,6 +12610,10 @@ Use the @command{bfd} linker instead of the default linker.
f56e54
 @opindex fuse-ld=gold
f56e54
 Use the @command{gold} linker instead of the default linker.
f56e54
 
f56e54
+@item -fuse-ld=lld
f56e54
+@opindex fuse-ld=lld
f56e54
+Use the LLVM @command{lld} linker instead of the default linker.
f56e54
+
f56e54
 @cindex Libraries
f56e54
 @item -l@var{library}
f56e54
 @itemx -l @var{library}
f56e54
--- gcc/opts.c
f56e54
+++ gcc/opts.c
f56e54
@@ -2557,6 +2557,7 @@ common_handle_option (struct gcc_options *opts,
f56e54
 
f56e54
     case OPT_fuse_ld_bfd:
f56e54
     case OPT_fuse_ld_gold:
f56e54
+    case OPT_fuse_ld_lld:
f56e54
     case OPT_fuse_linker_plugin:
f56e54
       /* No-op. Used by the driver and passed to us because it starts with f.*/
f56e54
       break;