diff mbox series

[RFC,v4,8/9] lld: new package

Message ID 20180614224820.27126-9-joseph.kogut@gmail.com
State Changes Requested
Headers show
Series chromium: new package | expand

Commit Message

Joseph Kogut June 14, 2018, 10:48 p.m. UTC
Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
---
 DEVELOPERS            |  1 +
 package/Config.in     |  1 +
 package/lld/Config.in |  3 +++
 package/lld/lld.hash  |  3 +++
 package/lld/lld.mk    | 19 +++++++++++++++++++
 5 files changed, 27 insertions(+)
 create mode 100644 package/lld/Config.in
 create mode 100644 package/lld/lld.hash
 create mode 100644 package/lld/lld.mk

Comments

Thomas Petazzoni June 15, 2018, 9:01 p.m. UTC | #1
Hello,

On Thu, 14 Jun 2018 15:48:19 -0700, Joseph Kogut wrote:

> diff --git a/package/lld/Config.in b/package/lld/Config.in
> new file mode 100644
> index 0000000000..0ad50fd608
> --- /dev/null
> +++ b/package/lld/Config.in
> @@ -0,0 +1,3 @@
> +config BR2_PACKAGE_LLD
> +	bool "lld"
> +	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS

This is a bit short. No help text, no upstream URL.

> diff --git a/package/lld/lld.hash b/package/lld/lld.hash
> new file mode 100644
> index 0000000000..ce81c7baca
> --- /dev/null
> +++ b/package/lld/lld.hash
> @@ -0,0 +1,3 @@
> +# locally calculated
> +sha256 6b8c4a833cf30230c0213d78dbac01af21387b298225de90ab56032ca79c0e0b  lld-6.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..cfaf3dbd29
> --- /dev/null
> +++ b/package/lld/lld.mk
> @@ -0,0 +1,19 @@
> +###############################################################################
> +#
> +# lld
> +#
> +###############################################################################
> +
> +LLD_VERSION = 6.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

No dependencies really ? Have you tried a configuration with *just* lld
enabled ?

If I build just the lld package, I get:

CMake Error at CMakeLists.txt:11 (message):
  llvm-config not found: specify LLVM_CONFIG_PATH

When you submit new packages, please make sure that they build in a
configuration that has *just* this new package enabled and nothing else.

> +HOST_LLD_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release
> +LLD_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release

For target packages, CMAKE_BUILD_TYPE is already passed by the
cmake-package infrastructure.

Best regards,

Thomas
Joseph Kogut June 20, 2018, 7:14 p.m. UTC | #2
Hi Thomas,

On Fri, Jun 15, 2018 at 2:01 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> Hello,
>
> On Thu, 14 Jun 2018 15:48:19 -0700, Joseph Kogut wrote:
>
> > diff --git a/package/lld/Config.in b/package/lld/Config.in
> > new file mode 100644
> > index 0000000000..0ad50fd608
> > --- /dev/null
> > +++ b/package/lld/Config.in
> > @@ -0,0 +1,3 @@
> > +config BR2_PACKAGE_LLD
> > +     bool "lld"
> > +     depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
>
> This is a bit short. No help text, no upstream URL.
>
> > diff --git a/package/lld/lld.hash b/package/lld/lld.hash
> > new file mode 100644
> > index 0000000000..ce81c7baca
> > --- /dev/null
> > +++ b/package/lld/lld.hash
> > @@ -0,0 +1,3 @@
> > +# locally calculated
> > +sha256 6b8c4a833cf30230c0213d78dbac01af21387b298225de90ab56032ca79c0e0b  lld-6.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..cfaf3dbd29
> > --- /dev/null
> > +++ b/package/lld/lld.mk
> > @@ -0,0 +1,19 @@
> > +###############################################################################
> > +#
> > +# lld
> > +#
> > +###############################################################################
> > +
> > +LLD_VERSION = 6.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
>
> No dependencies really ? Have you tried a configuration with *just* lld
> enabled ?
>
> If I build just the lld package, I get:
>
> CMake Error at CMakeLists.txt:11 (message):
>   llvm-config not found: specify LLVM_CONFIG_PATH
>
> When you submit new packages, please make sure that they build in a
> configuration that has *just* this new package enabled and nothing else.
>

My mistake, this one wasn't tested enough.

> > +HOST_LLD_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release
> > +LLD_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release
>
> For target packages, CMAKE_BUILD_TYPE is already passed by the
> cmake-package infrastructure.
>

Thanks for the tip.

> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
> Embedded Linux and Kernel engineering
> https://bootlin.com

After looking over this package again, I'm thinking it should be host
only. Without a compiler on the target, a linker really doesn't have
any utility.

Also, the LLVM project claims drop-in compatibility and much better
performance with LLD compared to GNU ld/gold, so I'm curious how using
LLD as the default linker would affect build times. I'll do some
experiments.

Best,
Joseph
Thomas Petazzoni June 21, 2018, 12:45 p.m. UTC | #3
Hello,

On Wed, 20 Jun 2018 12:14:25 -0700, Joseph Kogut wrote:

> After looking over this package again, I'm thinking it should be host
> only. Without a compiler on the target, a linker really doesn't have
> any utility.

Indeed, I missed this obvious aspect when reviewing the package.

> Also, the LLVM project claims drop-in compatibility and much better
> performance with LLD compared to GNU ld/gold, so I'm curious how using
> LLD as the default linker would affect build times. I'll do some
> experiments.

Having support for using llvm/clang/lld as a toolchain replacement was
discussed, and it was on Valentin's radar. It would definitely be
interesting to see some progress in this area, even though I believe it
will be tricky as I'm sure a large number of packages will not build
nicely with clang, the Linux kernel being an important package falling
into this category.

Best regards,

Thomas
Joseph Kogut June 21, 2018, 11:32 p.m. UTC | #4
On Thu, Jun 21, 2018 at 5:45 AM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
<snip>
> Having support for using llvm/clang/lld as a toolchain replacement was
> discussed, and it was on Valentin's radar. It would definitely be
> interesting to see some progress in this area, even though I believe it
> will be tricky as I'm sure a large number of packages will not build
> nicely with clang, the Linux kernel being an important package falling
> into this category.
>

I'm sure integrating Clang will be tricky. Even worse, GCC and Clang
are very competitive nowadays, so the utility is dubious. Furthermore,
packages such as Chromium that don't build with GCC can depend on
Clang and setup their build process accordingly, without replacing the
entire toolchain.

Even without substituting Clang for GCC, using LLVM's linker is still
interesting. The LLVM guys claim drop-in GNU compatibility and 10-20x
faster linking just by substituting LLD for GNU ld. Additionally, LLD
supports identical code folding, which can generate smaller binaries.

However, I finished testing a few builds today with LLD and a config
that includes LLVM, Qemu, libgtk3, X.org, and several other large
packages (total build time was ~45 minutes) and the difference between
GNU ld and LLD was ~6 seconds. There was no difference in generated
binary size. Maybe my build wasn't actually using LLD, I'll have to do
some more testing.
diff mbox series

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index 568f47d242..ef6fd32fed 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -959,6 +959,7 @@  F:	package/at-spi2-atk/
 F:	package/at-spi2-core/
 F:	package/gconf/
 F:	package/libnss/
+F:	package/lld/
 F:	package/python-cython/
 F:	package/python-raven/
 F:	package/python-schedule/
diff --git a/package/Config.in b/package/Config.in
index c2e619b317..e4eb87b574 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1565,6 +1565,7 @@  menu "Other"
 	source "package/libuv/Config.in"
 	source "package/lightning/Config.in"
 	source "package/linux-pam/Config.in"
+	source "package/lld/Config.in"
 	source "package/llvm/Config.in"
 if BR2_PACKAGE_LINUX_PAM
 comment "linux-pam plugins"
diff --git a/package/lld/Config.in b/package/lld/Config.in
new file mode 100644
index 0000000000..0ad50fd608
--- /dev/null
+++ b/package/lld/Config.in
@@ -0,0 +1,3 @@ 
+config BR2_PACKAGE_LLD
+	bool "lld"
+	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
diff --git a/package/lld/lld.hash b/package/lld/lld.hash
new file mode 100644
index 0000000000..ce81c7baca
--- /dev/null
+++ b/package/lld/lld.hash
@@ -0,0 +1,3 @@ 
+# locally calculated
+sha256 6b8c4a833cf30230c0213d78dbac01af21387b298225de90ab56032ca79c0e0b  lld-6.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..cfaf3dbd29
--- /dev/null
+++ b/package/lld/lld.mk
@@ -0,0 +1,19 @@ 
+###############################################################################
+#
+# lld
+#
+###############################################################################
+
+LLD_VERSION = 6.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_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release
+LLD_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release
+
+$(eval $(cmake-package))
+$(eval $(host-cmake-package))
+