Messages in this thread Patch in this message | | | Subject | Re: "arm64: vdso: Substitute gettimeofday() with C implementation" breaks clang build | From | Vincenzo Frascino <> | Date | Tue, 25 Jun 2019 18:00:27 +0100 |
| |
Hi Nick,
On 25/06/2019 17:26, Nick Desaulniers wrote: > On Tue, Jun 25, 2019 at 7:54 AM Vincenzo Frascino > <vincenzo.frascino@arm.com> wrote: >> >> Hi Qian, >> >> ... >> >>> >>> but clang 7.0 is still use in many distros by default, so maybe this commit can >>> be fixed by adding a conditional check to use "small" if clang version < 8.0. >>> >> >> Could you please verify that the patch below works for you? > > Should it be checking against CONFIG_CLANG_VERSION, or better yet be > using cc-option macro? >
This is what I did in my proposed patch, but I was surprised that clang-7 generates relocations that clang-8 does not.
LD arch/arm64/kernel/vdso/vdso.so.dbg VDSOCHK arch/arm64/kernel/vdso/vdso.so.dbg 00000000000009d0 R_AARCH64_JUMP_SLOT _mcount
arch/arm64/kernel/vdso/vdso.so.dbg: dynamic relocations are not supported make[1]: *** [arch/arm64/kernel/vdso/Makefile:59: arch/arm64/kernel/vdso/vdso.so.dbg] Error 1 make: *** [arch/arm64/Makefile:180: vdso_prepare] Error 2
This is the the result of the macro I introduced in lib/vdso/Makefile.
And I just found out why. I forgot to add a "+" in the patch provided :)
@Qian: Could you please retry with the one provided below?
-- Regards, Vincenzo
--->8----
From eed9ea23cf999d31b87db4b98a8e9de209706132 Mon Sep 17 00:00:00 2001 From: Vincenzo Frascino <vincenzo.frascino@arm.com> Date: Tue, 25 Jun 2019 15:49:37 +0100 Subject: [PATCH] arm64: vdso: Fix compilation with clang < 8
clang versions previous to 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@lca.pw> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com> --- arch/arm64/kernel/vdso/Makefile | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile index ec81d28aeb5d..5154f50aff2d 100644 --- a/arch/arm64/kernel/vdso/Makefile +++ b/arch/arm64/kernel/vdso/Makefile @@ -38,6 +38,11 @@ else CFLAGS_vgettimeofday.o = -O2 -mcmodel=tiny -include $(c-gettimeofday-y) endif +# Clang versions less than 8 do not support -mcmodel=tiny +ifeq ($(shell test $(CONFIG_CLANG_VERSION) -lt 80000; echo $$?),0) +CFLAGS_REMOVE_vgettimeofday.o += -mcmodel=tiny +endif + # Disable gcov profiling for VDSO code GCOV_PROFILE := n -- 2.22.0
| |