summaryrefslogtreecommitdiff
path: root/debian/patches/gcc-fuse-ld-lld.diff
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/gcc-fuse-ld-lld.diff')
-rw-r--r--debian/patches/gcc-fuse-ld-lld.diff83
1 files changed, 83 insertions, 0 deletions
diff --git a/debian/patches/gcc-fuse-ld-lld.diff b/debian/patches/gcc-fuse-ld-lld.diff
new file mode 100644
index 0000000..1464267
--- /dev/null
+++ b/debian/patches/gcc-fuse-ld-lld.diff
@@ -0,0 +1,83 @@
+# DP: Allow to use lld with -fuse-ld=ld.lld
+
+Index: gcc/collect2.c
+===================================================================
+--- a/src/gcc/collect2.c (revision 246158)
++++ a/src/gcc/collect2.c (working copy)
+@@ -831,6 +831,7 @@
+ USE_PLUGIN_LD,
+ USE_GOLD_LD,
+ USE_BFD_LD,
++ USE_LLD_LD,
+ USE_LD_MAX
+ } selected_linker = USE_DEFAULT_LD;
+ static const char *const ld_suffixes[USE_LD_MAX] =
+@@ -838,7 +839,8 @@
+ "ld",
+ PLUGIN_LD_SUFFIX,
+ "ld.gold",
+- "ld.bfd"
++ "ld.bfd",
++ "ld.lld"
+ };
+ static const char *const real_ld_suffix = "real-ld";
+ static const char *const collect_ld_suffix = "collect-ld";
+@@ -1004,6 +1006,8 @@
+ selected_linker = USE_BFD_LD;
+ else if (strcmp (argv[i], "-fuse-ld=gold") == 0)
+ selected_linker = USE_GOLD_LD;
++ else if (strcmp (argv[i], "-fuse-ld=lld") == 0)
++ selected_linker = USE_LLD_LD;
+
+ #ifdef COLLECT_EXPORT_LIST
+ /* These flags are position independent, although their order
+@@ -1093,7 +1097,8 @@
+ /* Maybe we know the right file to use (if not cross). */
+ ld_file_name = 0;
+ #ifdef DEFAULT_LINKER
+- if (selected_linker == USE_BFD_LD || selected_linker == USE_GOLD_LD)
++ if (selected_linker == USE_BFD_LD || selected_linker == USE_GOLD_LD ||
++ selected_linker == USE_LLD_LD)
+ {
+ char *linker_name;
+ # ifdef HOST_EXECUTABLE_SUFFIX
+@@ -1307,7 +1312,7 @@
+ else if (!use_collect_ld
+ && strncmp (arg, "-fuse-ld=", 9) == 0)
+ {
+- /* Do not pass -fuse-ld={bfd|gold} to the linker. */
++ /* Do not pass -fuse-ld={bfd|gold|lld} to the linker. */
+ ld1--;
+ ld2--;
+ }
+Index: gcc/common.opt
+===================================================================
+--- a/src/gcc/common.opt (revision 246158)
++++ a/src/gcc/common.opt (working copy)
+@@ -2512,9 +2512,13 @@
+ Use the bfd linker instead of the default linker.
+
+ fuse-ld=gold
+-Common Driver Negative(fuse-ld=bfd)
++Common Driver Negative(fuse-ld=lld)
+ Use the gold linker instead of the default linker.
+
++fuse-ld=lld
++Common Driver Negative(fuse-ld=bfd)
++Use the lld LLVM linker instead of the default linker.
++
+ fuse-linker-plugin
+ Common Undocumented Var(flag_use_linker_plugin)
+
+Index: gcc/opts.c
+===================================================================
+--- a/src/gcc/opts.c (revision 246158)
++++ a/src/gcc/opts.c (working copy)
+@@ -2168,6 +2168,7 @@
+
+ case OPT_fuse_ld_bfd:
+ case OPT_fuse_ld_gold:
++ case OPT_fuse_ld_lld:
+ case OPT_fuse_linker_plugin:
+ /* No-op. Used by the driver and passed to us because it starts with f.*/
+ break;