What is the precise definition of NOTE_INSN_FUNCTION_BEG?

Segher Boessenkool segher@kernel.crashing.org
Thu May 2 15:33:00 GMT 2019

On Thu, May 02, 2019 at 01:02:14PM +0000, Matthew Malcomson wrote:
> On 01/05/19 20:40, Segher Boessenkool wrote:
> > On Tue, Apr 30, 2019 at 03:48:02PM -0600, Jeff Law wrote:
> >> On 4/30/19 11:24 AM, Matthew Malcomson wrote:
> >>> That was why I ended up suggesting multiple notes -- it's currently
> >>> trying to satisfy more than one criteria and they're not quite compatible.
> >> Well, we obviously have to keep arg setup, asan, stack protector and
> >> nonlocal stuff in the same relative order, but I believe they should all
> >> ultimately land before the NOTE_INSN_FUNCTION_BEG.  THe question is how
> >> to make that happen :-)
> > 
> > The current meaning of NOTE_INSN_FUNCTION_BEG is
> > 
> >    /* Indicate the beginning of the function body,
> >       as opposed to parm setup.  */
> >    emit_note (NOTE_INSN_FUNCTION_BEG);
> > 
> > (function.c), and half of the things that use the note think that
> > everything before it is argument setup, and nothing after it is.
> > 
> > Just adding extra notes isn't enough afaics; some surgery is needed.
> Apologies, I don't follow -- could you elaborate on why an extra note is 
> not enough?
> If this note is trying to mark the end of the argument setup for those 
> places you mention, and the start of user code for debug output, and 
> those are not the same place then I would have thought splitting it 
> would be necessary.

Because other things want to use it as the place to put stack checking,
for example.  And that cannot be after this note, but it can also not
be before it.

Is there any reason the stack checking code is inserted way before the
prologue/epilogue are, btw?


More information about the Gcc mailing list