From bca38c6f6800647c86b281ea380da93dfe1df426 Mon Sep 17 00:00:00 2001 From: Michael Bestas Date: Thu, 8 Sep 2022 04:19:32 +0300 Subject: [PATCH] kernel: Use LLVM binutils by default * GCC has been completely removed in AOSP but we keep it for compatibility reasons with older kernels until they are adapted to remove all the dependencies to GCC. * Most updated 4.19+ kernels should be able to use LLVM binutils out of the box. 4.14 is possible with a few patches and 4.9 with even more patches. * Make this the default and allow devices opting out by using TARGET_KERNEL_LLVM_BINUTILS := false Change-Id: I569cf290b41aaf2dc16ff9cc4cc6dc461f0d504e --- config/BoardConfigKernel.mk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config/BoardConfigKernel.mk b/config/BoardConfigKernel.mk index 986e0864..33e37538 100644 --- a/config/BoardConfigKernel.mk +++ b/config/BoardConfigKernel.mk @@ -27,6 +27,7 @@ # x86_64-linux-android- for x86 # # TARGET_KERNEL_CLANG_COMPILE = Compile kernel with clang, defaults to true +# TARGET_KERNEL_LLVM_BINUTILS = Use LLVM binutils, defaults to true # TARGET_KERNEL_VERSION = Reported kernel version in top level kernel # makefile. Can be overriden in device trees # in the event of prebuilt kernel. @@ -172,9 +173,9 @@ KERNEL_MAKE_CMD := $(BUILD_TOP)/prebuilts/build-tools/$(HOST_PREBUILT_TAG)/bin/m KERNEL_MAKE_FLAGS += HOSTCC=$(CLANG_PREBUILTS)/bin/clang KERNEL_MAKE_FLAGS += HOSTCXX=$(CLANG_PREBUILTS)/bin/clang++ -# Use LLVM's substitutes for GNU binutils if compatible kernel version. +# Use LLVM's substitutes for GNU binutils ifneq ($(TARGET_KERNEL_CLANG_COMPILE), false) -ifneq (,$(filter 5.4 5.10, $(TARGET_KERNEL_VERSION))) +ifneq ($(TARGET_KERNEL_LLVM_BINUTILS), false) KERNEL_MAKE_FLAGS += LLVM=1 LLVM_IAS=1 KERNEL_MAKE_FLAGS += LD=$(CLANG_PREBUILTS)/bin/ld.lld KERNEL_MAKE_FLAGS += AR=$(CLANG_PREBUILTS)/bin/llvm-ar