From: Catalin Marinas catalin.marinas@arm.com
mainline inclusion from v5.6-rc1 commit 42d519e3d0c0 category: feature bugzilla: 27615 CVE: NA
-------------------------------------------------
Similar to 'cc-option' or 'ld-option', it is occasionally necessary to check whether the assembler supports certain ISA extensions. In the arm64 code we currently do this in Makefile with an additional define:
lseinstr := $(call as-instr,.arch_extension lse,-DCONFIG_AS_LSE=1)
Add the 'as-instr' option so that it can be used in Kconfig directly:
def_bool $(as-instr,.arch_extension lse)
Acked-by: Masahiro Yamada masahiroy@kernel.org Reviewed-by: Vladimir Murzin vladimir.murzin@arm.com Tested-by: Vladimir Murzin vladimir.murzin@arm.com Signed-off-by: Catalin Marinas catalin.marinas@arm.com Signed-off-by: Will Deacon will@kernel.org
Conflicts: scripts/Kconfig.include [Zheng Zengkai: fix conflicts caused by skipping the following commit. 75959d44f9 kbuild: Fail if gold linker is detected 902a6898bf kbuild: terminate Kconfig when $(CC) or $(LD) is missing]
Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com Reviewed-by: Hanjun Guo guohanjun@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- scripts/Kconfig.include | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/scripts/Kconfig.include b/scripts/Kconfig.include index 79455ad6b3863..6db0e7cd0310b 100644 --- a/scripts/Kconfig.include +++ b/scripts/Kconfig.include @@ -26,5 +26,9 @@ cc-option = $(success,$(CC) -Werror $(CLANG_FLAGS) $(1) -S -x c /dev/null -o /de # Return y if the linker supports <flag>, n otherwise ld-option = $(success,$(LD) -v $(1))
+# $(as-instr,<instr>) +# Return y if the assembler supports <instr>, n otherwise +as-instr = $(success,printf "%b\n" "$(1)" | $(CC) $(CLANG_FLAGS) -c -x assembler -o /dev/null -) + # gcc version including patch level gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh -p $(CC) | sed 's/^0*//')