mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Andrey Konovalov <andreyknvl@google.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>,
	ard.biesheuvel@linaro.org,
	Catalin Marinas <catalin.marinas@arm.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Kostya Serebryany <kcc@google.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: Clang build of arm64 kernel fails
Date: Thu, 1 Mar 2018 09:45:24 +0000	[thread overview]
Message-ID: <d601e0ca-dd91-3dd4-c610-dd2ae49aa1b6@arm.com> (raw)
In-Reply-To: <CAAeHK+wRcZ1o53CEpeOQ-J5AayVAd8nm-ASj8HsTy1vOzHQAqQ@mail.gmail.com>

Hi Andrey,

On 28/02/18 19:32, Andrey Konovalov wrote:
> Hi Marc!
> 
> I've tried to pull in new upstream commits and the kernel build
> started failing for me with the following errors (see below).
> 
> It seems that the reason is your commit "arm64: Add
> ARM_SMCCC_ARCH_WORKAROUND_1 BP hardening support". It seems that Clang
> doesn't like 32 bits registers being used in 64 bits build.

I'd say this is really a bug in Clang. Architecturally, the register in 
AArch64 state is still named "r0"; "x0"/"w0" are assembler operands 
which additionally encode the size of the corresponding *access* to r0.

I note that GCC's documentation on register variables[1] does just say 
"the name of the register", which implies this code is not incorrect. 
Given that Clang already likes to infer the operand size from the 
argument type in actual inline asms, it seems funny that its register 
allocator should care in this non-instruction context.

> Would you mind sending a fix?

That said, I guess it's a bug we might have to work around anyway. Oh well.

Robin.

[1] 
https://gcc.gnu.org/onlinedocs/gcc/Global-Register-Variables.html#Global-Register-Variables

> 
> Thanks!
> 
> arch/arm64/kernel/cpu_errata.c:156:2: error: unknown register name 'r0' in asm
>          arm_smccc_1_1_smc(ARM_SMCCC_ARCH_WORKAROUND_1, NULL);
>          ^
> ./include/linux/arm-smccc.h:276:32: note: expanded from macro
> 'arm_smccc_1_1_smc'
> #define arm_smccc_1_1_smc(...)  __arm_smccc_1_1(SMCCC_SMC_INST, __VA_ARGS__)
>                                  ^
> ./include/linux/arm-smccc.h:255:3: note: expanded from macro '__arm_smccc_1_1'
>                  __declare_args(__count_args(__VA_ARGS__), __VA_ARGS__); \
>                  ^
> ./include/linux/arm-smccc.h:240:37: note: expanded from macro '__declare_args'
> #define __declare_args(count, ...)  ___declare_args(count, __VA_ARGS__)
>                                      ^
> ./include/linux/arm-smccc.h:239:37: note: expanded from macro '___declare_args'
> #define ___declare_args(count, ...) __declare_arg_ ## count(__VA_ARGS__)
>                                      ^
> <scratch space>:136:1: note: expanded from here
> __declare_arg_0
> ^
> ./include/linux/arm-smccc.h:197:32: note: expanded from macro '__declare_arg_0'
>          register u32           r0 asm("r0") = a0;
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

  reply	other threads:[~2018-03-01  9:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-28 19:32 Andrey Konovalov
2018-03-01  9:45 ` Robin Murphy [this message]
2018-03-01 10:31   ` Dave Martin
2018-03-22 18:55     ` Matthias Kaehlcke
2018-03-01 10:47 ` Marc Zyngier
2018-03-01 12:31   ` Andrey Konovalov

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=d601e0ca-dd91-3dd4-c610-dd2ae49aa1b6@arm.com \
    --to=robin.murphy@arm.com \
    --cc=andreyknvl@google.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=dvyukov@google.com \
    --cc=kcc@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@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

all inboxes | Powered by JetHome®