Re: [PATCH] arm64: lse: fix LSE atomics with LLVM's integrated assembler

From: Robin Murphy
Date: Wed Oct 09 2019 - 06:03:32 EST


On 2019-10-08 10:03 pm, Ard Biesheuvel wrote:
On Tue, 8 Oct 2019 at 18:19, Robin Murphy <robin.murphy@xxxxxxx> wrote:

On 08/10/2019 16:22, Sami Tolvanen wrote:
On Mon, Oct 7, 2019 at 2:46 PM 'Nick Desaulniers' via Clang Built
Linux <clang-built-linux@xxxxxxxxxxxxxxxx> wrote:
I'm worried that one of these might lower to LSE atomics without
ALTERNATIVE guards by blanketing all C code with `-march=armv8-a+lse`.

True, that's a valid concern. I think adding the directive to each
assembly block is the way forward then, assuming the maintainers are
fine with that.

It's definitely a valid concern in principle, but in practice note that
lse.h ends up included in ~99% of C files, so the extension is enabled
more or less everywhere already.


lse.h currently does

__asm__(".arch_extension lse");

which instructs the assembler to permit the use of LSE opcodes, but it
does not instruct the compiler to emit them, so this is not quite the
same thing.

Derp, of course it isn't. And IIRC we can't just pass the option through with -Wa either because at least some versions of GCC emit an explicit .arch directive at the top of the output. Oh well; sorry for the distraction.

Robin.