Idwer Vollering has uploaded this change for review.

View Change

toolchain: build the bootstrap part on recent FreeBSD setups

"Add support for -fuse-ld=lld, backported from GCC mainline which is
going to become GCC 9 (in form of files/patch-fuse-ld=lld borrowed
from devel/riscv64-gcc)."

Obtained through: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=227302

Change-Id: I3fa04283a2d306a9a11a1a0d929c6b7df2ac62fb
Signed-off-by: Idwer Vollering <vidwer@gmail.com>
---
A util/crossgcc/patches/gcc-8.3.0_fbsd-ld-lld.patch
1 file changed, 88 insertions(+), 0 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/99/34999/1
diff --git a/util/crossgcc/patches/gcc-8.3.0_fbsd-ld-lld.patch b/util/crossgcc/patches/gcc-8.3.0_fbsd-ld-lld.patch
new file mode 100644
index 0000000..dcf6b5a
--- /dev/null
+++ b/util/crossgcc/patches/gcc-8.3.0_fbsd-ld-lld.patch
@@ -0,0 +1,88 @@
+diff -urN gcc-8.3.0-vanilla/gcc/collect2.c gcc-8.3.0/gcc/collect2.c
+--- gcc-8.3.0-vanilla/gcc/collect2.c 2018-06-22 16:52:11.000000000 +0200
++++ gcc-8.3.0/gcc/collect2.c 2019-08-19 21:57:22.771579000 +0200
+@@ -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";
+@@ -1007,6 +1009,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
+@@ -1096,7 +1100,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
+@@ -1315,7 +1320,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--;
+ }
+diff -urN gcc-8.3.0-vanilla/gcc/common.opt gcc-8.3.0/gcc/common.opt
+--- gcc-8.3.0-vanilla/gcc/common.opt 2018-06-16 08:52:17.000000000 +0200
++++ gcc-8.3.0/gcc/common.opt 2019-08-19 21:58:53.386201000 +0200
+@@ -2715,6 +2715,10 @@
+ Common Driver Negative(fuse-ld=bfd)
+ Use the gold linker instead of the default linker.
+
++fuse-ld=lld
++Common Driver Negative(fuse-ld=lld)
++Use the lld LLVM linker instead of the default linker.
++
+ fuse-linker-plugin
+ Common Undocumented Var(flag_use_linker_plugin)
+
+diff -urN gcc-8.3.0-vanilla/gcc/doc/invoke.texi gcc-8.3.0/gcc/doc/invoke.texi
+--- gcc-8.3.0-vanilla/gcc/doc/invoke.texi 2019-02-15 00:08:18.000000000 +0100
++++ gcc-8.3.0/gcc/doc/invoke.texi 2019-08-19 22:05:27.979804000 +0200
+@@ -12259,6 +12259,10 @@
+ @opindex fuse-ld=gold
+ Use the @command{gold} linker instead of the default linker.
+
++@item -fuse-ld=lld
++@opindex fuse-ld=lld
++Use the LLVM @command{lld} linker instead of the default linker.
++
+ @cindex Libraries
+ @item -l@var{library}
+ @itemx -l @var{library}
+diff -urN gcc-8.3.0-vanilla/gcc/opts.c gcc-8.3.0/gcc/opts.c
+--- gcc-8.3.0-vanilla/gcc/opts.c 2019-01-31 11:00:26.000000000 +0100
++++ gcc-8.3.0/gcc/opts.c 2019-08-19 22:00:46.309476000 +0200
+@@ -2481,6 +2481,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;

To view, visit change 34999. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I3fa04283a2d306a9a11a1a0d929c6b7df2ac62fb
Gerrit-Change-Number: 34999
Gerrit-PatchSet: 1
Gerrit-Owner: Idwer Vollering <vidwer@gmail.com>
Gerrit-MessageType: newchange