Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scripts/Makefile.clang: default to LLVM_IAS=1

LLVM_IAS=1 controls enabling clang's integrated assembler via
-integrated-as. This was an explicit opt in until we could enable
assembler support in Clang for more architecures. Now we have support
and CI coverage of LLVM_IAS=1 for all architecures except a few more
bugs affecting s390 and powerpc.

This commit flips the default from opt in via LLVM_IAS=1 to opt out via
LLVM_IAS=0. CI systems or developers that were previously doing builds
with CC=clang or LLVM=1 without explicitly setting LLVM_IAS must now
explicitly opt out via LLVM_IAS=0, otherwise they will be implicitly
opted-in.

This finally shortens the command line invocation when cross compiling
with LLVM to simply:

$ make ARCH=arm64 LLVM=1

Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

authored by

Nick Desaulniers and committed by
Masahiro Yamada
f12b034a 52cc02b9

+11 -9
+8 -6
Documentation/kbuild/llvm.rst
··· 60 60 OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump READELF=llvm-readelf \ 61 61 HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar HOSTLD=ld.lld 62 62 63 - Currently, the integrated assembler is disabled by default. You can pass 64 - ``LLVM_IAS=1`` to enable it. 63 + The integrated assembler is enabled by default. You can pass ``LLVM_IAS=0`` to 64 + disable it. 65 65 66 66 Omitting CROSS_COMPILE 67 67 ---------------------- 68 68 69 69 As explained above, ``CROSS_COMPILE`` is used to set ``--target=<triple>``. 70 - 71 - Unless ``LLVM_IAS=1`` is specified, ``CROSS_COMPILE`` is also used to derive 72 - ``--prefix=<path>`` to search for the GNU assembler and linker. 73 70 74 71 If ``CROSS_COMPILE`` is not specified, the ``--target=<triple>`` is inferred 75 72 from ``ARCH``. ··· 75 78 76 79 For example, to cross-compile the arm64 kernel:: 77 80 78 - make ARCH=arm64 LLVM=1 LLVM_IAS=1 81 + make ARCH=arm64 LLVM=1 82 + 83 + If ``LLVM_IAS=0`` is specified, ``CROSS_COMPILE`` is also used to derive 84 + ``--prefix=<path>`` to search for the GNU assembler and linker. :: 85 + 86 + make ARCH=arm64 LLVM=1 LLVM_IAS=0 CROSS_COMPILE=aarch64-linux-gnu- 79 87 80 88 Supported Architectures 81 89 -----------------------
+3 -3
scripts/Makefile.clang
··· 22 22 CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%)) 23 23 endif # CROSS_COMPILE 24 24 25 - ifeq ($(LLVM_IAS),1) 26 - CLANG_FLAGS += -integrated-as 27 - else 25 + ifeq ($(LLVM_IAS),0) 28 26 CLANG_FLAGS += -no-integrated-as 29 27 GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit)) 30 28 CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE)) 29 + else 30 + CLANG_FLAGS += -integrated-as 31 31 endif 32 32 CLANG_FLAGS += -Werror=unknown-warning-option 33 33 KBUILD_CFLAGS += $(CLANG_FLAGS)