On Wed, Oct 10, 2018 at 01:16:05PM -0500, Josh Poimboeuf wrote:
> On Wed, Oct 10, 2018 at 11:03:43AM -0700, Andy Lutomirski wrote:
> > > +#define DECLARE_STATIC_CALL(tramp, func)                               \
> > > +       extern typeof(func) tramp;                                      \
> > > +       static void __used __section(.discard.static_call_tramps)       \
> > > +               *__static_call_tramp_##tramp = tramp
> > > +
> > 
> > Confused.  What's the __static_call_tramp_##tramp variable for?  And
> > why is a DECLARE_ macro defining a variable?
> 
> This is the magic needed for objtool to find all the call sites.
> 
> The variable itself isn't needed, but the .discard.static_call_tramps
> entry is.  Objtool reads that section to find out which function call
> sites are targeted to a static call trampoline.

To clarify: objtool reads that section to find out which functions are
really static call trampolines.  Then it annotates all the instructions
which call/jmp to those trampolines.  Those annotations are then read by
the kernel.

-- 
Josh

Reply via email to