Skip to contentSkip to conversation

package/lld: create $(HOST_DIR)/$(GNU_TARGET_NAME)/bin before create symlinks

PATCH New Romain Naour 4 participants 6 messages Oct 24, 2019 – Nov 20, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 package/lld: create $(HOST_DIR)/$(GNU_TARGET_NAME)/bin before create symlinks

$(HOST_DIR)/$(GNU_TARGET_NAME)/bin directory may not exist before creating lld symlinks.

---
 package/lld/lld.mk | 1 +
 1 file changed, 1 insertion(+)
package/lld/lld.mk +1 -0
index a6933e2961..bda5a56ab5 100644
@@ -14,6 +14,7 @@ HOST_LLD_DEPENDENCIES = host-llvm
 
 # GCC looks for tools in a different path from LLD's default installation path
 define HOST_LLD_CREATE_SYMLINKS
+	mkdir -p $(HOST_DIR)/$(GNU_TARGET_NAME)/bin
 	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
Signature · 1 line
2.21.0
#1 lore raw

PATCH 2/3 package/lld: bump to version 9.0.0

Since v9.0.0, it was relicensed to the Apache License 2.0 with LLVM Exceptions. Update the license file hash.

lld package must use the same version as llvm package.

llvm 9.0.0 renamed some define that break the build for lld <= 8.0.0.
https://github.com/llvm-mirror/lld/commit/66fca3a6b8cc0112a4c72237ffaea5eb4b659e3f

Fixes:
http://autobuild.buildroot.org/results/9a0/9a0534c4206b40963d32494ff9675543e78125d1

---
Build tested only with llvm 9.0.0 for x86_64 target.

---
 package/lld/lld.hash | 4 ++--
 package/lld/lld.mk   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
package/lld/lld.hash +2 -2
index dfbb290cf4..3d5a3feb9a 100644
@@ -1,3 +1,3 @@
 # locally calculated
-sha256 9caec8ec922e32ffa130f0fb08e4c5a242d7e68ce757631e425e9eba2e1a6e37  lld-8.0.0.src.tar.xz
-sha256 f0502d2d0e19748c534ee95ea486c092273303dbef76404c8b17dc8bf6ca441b  LICENSE.TXT
+sha256 31c6748b235d09723fb73fea0c816ed5a3fab0f96b66f8fbc546a0fcc8688f91  lld-9.0.0.src.tar.xz
+sha256 f7891568956e34643eb6a0db1462db30820d40d7266e2a78063f2fe233ece5a0  LICENSE.TXT
package/lld/lld.mk +2 -2
index bda5a56ab5..0c880018ac 100644
@@ -4,10 +4,10 @@
 #
 ################################################################################
 
-LLD_VERSION = 8.0.0
+LLD_VERSION = 9.0.0
 LLD_SITE = https://llvm.org/releases/$(LLD_VERSION)
 LLD_SOURCE = lld-$(LLD_VERSION).src.tar.xz
-LLD_LICENSE = NCSA
+LLD_LICENSE = Apache-2.0 with exceptions
 LLD_LICENSE_FILES = LICENSE.TXT
 LLD_SUPPORTS_IN_SOURCE_BUILD = NO
 HOST_LLD_DEPENDENCIES = host-llvm
Signature · 1 line
2.21.0
#2 lore raw

PATCH 3/3 package/{llvm, clang, lld}: update comment to keep them at the same version.

In reply to Romain Naour
---
 package/clang/clang.mk | 2 +-
 package/lld/lld.mk     | 1 +
 package/llvm/llvm.mk   | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)
package/clang/clang.mk +1 -1
index 35fe2feef3..87bdf52e8d 100644
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-# LLVM and Clang should be version bumped together
+# LLVM, Clang and lld should be version bumped together
 CLANG_VERSION = 9.0.0
 CLANG_SITE = http://llvm.org/releases/$(CLANG_VERSION)
 CLANG_SOURCE = cfe-$(CLANG_VERSION).src.tar.xz
package/lld/lld.mk +1 -0
index 0c880018ac..cd76c724ce 100644
@@ -4,6 +4,7 @@
 #
 ################################################################################
 
+# LLVM, Clang and lld should be version bumped together
 LLD_VERSION = 9.0.0
 LLD_SITE = https://llvm.org/releases/$(LLD_VERSION)
 LLD_SOURCE = lld-$(LLD_VERSION).src.tar.xz
package/llvm/llvm.mk +1 -1
index ca89525858..4d9bb1d12f 100644
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-# LLVM and Clang should be version bumped together
+# LLVM, Clang and lld should be version bumped together
 LLVM_VERSION = 9.0.0
 LLVM_SITE = http://llvm.org/releases/$(LLVM_VERSION)
 LLVM_SOURCE = llvm-$(LLVM_VERSION).src.tar.xz
Signature · 1 line
2.21.0
#3 lore raw

PATCH 1/3 package/lld: create $(HOST_DIR)/$(GNU_TARGET_NAME)/bin before create symlinks

In reply to Romain Naour

Hi Romain,

Quoted 23 lines · Romain Naour

$(HOST_DIR)/$(GNU_TARGET_NAME)/bin directory may not exist before creating lld symlinks.

---
 package/lld/lld.mk | 1 +
 1 file changed, 1 insertion(+)
package/lld/lld.mk +1 -1
index a6933e2961..bda5a56ab5 100644
@@ -14,6 +14,7 @@ HOST_LLD_DEPENDENCIES = host-llvm
 
 # GCC looks for tools in a different path from LLD's default installation path
 define HOST_LLD_CREATE_SYMLINKS
+       mkdir -p $(HOST_DIR)/$(GNU_TARGET_NAME)/bin
        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
--
Quoted 2 lines

2.21.0

These changes look good. However, the build does still require a modification to llvm's makefile to disable the bindings for host-llvm. I'll send a revised version of my earlier patch to address this.

With that patch, this series has my

Tested building on x86-64 w/ GCC 9.2.0, as well as building a sample program as follows:

$ echo "int main(){ return 0; }" > test.c
$ output/host/bin/x86_64-buildroot-linux-gnu-gcc -fuse-ld=lld test.c -o test
$ readelf --string-dump .comment test

String dump of section '.comment':
[ 0] GCC: (Buildroot 2019.11-git-01165-g027e1e1410) 9.2.0
[ 35] Linker: LLD 9.0.0 (https://github.com/buildroot/buildroot
a2f0a106dd6eb62b52c815d299add5a07fd66e98)

$ ./test && echo $?
0
#4 lore raw

PATCH 1/3 package/lld: create $(HOST_DIR)/$(GNU_TARGET_NAME)/bin before create symlinks

In reply to Romain Naour
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Romain" == Romain Naour <[email protected]> writes:

$(HOST_DIR)/$(GNU_TARGET_NAME)/bin directory may not exist before creating lld symlinks.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#5 lore raw

PATCH 1/3 package/lld: create $(HOST_DIR)/$(GNU_TARGET_NAME)/bin before create symlinks

In reply to Romain Naour

Hi,
Sorry for the late feedback on this, I know it's already been accepted.

Quoted 15 lines · Romain Naour

$(HOST_DIR)/$(GNU_TARGET_NAME)/bin directory may not exist before creating lld symlinks.

---
 package/lld/lld.mk | 1 +
 1 file changed, 1 insertion(+)
package/lld/lld.mk +0 -0
index a6933e2961..bda5a56ab5 100644

package/lld/lld.mk HOST_LLD_DEPENDENCIES = host-llvm · line 20

Quoted 7 lines
package/lld/lld.mk +1 -0
@@ -14,6 +14,7 @@ HOST_LLD_DEPENDENCIES = host-llvm
 
 # GCC looks for tools in a different path from LLD's default installation path
 define HOST_LLD_CREATE_SYMLINKS
+	mkdir -p $(HOST_DIR)/$(GNU_TARGET_NAME)/bin
 	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

Why do we create symlinks inside the toolchain directory? I think this is confusing and it breaks external toolchains, because they might not be located at $(HOST_DIR)/$(GNU_TARGET_NAME). They might be located at:

	$(HOST_DIR)/toolchain/$(GNU_TARGET_NAME)
	/some/random/location/$(GNU_TARGET_NAME)

This change adds a mkdir -p, which silences this bug.

I think the right solution is to do away with HOST_LLD_CREATE_SYMLINKS, and just use a full path to lld (because it is not part of the toolchain):

	-fuse-ld=$(HOST_DIR)/bin/lld

Are you sure HOST_LLD_CREATE_SYMLINKS is needed?

Thanks,
Thomas Preston