Skip to content

RFC ARM: assembler: Add uniform assembler framework

Dave Martin linux-arm-kernel 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest0 of 2 patches 0 repliesNew

Patches in v1 No applies recorded yet

None of the 2 patches the cover letter announces are in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/2] ARM: assembler: Add uniform assembler framework
Quoted 17 lines · Dave Martin
Quoted 12 lines · Russell King - ARM Linux
Quoted 10 lines · Dave Martin

#ifdef __ASSEMBLY__
stuff
for
the
assembler
#else
asm("stuff");
asm("for");
asm("the");
asm("assembler");

Quoted 3 lines

That's invalid - nothing guarantees that the compiler won't place anything in between these asm statements in the output assembly file.

Quoted 8 lines

Within a function that would be certainly true -- at the top-level, I'm less sure. Since there is no sequential code at the top level, only declarations, it's hard to see why the compiler would ever consider pasting something in the middle of that block or reordering it. Without constraints, the compiler simply has no idea what's there (such asms are implicitly "volatile", though that could be added for clarity). You're right that all this may amount to less than a guarantee, though...

A quick follow up on this -- having chatted to tools guys, it sounds like you're quite right on this: it is indeed unsafe, without -fno-toplevel-reorder (which would impair some optimisations)

Of course, this also means that unified.h is unsafe for the same reasons -- there is no guarantee that the big asm block containing all the IT macro definitions will precede compiler-generated code in the input to the assembler (and, presumably, inline asms embedded in it) in the compiler output...

Cheers
---Dave