Blame SOURCES/gcc8-rh1670535.patch

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