Created attachment 654674 [details, diff] Patch file for adding default-lld flag I'm testing musl-clang toolchain, for eliminating GNU toolchain(binutils, gcc, glibc) from stage3. Although llvm package itself provides most of tools like ar, as, nm, ranlib, etc. (which is provided by binutils), but ld is not included, as it's separated to lld package. Because of specifying LD environment variable causes annoying side-effects(even does not work with some package), the correct way to build the toolchain is, change the default linker used by clang. Fortunately, clang package supports it, by setting -CMAKE_DEFAULT_LINKER CMake flag with linker name(the default value is zero-length string, which means "Use ld provided by binutils"). Thus, please add default-lld USE flags to clang ebuild, as it has same concept with default-compiler-rt and default-libcxx flags, which is not required for normal use, but provides more convenient way to build llvm toolchain which is not depend on GNU toolchain.
CMAKE_DEFAULT_LINKER is typo, use CLANG_DEFAULT_LINKER.
Nope, the correct way is to set CFLAGS='-fuse-ld=lld' etc.
(and LDFLAGS most importantly)
I know there's an option like that, but build system of some package which mis-implementd handling variables (i.e. do not append provided option but just substitute, or just ignore it) should be patched independently if some option should be passed for using specific linker. I think it's better to set default linker than track and patch all of side effects on packages.
Specifying -fuse-ld=lld in CFLAGS, LDFLAGS, etc. may causes unwanted behavior on traditional systems, i.e. GCC using lld instead of bfd or gold. Per-package configuration is also possible though, I think that's not clean way to using LLVM+musl toolchain.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=905d7440aed62f76289b2306479685bfc1040466 commit 905d7440aed62f76289b2306479685bfc1040466 Author: Michał Górny <mgorny@gentoo.org> AuthorDate: 2020-08-18 15:22:12 +0000 Commit: Michał Górny <mgorny@gentoo.org> CommitDate: 2020-08-18 16:51:41 +0000 sys-devel/clang: Add USE=default-lld Closes: https://bugs.gentoo.org/737178 Signed-off-by: Michał Górny <mgorny@gentoo.org> sys-devel/clang/clang-10.0.1.ebuild | 8 +++++--- sys-devel/clang/clang-11.0.0.9999.ebuild | 8 +++++--- sys-devel/clang/clang-11.0.0_rc1.ebuild | 8 +++++--- sys-devel/clang/clang-12.0.0.9999.ebuild | 8 +++++--- sys-devel/clang/metadata.xml | 1 + 5 files changed, 21 insertions(+), 12 deletions(-)