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


> While debugging some gdb-related FAILs, I discovered that gcc's
> -fstack-check option effectively calls alloca() to adjust the stack
> pointer.

Note that the subject is misleading, -fstack-check is stack checking and not 
stack protection, which is -fstack-protector.

> However, it doesn't mark the stack adjustment as FRAME_RELATED even
> when it's setting up the local variables for the function.
> 
> In the case of rx-elf, for this testcase, the CFA for the function is
> defined in terms of the stack pointer - and thus is incorrect after
> the alloca call.

That's the bug, any function using alloca must use the frame pointer as CFA.

> My question is: who's fault is this?  Should alloca() tell the debug
> stuff that the stack pointer has changed?  Should it tell it to not
> use $sp at all?  Should the debug stuff "just know" that $sp isn't a
> valid choice for the CFA?

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

-- 
Eric Botcazou


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