Re: [PATCH 2/3] objtool: Ignore retpoline alternatives

From: Linus Torvalds
Date: Thu Jan 11 2018 - 12:29:55 EST


On Thu, Jan 11, 2018 at 8:27 AM, David Woodhouse <dwmw2@xxxxxxxxxxxxx> wrote:
>
> <mode name="peterz">
> Ick, numbers. Use .Lfoo_%= instead.
> </mode>

Actually, I think PeterZ is wrong on this one.

First off, we do *not* use %= in inline asms in the kernel yet, and we
shouldn't start just because of these.

Secondly, we use lots of the the "small numbers for local labels" both
in inline asm and in *.S files.

I think doing

jne 1f
...
1:

is a _hell_ of a lot more legible than

jne .LPrefix_%
...
.LPrefix_%

unless you have some *major* reason to use an explicit label name.

Sure, if you grew up writing perl, and think that an illegible mess of
random characters is a requirement for programming, then the ".L%"
format looks natural.

But if you're an actual human, the "small numbers as labels" is fine.

The one requirement for the small numbers thing is that you really
have to give the direction when you use them. Because re-using the
same number *will* happen, and is normal.

That, btw, is also why it's pointless to make the small numbers
"bigger". Using "1122" as a label is actively worse than just using
"1".

You shouldn't try to fool yourself and think that your number is
"unique". It doesn't need to be. A label needs to be unique within one
use, and the use just tells _which_ of the non-unique numbers you use.

And yes, you could even re-use the number within one macro or inline
asm. But that's just confusing. Make the number unique for the
particular macro or inline use.

Linus