[tip: timers/core] arm64: vdso32: Enable Clang Compilation

From: tip-bot2 for Vincenzo Frascino
Date: Sat Mar 21 2020 - 10:34:44 EST


The following commit has been merged into the timers/core branch of tip:

Commit-ID: a5d442f50a41d7c5a6a97b19c49d8a1ee0cf128b
Gitweb: https://git.kernel.org/tip/a5d442f50a41d7c5a6a97b19c49d8a1ee0cf128b
Author: Vincenzo Frascino <vincenzo.frascino@xxxxxxx>
AuthorDate: Fri, 20 Mar 2020 14:53:51
Committer: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
CommitterDate: Sat, 21 Mar 2020 15:24:03 +01:00

arm64: vdso32: Enable Clang Compilation

Enable Clang Compilation for the vdso32 library.

Signed-off-by: Vincenzo Frascino <vincenzo.frascino@xxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Tested-by: Nathan Chancellor <natechancellor@xxxxxxxxx> # build
Tested-by: Stephen Boyd <swboyd@xxxxxxxxxxxx>
Reviewed-by: Nathan Chancellor <natechancellor@xxxxxxxxx>
Acked-by: Catalin Marinas <catalin.marinas@xxxxxxx>
Cc: Will Deacon <will@xxxxxxxxxx>
Link: https://lkml.kernel.org/r/20200320145351.32292-27-vincenzo.frascino@xxxxxxx

---
arch/arm64/kernel/vdso32/Makefile | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile
index 04df57b..3964738 100644
--- a/arch/arm64/kernel/vdso32/Makefile
+++ b/arch/arm64/kernel/vdso32/Makefile
@@ -10,7 +10,18 @@ include $(srctree)/lib/vdso/Makefile

# Same as cc-*option, but using CC_COMPAT instead of CC
ifeq ($(CONFIG_CC_IS_CLANG), y)
+COMPAT_GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE_COMPAT)elfedit))
+COMPAT_GCC_TOOLCHAIN := $(realpath $(COMPAT_GCC_TOOLCHAIN_DIR)/..)
+
+CC_COMPAT_CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE_COMPAT:%-=%))
+CC_COMPAT_CLANG_FLAGS += --prefix=$(COMPAT_GCC_TOOLCHAIN_DIR)
+CC_COMPAT_CLANG_FLAGS += -no-integrated-as -Qunused-arguments
+ifneq ($(COMPAT_GCC_TOOLCHAIN),)
+CC_COMPAT_CLANG_FLAGS += --gcc-toolchain=$(COMPAT_GCC_TOOLCHAIN)
+endif
+
CC_COMPAT ?= $(CC)
+CC_COMPAT += $(CC_COMPAT_CLANG_FLAGS)
else
CC_COMPAT ?= $(CROSS_COMPILE_COMPAT)gcc
endif