ANDROID: Makefile: add compiler-rt dependency explicitly

AOSP clang still has a dependency on libgcc_s (the "compiler runtime")
(upstream LLVM does not.) When building the kernel in a hermetic
environment, we observe the following linkage failures while building
host executables:

  HOSTCC  scripts/basic/fixdep
ld.lld: error: cannot open crtbegin.o: No such file or directory
ld.lld: error: unable to find library -lgcc
ld.lld: error: unable to find library -lgcc_s
ld.lld: error: unable to find library -lgcc
ld.lld: error: unable to find library -lgcc_s
ld.lld: error: cannot open crtend.o: No such file or directory

AOSP clang is not bound by the same dependencies for kernel builds that
it is for userspace; tell it to use LLVM's compiler runtime,
compiler-rt, instead explicitly. This allows us to drop the libgcc
dependency from our hermetic Docker image.

Bug: 65987925
Bug: 131098715
Bug: 135922132
Bug: 141693040
Suggested-by: Stephen Hines <srhines@google.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Change-Id: Ied7bd6fadd30fe56b85c2bfa59b5ea0a87d476d8
This commit is contained in:
Nick Desaulniers 2020-08-20 15:54:43 -07:00
parent 537c1df08e
commit f14e5bfb39

View File

@ -435,7 +435,7 @@ OBJDUMP = llvm-objdump
READELF = llvm-readelf
OBJSIZE = llvm-size
STRIP = llvm-strip
KBUILD_HOSTLDFLAGS += -fuse-ld=lld
KBUILD_HOSTLDFLAGS += -fuse-ld=lld --rtlib=compiler-rt
else
CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)ld