[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wjWez4jFa1sbkhMqGktFPDMvd3kojibwFyTkGOL2xrp5w@mail.gmail.com>
Date: Mon, 18 Jul 2022 15:55:51 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Segher Boessenkool <segher@...nel.crashing.org>
Cc: Michael Ellerman <mpe@...erman.id.au>,
Kees Cook <keescook@...omium.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
Paul Mackerras <paulus@...ba.org>,
linux-hardening@...r.kernel.org,
linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>,
Sudip Mukherjee <sudipm.mukherjee@...il.com>
Subject: Re: mainline build failure of powerpc allmodconfig for prom_init_check
On Mon, Jul 18, 2022 at 3:12 PM Segher Boessenkool
<segher@...nel.crashing.org> wrote:
>
> Assembler language is unforgiving. It isn't easy to write, and most
> mistakes will not be diagnosed. If the assmbler language makes it
> easier to read the code, that makes it more likely correct code will be
> written, and that correct code will be written in less time.
What's your argument? That it's unforgiving, so it has to be
unreadable and easy to make mistakes in too?
You can get the order of operands wrong, and it will still build -
just to completely the wrong thing.
> > Oddities, yes ("$" as a prefix for register? Alpha asm is also very
> > odd), but nothing *quite* as broken as "simple constants have entirely
> > different meanings depending on the exact instruction and argument
> > position".
>
> What is broken about that? It makes everything very consistent, and
> very readable. Sigils are just nasty, and having the register names the
> same as valid symbol names is also problematic.
Oh, I agree that sigils are good to make the type clear. So '%r4' is
better than 'r4' because the latter could be ambiguous and you could
have a symbol 'r4'.
But just '4' is plain garbage. There's no "could be ambiguous" about it.
Type checking matters. Not just in C. In asm too.
The reason '$0' is odd because it's *just* a sigil and a number.
Which certainly is not unusual in itself, but it reads like it's a
number to me. Not just because of x86 gas ('$' means 'immediate'), but
Z80 ('$' means HEX), or at least 'Nth argument' (shell).
And yeah, alpha got it from MIPS, afaik.
And presumably MIPS got it from "we're hacking up the simplest
assembler we can".
> > The human-written asm files have those #define's in headers just to
> > make things slightly more legible, because apparently the assembler
> > doesn't even *accept* the sane names.
>
> That was true a long time ago. And the "#define r0 0" thing caused
> quite a few bugs itself btw.
Those #define's still exist. Look it up.
And yes, they are horrible, and they are wrong, and they shouldn't exist.
Linus
Powered by blists - more mailing lists