Re: [RFC] gcc feature request: Moving blocks into sections

Steven Rostedt
2013-08-06T03:03:38Z

On Mon, 2013-08-05 at 22:26 -0400, Jason Baron wrote:

> I think if the 'cold' attribute on the default disabled static_key
> branch moved the text completely out-of-line, it would satisfy your
> requirement here?
>
> If you like this approach, perhaps we can make something like this work
> within gcc. As its already supported, but doesn't quite go far enough
> for our purposes.

It may not be too bad to use.

>
> Also, if we go down this path, it means the 2-byte jump sequence is
> probably not going to be too useful.

Don't count us out yet :-)

static inline bool arch_static_branch(struct static_key *key)
{
asm goto("1:"
[...]
: : "i" (key) : : l_yes);
return false;
l_yes:
goto __l_yes;
__l_yes: __attribute__((cold));
return false;
}

Or put that logic in the caller of arch_static_branch(). Basically, we
may be able to do a short jump to the place that will do a long jump to
the real work.

I'll have to play with this and see what gcc does with the output.

-- Steve