Re: [PATCH] ARM: mtd-xip: work around clang/llvm bug

From: Linus Walleij
Date: Tue Jul 09 2019 - 07:48:27 EST


On Tue, Jul 9, 2019 at 11:17 AM Russell King - ARM Linux admin
<linux@xxxxxxxxxxxxxxx> wrote:
> On Tue, Jul 09, 2019 at 10:41:05AM +0200, Linus Walleij wrote:
> > I guess this brings up the old question whether the compiler should
> > be worked around or just considered immature, but as it happens this
> > other day I was grep:ing around to find "the 8 NOP" that is so
> > compulsively inserted in ARM executables (like at the very start of
> > the kernel execution)
>
> The NOPs at the start of the kernel executable have nothing what so ever
> to do with this. They are there to align the kernel entry with the old
> a.out format that was used (which had a 32 byte header). Consequently,
> there are boot loaders around that jump to 32 bytes into the kernel
> header.

Wow! Finally the puzzle pieces come together. And it makes a lot
of sense.

> There are other places that we insert 10 NOPs (at cpu_relax()) due to a
> CPU errata (otherwise a tight loop basically stalls other CPUs.)

Pretty interesting too!

I try to learn a bit more intrinsics of the Arm architecture (been doing
assembly experiments recent days) so getting to know things like
this is very valuable.

Yours,
Linus Walleij