From: Vincenzo Frascino <vincenzo.frascino@arm.com>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Qian Cai <cai@lca.pw>, Thomas Gleixner <tglx@linutronix.de>,
Nathan Chancellor <natechancellor@gmail.com>,
Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: "arm64: vdso: Substitute gettimeofday() with C implementation" breaks clang build
Date: Tue, 25 Jun 2019 18:00:27 +0100 [thread overview]
Message-ID: <193c179e-16ca-4b4e-2584-75e8f6c1819f@arm.com> (raw)
In-Reply-To: <CAKwvOdmCFjunXRbninTdqoDGPNJ6b7npgXLAPYGqFZas5ofNjw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1241 bytes --]
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----
[-- Attachment #2: 0001-arm64-vdso-Fix-compilation-with-clang-8.patch --]
[-- Type: text/x-patch, Size: 1131 bytes --]
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
[-- Attachment #3: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-06-25 17:00 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-25 12:16 "arm64: vdso: Substitute gettimeofday() with C implementation" breaks clang build Qian Cai
2019-06-25 12:47 ` Vincenzo Frascino
2019-06-25 12:56 ` Qian Cai
2019-06-25 13:40 ` Vincenzo Frascino
2019-06-25 13:51 ` Qian Cai
2019-06-25 14:11 ` Vincenzo Frascino
2019-06-25 14:28 ` Qian Cai
2019-06-25 14:30 ` Vincenzo Frascino
2019-06-25 14:54 ` Vincenzo Frascino
2019-06-25 15:16 ` Qian Cai
2019-06-25 16:26 ` Nick Desaulniers
2019-06-25 17:00 ` Vincenzo Frascino [this message]
2019-06-25 17:31 ` Qian Cai
2019-06-25 17:33 ` Vincenzo Frascino
2019-06-26 9:38 ` Will Deacon
2019-06-26 9:45 ` Vincenzo Frascino
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=193c179e-16ca-4b4e-2584-75e8f6c1819f@arm.com \
--to=vincenzo.frascino@arm.com \
--cc=cai@lca.pw \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=natechancellor@gmail.com \
--cc=ndesaulniers@google.com \
--cc=tglx@linutronix.de \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).