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

Re: Next version of libtemplates-parser in Debian



On 05/24/2011 11:00 AM, Pascal Obry wrote:
>> Actually these cases are not so rare. As soon as you use Ada.Containers
>> you are almost there. 'Access to a nested function is enough. The
>> following code illustrates this:
> 
> This was the case...
> 
>> The stack of the resulting binary is executable:
>>
>> GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
>>                 0x0000000000000000 0x0000000000000000  RWE    8
>>
>> Tested with gnat in Lenny, Squeeze and sid (amd64/i386).
>>
>> It's interesting that the same code compiled with GNAT GPL 2010 does not
>> result in an executable stack:
>>
>> GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
>>                 0x0000000000000000 0x0000000000000000  RW     8
> 
> ... but as you found out some work as been done to remove most cases
> where a stack
> must be executable.

Yes. But as it seems this work has not (yet) been merged into FSF gcc.

I'm looking into FSF gcc trunk right now to find out if the following
work found in the GNAT GPL 2010 compiler (file: src/gcc-43.dif) has been
merged:

2008-05-25  Eric Botcazou  <ebotcazou@adacore.com>
   Elimination of stack trampolines
   ...[snip]...

Part of this huge patch introduces the -fno-trampolines compiler option:

"-fno-trampolines is enabled by default to let the compiler avoid
generating them if it computes that this is safe, on a case by case
basis, and replace them with descriptors.  Descriptors are always made
up of data only, but the generated code must be prepared to deal with them."

This option does not exist in gcc (Debian 4.4.5-8) 4.4.5:
gnat1: error: unrecognized command line option "-fno-trampolines"

It works (as expected) with GNAT GPL 2010. If you specify -ftrampolines,
the stack is set executable as well.

@xavier: Can you test if such an option exists in gcc 4.6.0?

- reto


Reply to: