* [Buildroot] [RFC PATCH 1/4] llvm: disable bindings on host
2019-07-24 17:35 [Buildroot] [RFC PATCH 0/4] Add Buildroot toolchain support for LLD Joseph Kogut
@ 2019-07-24 17:35 ` Joseph Kogut
2019-08-01 10:11 ` Romain Naour
2019-10-19 22:47 ` Arnout Vandecappelle
2019-07-24 17:35 ` [Buildroot] [RFC PATCH 2/4] package/lld: new package Joseph Kogut
` (3 subsequent siblings)
4 siblings, 2 replies; 14+ messages in thread
From: Joseph Kogut @ 2019-07-24 17:35 UTC (permalink / raw)
To: buildroot
Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
---
package/llvm/llvm.mk | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/package/llvm/llvm.mk b/package/llvm/llvm.mk
index 3c62285188..11c8d90af0 100644
--- a/package/llvm/llvm.mk
+++ b/package/llvm/llvm.mk
@@ -184,7 +184,8 @@ LLVM_CONF_OPTS += -DLLVM_HOST_TRIPLE=$(GNU_TARGET_NAME)
# check preventively. Building the Go and OCaml bindings is yet unsupported.
HOST_LLVM_CONF_OPTS += \
-DGO_EXECUTABLE=GO_EXECUTABLE-NOTFOUND \
- -DOCAMLFIND=OCAMLFIND-NOTFOUND
+ -DOCAMLFIND=OCAMLFIND-NOTFOUND \
+ -DLLVM_ENABLE_BINDINGS=OFF
# Builds a release host tablegen that gets used during the LLVM build.
HOST_LLVM_CONF_OPTS += -DLLVM_OPTIMIZED_TABLEGEN=ON
--
2.22.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Buildroot] [RFC PATCH 1/4] llvm: disable bindings on host
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
1 sibling, 0 replies; 14+ messages in thread
From: Romain Naour @ 2019-08-01 10:11 UTC (permalink / raw)
To: buildroot
Hi Joseph,
Le 24/07/2019 ? 19:35, Joseph Kogut a ?crit?:
> Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
> ---
> package/llvm/llvm.mk | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/package/llvm/llvm.mk b/package/llvm/llvm.mk
> index 3c62285188..11c8d90af0 100644
> --- a/package/llvm/llvm.mk
> +++ b/package/llvm/llvm.mk
> @@ -184,7 +184,8 @@ LLVM_CONF_OPTS += -DLLVM_HOST_TRIPLE=$(GNU_TARGET_NAME)
> # check preventively. Building the Go and OCaml bindings is yet unsupported.
> HOST_LLVM_CONF_OPTS += \
> -DGO_EXECUTABLE=GO_EXECUTABLE-NOTFOUND \
> - -DOCAMLFIND=OCAMLFIND-NOTFOUND
> + -DOCAMLFIND=OCAMLFIND-NOTFOUND \
> + -DLLVM_ENABLE_BINDINGS=OFF
With LLVM_ENABLE_BINDINGS=OFF, you should be able to remove GO_EXECUTABLE and
DOCAMLFIND
Best regards,
Romain
>
> # Builds a release host tablegen that gets used during the LLVM build.
> HOST_LLVM_CONF_OPTS += -DLLVM_OPTIMIZED_TABLEGEN=ON
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Buildroot] [RFC PATCH 1/4] llvm: disable bindings on host
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
1 sibling, 1 reply; 14+ messages in thread
From: Arnout Vandecappelle @ 2019-10-19 22:47 UTC (permalink / raw)
To: buildroot
On 24/07/2019 19:35, Joseph Kogut wrote:
> Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
Can you explain why this is needed/wanted?
Regards,
Arnout
> ---
> package/llvm/llvm.mk | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/package/llvm/llvm.mk b/package/llvm/llvm.mk
> index 3c62285188..11c8d90af0 100644
> --- a/package/llvm/llvm.mk
> +++ b/package/llvm/llvm.mk
> @@ -184,7 +184,8 @@ LLVM_CONF_OPTS += -DLLVM_HOST_TRIPLE=$(GNU_TARGET_NAME)
> # check preventively. Building the Go and OCaml bindings is yet unsupported.
> HOST_LLVM_CONF_OPTS += \
> -DGO_EXECUTABLE=GO_EXECUTABLE-NOTFOUND \
> - -DOCAMLFIND=OCAMLFIND-NOTFOUND
> + -DOCAMLFIND=OCAMLFIND-NOTFOUND \
> + -DLLVM_ENABLE_BINDINGS=OFF
>
> # Builds a release host tablegen that gets used during the LLVM build.
> HOST_LLVM_CONF_OPTS += -DLLVM_OPTIMIZED_TABLEGEN=ON
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Buildroot] [RFC PATCH 1/4] llvm: disable bindings on host
2019-10-19 22:47 ` Arnout Vandecappelle
@ 2019-10-20 6:55 ` Joseph Kogut
0 siblings, 0 replies; 14+ messages in thread
From: Joseph Kogut @ 2019-10-20 6:55 UTC (permalink / raw)
To: buildroot
On Sat, Oct 19, 2019 at 3:47 PM Arnout Vandecappelle <arnout@mind.be> wrote:
>
>
>
> On 24/07/2019 19:35, Joseph Kogut wrote:
> > Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
>
> Can you explain why this is needed/wanted?
>
> Regards,
> Arnout
>
Nope. This commit was a while ago, and when I was working on this
feature, I found that certain bindings were still enabled which caused
a build failure. I researched the configure flags for LLVM, and found
this one. Enabling it fixed the build, so I added it.
It's very possible the enabling of this flag obviates the need for the
priors. If that's the case, I would of course support removing the
unneeded flags.
Best,
Joseph
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Buildroot] [RFC PATCH 2/4] package/lld: new package
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-07-24 17:35 ` 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
` (2 subsequent siblings)
4 siblings, 1 reply; 14+ messages in thread
From: Joseph Kogut @ 2019-07-24 17:35 UTC (permalink / raw)
To: buildroot
Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
---
DEVELOPERS | 1 +
package/Config.in.host | 1 +
package/lld/Config.in.host | 16 ++++++++++++++++
package/lld/lld.hash | 3 +++
package/lld/lld.mk | 23 +++++++++++++++++++++++
5 files changed, 44 insertions(+)
create mode 100644 package/lld/Config.in.host
create mode 100644 package/lld/lld.hash
create mode 100644 package/lld/lld.mk
diff --git a/DEVELOPERS b/DEVELOPERS
index 4ab4e36593..bdc98edd12 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1221,6 +1221,7 @@ F: package/at-spi2-core/
F: package/clang/
F: package/gconf/
F: package/libnss/
+F: package/lld/
F: package/llvm/
F: package/python-cython/
F: package/python-raven/
diff --git a/package/Config.in.host b/package/Config.in.host
index 1501889b72..abacf3c42a 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -34,6 +34,7 @@ menu "Host utilities"
source "package/jq/Config.in.host"
source "package/jsmin/Config.in.host"
source "package/libp11/Config.in.host"
+ source "package/lld/Config.in.host"
source "package/lpc3250loader/Config.in.host"
source "package/lttng-babeltrace/Config.in.host"
source "package/mender-artifact/Config.in.host"
diff --git a/package/lld/Config.in.host b/package/lld/Config.in.host
new file mode 100644
index 0000000000..c04b7924fa
--- /dev/null
+++ b/package/lld/Config.in.host
@@ -0,0 +1,16 @@
+config BR2_PACKAGE_HOST_LLD
+ bool "host lld"
+ depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS # llvm
+ depends on BR2_HOST_GCC_AT_LEAST_4_8 # llvm
+ select BR2_PACKAGE_HOST_LLVM
+ help
+ LLD is a linker from the LLVM project that is a drop-in
+ replacement for system linkers, and runs much faster than
+ them. It also provides features that are useful for
+ toolchain developers.
+
+ https://lld.llvm.org/
+
+comment "lld needs a toolchain w/ host gcc >= 4.8"
+ depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
+ depends on !BR2_HOST_GCC_AT_LEAST_4_8
diff --git a/package/lld/lld.hash b/package/lld/lld.hash
new file mode 100644
index 0000000000..dfbb290cf4
--- /dev/null
+++ b/package/lld/lld.hash
@@ -0,0 +1,3 @@
+# locally calculated
+sha256 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37 lld-8.0.0.src.tar.xz
+sha256 f0502d2d0e19748c534ee95ea486c092273303dbef76404c8b17dc8bf6ca441b LICENSE.TXT
diff --git a/package/lld/lld.mk b/package/lld/lld.mk
new file mode 100644
index 0000000000..a6933e2961
--- /dev/null
+++ b/package/lld/lld.mk
@@ -0,0 +1,23 @@
+################################################################################
+#
+# lld
+#
+################################################################################
+
+LLD_VERSION = 8.0.0
+LLD_SITE = https://llvm.org/releases/$(LLD_VERSION)
+LLD_SOURCE = lld-$(LLD_VERSION).src.tar.xz
+LLD_LICENSE = NCSA
+LLD_LICENSE_FILES = LICENSE.TXT
+LLD_SUPPORTS_IN_SOURCE_BUILD = NO
+HOST_LLD_DEPENDENCIES = host-llvm
+
+# GCC looks for tools in a different path from LLD's default installation path
+define HOST_LLD_CREATE_SYMLINKS
+ ln -sf $(HOST_DIR)/bin/lld $(HOST_DIR)/$(GNU_TARGET_NAME)/bin/lld
+ ln -sf $(HOST_DIR)/bin/lld $(HOST_DIR)/$(GNU_TARGET_NAME)/bin/ld.lld
+endef
+
+HOST_LLD_POST_INSTALL_HOOKS += HOST_LLD_CREATE_SYMLINKS
+
+$(eval $(host-cmake-package))
--
2.22.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Buildroot] [RFC PATCH 2/4] package/lld: new package
2019-07-24 17:35 ` [Buildroot] [RFC PATCH 2/4] package/lld: new package Joseph Kogut
@ 2019-10-19 22:48 ` Arnout Vandecappelle
0 siblings, 0 replies; 14+ messages in thread
From: Arnout Vandecappelle @ 2019-10-19 22:48 UTC (permalink / raw)
To: buildroot
On 24/07/2019 19:35, Joseph Kogut wrote:
> Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
Applied to master, thanks. Not very useful as is, but it will give some
autobuilder exposure.
[snip]
> +config BR2_PACKAGE_HOST_LLD
> + bool "host lld"
> + depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS # llvm
> + depends on BR2_HOST_GCC_AT_LEAST_4_8 # llvm
> + select BR2_PACKAGE_HOST_LLVM
This symbol doesn't exist, so I removed it.
Regards,
Arnout
[snip]
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Buildroot] [RFC PATCH 3/4] toolchain-wrapper: add linker override option
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-07-24 17:35 ` [Buildroot] [RFC PATCH 2/4] package/lld: new package Joseph Kogut
@ 2019-07-24 17:35 ` Joseph Kogut
2019-10-19 22:49 ` Arnout Vandecappelle
2019-07-24 17:35 ` [Buildroot] [RFC PATCH 4/4] Add linker override to config options Joseph Kogut
2019-08-01 13:13 ` [Buildroot] [RFC PATCH 0/4] Add Buildroot toolchain support for LLD Romain Naour
4 siblings, 1 reply; 14+ messages in thread
From: Joseph Kogut @ 2019-07-24 17:35 UTC (permalink / raw)
To: buildroot
Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
---
toolchain/toolchain-wrapper.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/toolchain/toolchain-wrapper.c b/toolchain/toolchain-wrapper.c
index c73a0cc079..131a239f7f 100644
--- a/toolchain/toolchain-wrapper.c
+++ b/toolchain/toolchain-wrapper.c
@@ -360,6 +360,17 @@ int main(int argc, char **argv)
}
#endif /* ARCH || CPU */
+#if defined(BR_LINKER)
+ /* Specify our linker if it's not already set */
+ for (i = 1; i < argc; i++) {
+ if (!strncmp(argv[i], "-fuse-ld=", strlen("-fuse-ld=")))
+ break;
+ }
+ if (i == argc && !getenv("BR2_NO_LINKER_OVERRIDE")) {
+ *cur++ = "-fuse-ld=" BR_LINKER;
+ }
+#endif /* BR_LINKER */
+
if (parse_source_date_epoch_from_env()) {
*cur++ = _time_;
*cur++ = _date_;
--
2.22.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Buildroot] [RFC PATCH 3/4] toolchain-wrapper: add linker override option
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
0 siblings, 0 replies; 14+ messages in thread
From: Arnout Vandecappelle @ 2019-10-19 22:49 UTC (permalink / raw)
To: buildroot
On 24/07/2019 19:35, Joseph Kogut wrote:
> Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
> ---
> toolchain/toolchain-wrapper.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/toolchain/toolchain-wrapper.c b/toolchain/toolchain-wrapper.c
> index c73a0cc079..131a239f7f 100644
> --- a/toolchain/toolchain-wrapper.c
> +++ b/toolchain/toolchain-wrapper.c
> @@ -360,6 +360,17 @@ int main(int argc, char **argv)
> }
> #endif /* ARCH || CPU */
>
> +#if defined(BR_LINKER)
> + /* Specify our linker if it's not already set */
> + for (i = 1; i < argc; i++) {
> + if (!strncmp(argv[i], "-fuse-ld=", strlen("-fuse-ld=")))
> + break;
> + }
> + if (i == argc && !getenv("BR2_NO_LINKER_OVERRIDE")) {
A while ago we decided that "internal" environment variables should use BR_
prefix, while "user" variables should use BR2_. I'm not sure if we consistently
do that, but I do think that here we should.
Regards,
Arnout
> + *cur++ = "-fuse-ld=" BR_LINKER;
> + }
> +#endif /* BR_LINKER */
> +
> if (parse_source_date_epoch_from_env()) {
> *cur++ = _time_;
> *cur++ = _date_;
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Buildroot] [RFC PATCH 4/4] Add linker override to config options
2019-07-24 17:35 [Buildroot] [RFC PATCH 0/4] Add Buildroot toolchain support for LLD Joseph Kogut
` (2 preceding siblings ...)
2019-07-24 17:35 ` [Buildroot] [RFC PATCH 3/4] toolchain-wrapper: add linker override option Joseph Kogut
@ 2019-07-24 17:35 ` Joseph Kogut
2019-07-27 2:25 ` Carlos Santos
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
4 siblings, 2 replies; 14+ messages in thread
From: Joseph Kogut @ 2019-07-24 17:35 UTC (permalink / raw)
To: buildroot
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
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Buildroot] [RFC PATCH 4/4] Add linker override to config options
2019-07-24 17:35 ` [Buildroot] [RFC PATCH 4/4] Add linker override to config options Joseph Kogut
@ 2019-07-27 2:25 ` Carlos Santos
2019-07-29 17:55 ` Joseph Kogut
2019-10-19 23:01 ` Arnout Vandecappelle
1 sibling, 1 reply; 14+ messages in thread
From: Carlos Santos @ 2019-07-27 2:25 UTC (permalink / raw)
To: buildroot
On Wed, Jul 24, 2019 at 2:35 PM Joseph Kogut <joseph.kogut@gmail.com> wrote:
>
> Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
[...]
>
> +ifeq ($(BR2_LINKER_LLD),y)
> +TOOLCHAIN_WRAPPER_ARGS += -DBR_LINKER='"lld"'
Sorry for the nitpicking but Buildroot normally uses the "BR2_" prefix
fo perhaps this should be "BR2_LINKER"
--
Carlos Santos <unixmania@gmail.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Buildroot] [RFC PATCH 4/4] Add linker override to config options
2019-07-27 2:25 ` Carlos Santos
@ 2019-07-29 17:55 ` Joseph Kogut
0 siblings, 0 replies; 14+ messages in thread
From: Joseph Kogut @ 2019-07-29 17:55 UTC (permalink / raw)
To: buildroot
Hi Carlos,
On Fri, Jul 26, 2019 at 7:25 PM Carlos Santos <unixmania@gmail.com> wrote:
>
> On Wed, Jul 24, 2019 at 2:35 PM Joseph Kogut <joseph.kogut@gmail.com> wrote:
> >
> > Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
> [...]
> >
> > +ifeq ($(BR2_LINKER_LLD),y)
> > +TOOLCHAIN_WRAPPER_ARGS += -DBR_LINKER='"lld"'
>
> Sorry for the nitpicking but Buildroot normally uses the "BR2_" prefix
> fo perhaps this should be "BR2_LINKER"
>
Correct, most constants are prefixed with BR2_*, with the exception of
definitions in the toolchain wrapper. I chose BR_LINKER to remain
consistent with the other code in the wrapper.
Best,
Joseph
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Buildroot] [RFC PATCH 4/4] Add linker override to config options
2019-07-24 17:35 ` [Buildroot] [RFC PATCH 4/4] Add linker override to config options Joseph Kogut
2019-07-27 2:25 ` Carlos Santos
@ 2019-10-19 23:01 ` Arnout Vandecappelle
1 sibling, 0 replies; 14+ messages in thread
From: Arnout Vandecappelle @ 2019-10-19 23:01 UTC (permalink / raw)
To: buildroot
On 24/07/2019 19:35, Joseph Kogut wrote:
> Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
Please make the commit message a bit more extensive. Actually, almost all of
the cover text could be put here.
> ---
> 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
I think this option belongs in the toolchain menu, under the toolchain generic
options.
> + help
> + Choose the default linker
> + Individual packages may override this choice
Please end sentences with a period, and if it's intended as two paragraphs, add
an empty line between them.
> +
> +config BR2_LINKER_BFD
> + bool "GNU ld"
> + help
> + GNU GCC linker
> +
> +config BR2_LINKER_LLD
> + bool "LLVM LLD"
> + select BR2_PACKAGE_HOST_LLD
If this requires gcc 9+, you should add
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_9
> + 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)
I think it's not really needed by gcc itself, but only by the packages that
will add the -fuse-ld flag, right? Then I think it's more appropriate to add the
dependency to the toolchain (virtual) package. That way, we also support
external toolchains.
>
> 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))
I think two additional patches will be needed:
1. An update to the manual that explains how to disable lld in the
adding-packages section.
2. An update to genrandconfig that makes sure the LLD option gets tested in the
autobuilders.
Regards,
Arnout
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Buildroot] [RFC PATCH 0/4] Add Buildroot toolchain support for LLD
2019-07-24 17:35 [Buildroot] [RFC PATCH 0/4] Add Buildroot toolchain support for LLD Joseph Kogut
` (3 preceding siblings ...)
2019-07-24 17:35 ` [Buildroot] [RFC PATCH 4/4] Add linker override to config options Joseph Kogut
@ 2019-08-01 13:13 ` Romain Naour
4 siblings, 0 replies; 14+ messages in thread
From: Romain Naour @ 2019-08-01 13:13 UTC (permalink / raw)
To: buildroot
Hello Joseph,
Le 24/07/2019 ? 19:35, Joseph Kogut a ?crit?:
> Hello,
>
> This series adds support for changing the default linker Buildroot uses, and
> adds the LLVM project's LLD linker as an alternative to ld.bfd.
>
> LLD offers significantly faster linking compared to GNU Gold and ld.bfd, as well
> as features like identical code folding (ICF) for generating smaller binaries.
>
> This patchset does not aim to support the more advanced linking features of LLD,
> but rather allows LLD to be used as a drop-in replacement for the standard GNU
> linker.
Do you think the test result could be improved by using the more advanced
linking features ?
>
> Below are some comparisons with individual package build times with and without
> LLD. Tests of individual packages are conducted by building a complete image
> without ccache, then doing:
>
> make [package]-dirclean && time make [package]
>
> BFD: LLD:
> FFmpeg:
> real 0m49.493s real 0m48.912s
> user 10m55.617s user 10m47.596s
> sys 0m40.307s sys 0m42.746s
>
> Python3:
> real 0m31.480s real 0m31.273s
> user 1m35.363s user 1m34.245s
> sys 0m9.554s sys 0m10.448s
>
> PostgreSQL:
> real 0m40.440s real 0m40.015s
> user 3m20.186s user 3m17.695s
> sys 0m22.199s sys 0m22.656s
>
> Node.js:
> real 1m47.497s real 1m45.562s
> user 33m57.731s user 33m55.133s
> sys 2m2.629s sys 2m3.313s
>
> As you can see, build times are slightly lower with LLD, but are mostly a wash.
> Overall build times are not significantly different between the two, however,
> debug builds may see a greater difference in link times. Performance may vary
> on other systems.
>
> Some packages such as glibc depend on ld.bfd, and a new environment variable
> (BR2_NO_LINKER_OVERRIDE) allows disabling the linker override for specific
> packages when necessary.
>
> Support is currently only provided for Buildroot's toolchain, and only with
> GCC 9.x, which supports the ld.lld linker driver upstream. Support for older
> versions of GCC is possible, but it would need to be backported with a trivial
> patch [1]. I'm open to discussion about if and how linker override support
> should be handled with external toolchains.
What was the architecture you used for this test ?
Since llvm/clang/lld take a lot of time to build, do you think it could be
useful to be able to import a clang toolchain as an external toolchain ?
That was the question during the Buildroot FOSDEM meeting 2018:
https://www.elinux.org/Buildroot:DeveloperDaysFOSDEM2018#LLVM.2FClang
Best regards,
Romain
>
> [1] https://patchwork.ozlabs.org/patch/987183/
>
> Joseph Kogut (4):
> llvm: disable bindings on host
> package/lld: new package
> toolchain-wrapper: add linker override option
> Add linker override to config options
>
> Config.in | 27 +++++++++++++++++++++++++++
> DEVELOPERS | 1 +
> package/Config.in.host | 1 +
> package/gcc/gcc.mk | 3 ++-
> package/glibc/glibc.mk | 3 +++
> package/lld/Config.in.host | 16 ++++++++++++++++
> package/lld/lld.hash | 3 +++
> package/lld/lld.mk | 23 +++++++++++++++++++++++
> package/llvm/llvm.mk | 3 ++-
> toolchain/toolchain-wrapper.c | 11 +++++++++++
> toolchain/toolchain-wrapper.mk | 4 ++++
> 11 files changed, 93 insertions(+), 2 deletions(-)
> create mode 100644 package/lld/Config.in.host
> create mode 100644 package/lld/lld.hash
> create mode 100644 package/lld/lld.mk
>
> --
> 2.22.0
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>
^ permalink raw reply [flat|nested] 14+ messages in thread