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

From: Ingo Molnar
Date: Fri Jan 12 2018 - 15:36:31 EST



* Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:

> > But if you're an actual human, the "small numbers as labels" is fine.
>
> I find descriptive labels much nicer than random numbers, I'll take some
> crazy characters if so required.
>
>
> Consider the retpoline thing:
>
> call .Lset_up_target
> .Lcapture_spec:
> pause
> jmp .Lcapture_spec
> .Lset_up_target:
> mov %r11, (%rsp);
> ret;
>
>
> over:
>
> call 2f
> 1:
> pause
> jmp 1b
> 2:
> mov %r11, (%rsp)
> ret
>
>
> give me the first any day of the week.

Absolutely, in fact I detest what we have:

+#define __FILL_RETURN_BUFFER(reg, nr, sp) \
+ mov $(nr/2), reg; \
+771: \
+ call 772f; \
+773: /* speculation trap */ \
+ pause; \
+ jmp 773b; \
+772: \
+ call 774f; \
+775: /* speculation trap */ \
+ pause; \
+ jmp 775b; \
+774: \
+ dec reg; \
+ jnz 771b; \
+ add $(BITS_PER_LONG/8) * nr, sp;

I mean, WTF??

Also, note that this:

> call .Lset_up_target
> .Lcapture_spec:
> pause
> jmp .Lcapture_spec
> .Lset_up_target:
> mov %r11, (%rsp);
> ret;
>

becomes even more readable with a bit more human-readability improvements:

call .L_set_up_target

.L_capture_spec:
pause
jmp .L_capture_spec

.L_set_up_target:
mov %r11, (%rsp)
ret

I.e. the underscores in the label names, the tabs and the newlines create better
vertical and horizontal separation between the syntactical elements and provide
grouping of larger constructs.

Thanks,

Ingo