Commit 587b7a0a authored by Nick Desaulniers's avatar Nick Desaulniers Committed by Alistair Delva
Browse files

FROMLIST: Makefile: add -fuse-ld=lld to KBUILD_HOSTLDFLAGS when LLVM=1



While moving Android kernels over to use LLVM=1, we observe the failure
when building in a hermetic docker image:
  HOSTCC  scripts/basic/fixdep
clang: error: unable to execute command: Executable "ld" doesn't exist!

The is because the build of the host utility fixdep builds the fixdep
executable in one step by invoking the compiler as the driver, rather
than individual compile then link steps.

Clang when configured from source defaults to use the system's linker,
and not LLVM's own LLD, unless the CMake config
-DCLANG_DEFAULT_LINKER='lld' is set when configuring a build of clang
itself.

Don't rely on the compiler's implicit default linker; be explicit.

Fixes: commit a0d1c951 ("kbuild: support LLVM=1 to switch the default tools to Clang/LLVM")
Reported-by: default avatarMatthias Maennich <maennich@google.com>
Signed-off-by: default avatarNick Desaulniers <ndesaulniers@google.com>
Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
Cc: stable@vger.kernel.org

Bug: 116869922
Bug: 141693040
Link: https://lore.kernel.org/lkml/20200820220955.3325555-1-ndesaulniers@google.com/T/#u


Signed-off-by: default avatarNick Desaulniers <ndesaulniers@google.com>
Change-Id: I54b79beceb669ec06a017d3f5c3627ccf3655986
(cherry picked from commit ce929109a222fb16af92a6e5b0a618d4416d51a2)
parent ffb6c5f4
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment