Line 0
Link Here
|
|
|
1 |
commit 4eea76dbfc871614e116961b048d9aa38eee66ea |
2 |
Author: law <law@138bc75d-0d04-0410-961f-82ee72b054a4> |
3 |
Date: Thu Nov 8 22:05:27 2018 +0000 |
4 |
|
5 |
* collect2.c (linker_select): Add USE_LLD_LD. |
6 |
(ld_suffixes): Add ld.lld. |
7 |
(main): Handle -fuse-ld=lld. |
8 |
* common.opt (-fuse-ld=lld): New option. |
9 |
* doc/invoke.texi (-fuse-ld=lld): Document. |
10 |
* opts.c (common_handle_option): Handle OPT_fuse_ld_lld. |
11 |
|
12 |
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@265940 138bc75d-0d04-0410-961f-82ee72b054a4 |
13 |
|
14 |
diff --git a/gcc/collect2.c b/gcc/collect2.c |
15 |
index a96af137a44..6463ff7b645 100644 |
16 |
--- gcc/collect2.c |
17 |
+++ gcc/collect2.c |
18 |
@@ -831,6 +831,7 @@ main (int argc, char **argv) |
19 |
USE_PLUGIN_LD, |
20 |
USE_GOLD_LD, |
21 |
USE_BFD_LD, |
22 |
+ USE_LLD_LD, |
23 |
USE_LD_MAX |
24 |
} selected_linker = USE_DEFAULT_LD; |
25 |
static const char *const ld_suffixes[USE_LD_MAX] = |
26 |
@@ -838,7 +839,8 @@ main (int argc, char **argv) |
27 |
"ld", |
28 |
PLUGIN_LD_SUFFIX, |
29 |
"ld.gold", |
30 |
- "ld.bfd" |
31 |
+ "ld.bfd", |
32 |
+ "ld.lld" |
33 |
}; |
34 |
static const char *const real_ld_suffix = "real-ld"; |
35 |
static const char *const collect_ld_suffix = "collect-ld"; |
36 |
@@ -1007,6 +1009,8 @@ main (int argc, char **argv) |
37 |
selected_linker = USE_BFD_LD; |
38 |
else if (strcmp (argv[i], "-fuse-ld=gold") == 0) |
39 |
selected_linker = USE_GOLD_LD; |
40 |
+ else if (strcmp (argv[i], "-fuse-ld=lld") == 0) |
41 |
+ selected_linker = USE_LLD_LD; |
42 |
|
43 |
#ifdef COLLECT_EXPORT_LIST |
44 |
/* These flags are position independent, although their order |
45 |
@@ -1096,7 +1100,8 @@ main (int argc, char **argv) |
46 |
/* Maybe we know the right file to use (if not cross). */ |
47 |
ld_file_name = 0; |
48 |
#ifdef DEFAULT_LINKER |
49 |
- if (selected_linker == USE_BFD_LD || selected_linker == USE_GOLD_LD) |
50 |
+ if (selected_linker == USE_BFD_LD || selected_linker == USE_GOLD_LD || |
51 |
+ selected_linker == USE_LLD_LD) |
52 |
{ |
53 |
char *linker_name; |
54 |
# ifdef HOST_EXECUTABLE_SUFFIX |
55 |
@@ -1315,7 +1320,7 @@ main (int argc, char **argv) |
56 |
else if (!use_collect_ld |
57 |
&& strncmp (arg, "-fuse-ld=", 9) == 0) |
58 |
{ |
59 |
- /* Do not pass -fuse-ld={bfd|gold} to the linker. */ |
60 |
+ /* Do not pass -fuse-ld={bfd|gold|lld} to the linker. */ |
61 |
ld1--; |
62 |
ld2--; |
63 |
} |
64 |
diff --git a/gcc/common.opt b/gcc/common.opt |
65 |
index 5a5d33205a4..99489fbd553 100644 |
66 |
--- gcc/common.opt |
67 |
+++ gcc/common.opt |
68 |
@@ -2732,6 +2732,10 @@ fuse-ld=gold |
69 |
Common Driver Negative(fuse-ld=bfd) |
70 |
Use the gold linker instead of the default linker. |
71 |
|
72 |
+fuse-ld=lld |
73 |
+Common Driver Negative(fuse-ld=lld) |
74 |
+Use the lld LLVM linker instead of the default linker. |
75 |
+ |
76 |
fuse-linker-plugin |
77 |
Common Undocumented Var(flag_use_linker_plugin) |
78 |
|
79 |
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi |
80 |
index e0a770491b6..8762f3f7bc3 100644 |
81 |
--- gcc/doc/invoke.texi |
82 |
+++ gcc/doc/invoke.texi |
83 |
@@ -12610,6 +12610,10 @@ Use the @command{bfd} linker instead of the default linker. |
84 |
@opindex fuse-ld=gold |
85 |
Use the @command{gold} linker instead of the default linker. |
86 |
|
87 |
+@item -fuse-ld=lld |
88 |
+@opindex fuse-ld=lld |
89 |
+Use the LLVM @command{lld} linker instead of the default linker. |
90 |
+ |
91 |
@cindex Libraries |
92 |
@item -l@var{library} |
93 |
@itemx -l @var{library} |
94 |
diff --git a/gcc/opts.c b/gcc/opts.c |
95 |
index 34c283dd765..f094f5f1251 100644 |
96 |
--- gcc/opts.c |
97 |
+++ gcc/opts.c |
98 |
@@ -2557,6 +2557,7 @@ common_handle_option (struct gcc_options *opts, |
99 |
|
100 |
case OPT_fuse_ld_bfd: |
101 |
case OPT_fuse_ld_gold: |
102 |
+ case OPT_fuse_ld_lld: |
103 |
case OPT_fuse_linker_plugin: |
104 |
/* No-op. Used by the driver and passed to us because it starts with f.*/ |
105 |
break; |