This is the mail archive of the gcc@gcc.gnu.org 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


> The last stack adjustment it sees is
> the rx backend's adjustment to allocate the frame:
> 
> _medium_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
>    7:

I gather that r0 is the stack pointer and r6 the frame pointer?

> 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 )

If so, the above DW_CFA_def_cfa_register doesn't make sense, it should be r6 
once the frame is established.  What does the CIE contain exactly?

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

No, the design is that stack checking or alloca force the use of the frame 
pointer, which thus becomes the CFA register, which means that subsequent 
stack adjustments are irrelevant for the CFI.

-- 
Eric Botcazou


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