Re: [PATCH 4/6] objtool: Replace STACK_FRAME_NON_STANDARD annotation

From: Peter Zijlstra
Date: Wed Feb 27 2019 - 07:21:09 EST


On Mon, Feb 25, 2019 at 10:11:24AM -0600, Josh Poimboeuf wrote:
> On Mon, Feb 25, 2019 at 01:43:34PM +0100, Peter Zijlstra wrote:

> > -#define STACK_FRAME_NON_STANDARD(func) \
> > - static void __used __section(.discard.func_stack_frame_non_standard) \
> > - *__func_stack_frame_non_standard_##func = func
> > +#define STACK_FRAME_NON_STANDARD(func) \
> > + asm (".pushsection .discard.nonstd_frame_strtab, \"S\", @3\n\t" \
> > + "999: .ascii \"" #func "\"\n\t" \
> > + " .byte 0\n\t" \
> > + ".popsection\n\t" \
> > + ".pushsection .discard.nonstd_frame\n\t" \
> > + ".long 999b - .\n\t" \
> > + ".popsection\n\t")
> > +
>
> I don't think this will work in the case where GCC does an IPA
> optimization and renames the function (e.g., renames func to
> func.isra.1234), right? That might be a deal breaker...

Or; as has been found by 0day; the whole function gets inlined and
the symbol no longer exists at all.

That's curable with a noinline, but all things considered, I think we
should go back to the old horrible scheme. Andy?