Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cb87cb11 authored by Sami Tolvanen's avatar Sami Tolvanen
Browse files

ANDROID: kbuild: disable clang-specific configs with other compilers



cuttlefish_defconfig explicitly enables options that fail to compile
with compilers other than clang. This change detects when a different
compiler is used and disables clang-specific features after printing
a warning.

Bug: 145297810
Change-Id: I3371576b45c9715a63c5668ab58e996cab612f53
Signed-off-by: default avatarSami Tolvanen <samitolvanen@google.com>
parent f960b38e
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -596,6 +596,8 @@ ifeq ($(dot-config),1)
-include include/config/auto.conf

ifeq ($(KBUILD_EXTMOD),)
include/config/auto.conf.cmd: check-clang-specific-options

# Read in dependencies to all Kconfig* files, make sure to run
# oldconfig if changes are detected.
-include include/config/auto.conf.cmd
@@ -1225,6 +1227,22 @@ else
endif
endif

# Disable clang-specific config options when using a different compiler
clang-specific-configs := LTO_CLANG CFI_CLANG SHADOW_CALL_STACK

PHONY += check-clang-specific-options
check-clang-specific-options: $(KCONFIG_CONFIG) FORCE
ifneq ($(cc-name),clang)
ifneq ($(findstring y,$(shell $(CONFIG_SHELL) \
	$(srctree)/scripts/config --file $(KCONFIG_CONFIG) \
		$(foreach c,$(clang-specific-configs),-s $(c)))),)
	@echo WARNING: Disabling clang-specific options with $(cc-name) >&2
	$(Q)$(srctree)/scripts/config --file $(KCONFIG_CONFIG) \
		$(foreach c,$(clang-specific-configs),-d $(c)) && \
	$(MAKE) -f $(srctree)/Makefile olddefconfig
endif
endif

# Check for CONFIG flags that require compiler support. Abort the build
# after .config has been processed, but before the kernel build starts.
#