[tip:timers/vdso] arm64: vdso: Fix compilation with clang older than 8

From: tip-bot for Vincenzo Frascino
Date: Wed Jun 26 2019 - 08:39:59 EST


Commit-ID: 3acf4be235280f14d838581a750532219d67facc
Gitweb: https://git.kernel.org/tip/3acf4be235280f14d838581a750532219d67facc
Author: Vincenzo Frascino <vincenzo.frascino@xxxxxxx>
AuthorDate: Wed, 26 Jun 2019 12:36:32 +0100
Committer: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
CommitDate: Wed, 26 Jun 2019 14:26:55 +0200

arm64: vdso: Fix compilation with clang older than 8

clang versions older than 8 do not support -mcmodel=tiny.

Add a check to the vDSO Makefile for arm64 to remove the flag when
these versions of the compiler are detected.

Reported-by: Qian Cai <cai@xxxxxx>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@xxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Tested-by: Qian Cai <cai@xxxxxx>
Cc: linux-arch@xxxxxxxxxxxxxxx
Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
Cc: linux-mips@xxxxxxxxxxxxxxx
Cc: linux-kselftest@xxxxxxxxxxxxxxx
Cc: catalin.marinas@xxxxxxx
Cc: will.deacon@xxxxxxx
Cc: arnd@xxxxxxxx
Cc: linux@xxxxxxxxxxxxxxx
Cc: ralf@xxxxxxxxxxxxxx
Cc: paul.burton@xxxxxxxx
Cc: daniel.lezcano@xxxxxxxxxx
Cc: salyzyn@xxxxxxxxxxx
Cc: pcc@xxxxxxxxxx
Cc: shuah@xxxxxxxxxx
Cc: 0x7f454c46@xxxxxxxxx
Cc: linux@xxxxxxxxxxxxxxxxxx
Cc: huw@xxxxxxxxxxxxxxx
Cc: sthotton@xxxxxxxxxxx
Cc: andre.przywara@xxxxxxx
Cc: luto@xxxxxxxxxx
Link: https://lkml.kernel.org/r/20190626113632.9295-1-vincenzo.frascino@xxxxxxx

---
arch/arm64/kernel/vdso/Makefile | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile
index ec81d28aeb5d..4ab863045188 100644
--- a/arch/arm64/kernel/vdso/Makefile
+++ b/arch/arm64/kernel/vdso/Makefile
@@ -38,6 +38,13 @@ else
CFLAGS_vgettimeofday.o = -O2 -mcmodel=tiny -include $(c-gettimeofday-y)
endif

+# Clang versions less than 8 do not support -mcmodel=tiny
+ifeq ($(CONFIG_CC_IS_CLANG), y)
+ ifeq ($(shell test $(CONFIG_CLANG_VERSION) -lt 80000; echo $$?),0)
+ CFLAGS_REMOVE_vgettimeofday.o += -mcmodel=tiny
+ endif
+endif
+
# Disable gcov profiling for VDSO code
GCOV_PROFILE := n