Re: GCC complains about nested functions despite none being present

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jun 25, 2017 at 2:46 PM, Ian Lance Taylor via gcc-help
<gcc-help@xxxxxxxxxxx> wrote:
> On Sun, Jun 25, 2017 at 11:41 AM, Maxim Blinov <maxim.a.blinov@xxxxxxxxx> wrote:
>>
>> However, what is a static chain pointer exactly? After some reading, I
>> understand it to be used for retrieving locals from the caller's
>> frame, but how would this functionality be relevant to C?
>
> GCC supports nested functions as a C extension.
> https://gcc.gnu.org/onlinedocs/gcc-7.1.0/gcc/Nested-Functions.html#Nested-Functions
>
> I don't know why you get the error in code that doesn't use static
> functions.  It may be a minor bug--an unnecessary call to to the
> static_chain hook.

It may be more than a minor bug. The trampoline often requires an
executable stack, and that's usually a SDLC violation.

Maybe worse, you could silently lose NX-stacks because GCC does not
warn about it. To produce a warning, you need -Wtrampoline, which is
off by default. I know very few people who configure with the warning
to detect loss of NX-stacks.

And of course, if you don't care about SDLCs, then everything is fine.

Jeff



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux