All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joseph Kogut <joseph.kogut@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [RFC PATCH 4/4] Add linker override to config options
Date: Wed, 24 Jul 2019 10:35:38 -0700	[thread overview]
Message-ID: <20190724173538.22913-5-joseph.kogut@gmail.com> (raw)
In-Reply-To: <20190724173538.22913-1-joseph.kogut@gmail.com>

Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
---
 Config.in                      | 27 +++++++++++++++++++++++++++
 package/gcc/gcc.mk             |  3 ++-
 package/glibc/glibc.mk         |  3 +++
 toolchain/toolchain-wrapper.mk |  4 ++++
 4 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/Config.in b/Config.in
index 757ad1ca40..576d95305d 100644
--- a/Config.in
+++ b/Config.in
@@ -318,6 +318,33 @@ config BR2_JLEVEL
 	  Number of jobs to run simultaneously. If 0, determine
 	  automatically according to number of CPUs on the host system.
 
+choice
+	prompt "Default linker"
+	default BR2_LINKER_BFD
+	help
+	  Choose the default linker
+	  Individual packages may override this choice
+
+config BR2_LINKER_BFD
+	bool "GNU ld"
+	help
+	  GNU GCC linker
+
+config BR2_LINKER_LLD
+	bool "LLVM LLD"
+	select BR2_PACKAGE_HOST_LLD
+	help
+	  Clang/LLVM linker
+
+	  Offers a faster link times compared to GNU linkers such as ld.bfd and
+	  ld.gold.
+
+	  NOTE: This option requires building LLVM, which is time consuming itself.
+
+	  https://lld.llvm.org/
+
+endchoice
+
 config BR2_CCACHE
 	bool "Enable compiler cache"
 	help
diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk
index 46ad16df13..aef0038639 100644
--- a/package/gcc/gcc.mk
+++ b/package/gcc/gcc.mk
@@ -85,7 +85,8 @@ HOST_GCC_COMMON_DEPENDENCIES = \
 	host-gmp \
 	host-mpc \
 	host-mpfr \
-	$(if $(BR2_BINFMT_FLAT),host-elf2flt)
+	$(if $(BR2_BINFMT_FLAT),host-elf2flt) \
+	$(if $(BR2_LINKER_LLD),host-lld)
 
 HOST_GCC_COMMON_CONF_OPTS = \
 	--target=$(GNU_TARGET_NAME) \
diff --git a/package/glibc/glibc.mk b/package/glibc/glibc.mk
index f8d8c1bd87..1c06028241 100644
--- a/package/glibc/glibc.mk
+++ b/package/glibc/glibc.mk
@@ -32,6 +32,9 @@ GLIBC_LICENSE_FILES = COPYING COPYING.LIB LICENSES
 # glibc is part of the toolchain so disable the toolchain dependency
 GLIBC_ADD_TOOLCHAIN_DEPENDENCY = NO
 
+# Glibc requires ld.bfd
+GLIBC_MAKE_ENV += BR2_NO_LINKER_OVERRIDE=1
+
 # Before glibc is configured, we must have the first stage
 # cross-compiler and the kernel headers
 GLIBC_DEPENDENCIES = host-gcc-initial linux-headers host-bison host-gawk \
diff --git a/toolchain/toolchain-wrapper.mk b/toolchain/toolchain-wrapper.mk
index ca66fa7ba4..ff7a7ab448 100644
--- a/toolchain/toolchain-wrapper.mk
+++ b/toolchain/toolchain-wrapper.mk
@@ -16,6 +16,10 @@ endif
 TOOLCHAIN_WRAPPER_ARGS = $($(PKG)_TOOLCHAIN_WRAPPER_ARGS)
 TOOLCHAIN_WRAPPER_ARGS += -DBR_SYSROOT='"$(STAGING_SUBDIR)"'
 
+ifeq ($(BR2_LINKER_LLD),y)
+TOOLCHAIN_WRAPPER_ARGS += -DBR_LINKER='"lld"'
+endif
+
 TOOLCHAIN_WRAPPER_OPTS = \
 	$(call qstrip,$(BR2_SSP_OPTION)) \
 	$(call qstrip,$(BR2_TARGET_OPTIMIZATION))
-- 
2.22.0

  parent reply	other threads:[~2019-07-24 17:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-24 17:35 [Buildroot] [RFC PATCH 0/4] Add Buildroot toolchain support for LLD Joseph Kogut
2019-07-24 17:35 ` [Buildroot] [RFC PATCH 1/4] llvm: disable bindings on host Joseph Kogut
2019-08-01 10:11   ` Romain Naour
2019-10-19 22:47   ` Arnout Vandecappelle
2019-10-20  6:55     ` Joseph Kogut
2019-07-24 17:35 ` [Buildroot] [RFC PATCH 2/4] package/lld: new package Joseph Kogut
2019-10-19 22:48   ` Arnout Vandecappelle
2019-07-24 17:35 ` [Buildroot] [RFC PATCH 3/4] toolchain-wrapper: add linker override option Joseph Kogut
2019-10-19 22:49   ` Arnout Vandecappelle
2019-07-24 17:35 ` Joseph Kogut [this message]
2019-07-27  2:25   ` [Buildroot] [RFC PATCH 4/4] Add linker override to config options Carlos Santos
2019-07-29 17:55     ` Joseph Kogut
2019-10-19 23:01   ` Arnout Vandecappelle
2019-08-01 13:13 ` [Buildroot] [RFC PATCH 0/4] Add Buildroot toolchain support for LLD Romain Naour

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190724173538.22913-5-joseph.kogut@gmail.com \
    --to=joseph.kogut@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.