This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: stack-protection vs alloca vs dwarf2

> Presumably the rx back-end and more precisely TARGET_FRAME_POINTER_REQUIRED, 
> which needs to return true if cfun->calls_alloca.

The rx back-end doesn't define TARGET_FRAME_POINTER_REQUIRED, as the
documentation says the compiler handles target-independent reasons why
there needs to be a frame pointer.  But, the default
TARGET_FRAME_POINTER_REQUIRED just returns false - shouldn't it, by
default, check for calls_alloca ?

Also, I added that hook and set it to return true always, and it
didn't fix the bug.  There is a frame pointer (there was before, too),
but there's also a stack adjustment after the pseudo-alloca which the
dwarf2 stuff doesn't know about.  The last stack adjustment it sees is
the rx backend's adjustment to allocate the frame:

        pushm   r6-r12                   
        add     #-4, r0, r6              ; marked frame-related (fp = sp - 4)
        mov.L   r6, r0                   ; marked frame-related (sp = fp)
	. . .				 ; stack checking code goes here
        add     #0xffffc000, r0          ; not marked frame-related

00000000 <_medium_frame>:
   0:   6e 6c                           pushm   r6-r12
   2:   71 06 fc                        add     #-4, r0, r6
   5:   ef 60                           mov.l   r6, r0

  2e:   72 00 00 c0                     add     #0xffffc000, r0, r0

00000014 00000030 00000000 FDE cie=00000000 pc=00000000..00000043
  DW_CFA_advance_loc4: 2 to 00000002
  DW_CFA_def_cfa_offset: 32
  DW_CFA_offset: r12 at cfa-8
  . . .
  DW_CFA_offset: r6 at cfa-32
  DW_CFA_advance_loc4: 3 to 00000005
  DW_CFA_def_cfa: r6 ofs 36
  DW_CFA_advance_loc4: 2 to 00000007
  DW_CFA_def_cfa_register: r0
  ( that's it for debug info )

Perhaps the stack-check code should set FRAME_RELATED on any stack
adjustment insn?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]