I found that when we use nested functions, GCC requires an executable stack for trampoline code. However, following code, when compiled using gcc doesn't show an executable stack. (I used execstack to verify if the stack is executable)
#include <stdio.h>
#include <unistd.h>
int main()
{
int add( int a, int b)
{
return a + b;
}
return add(2, 3);
}
Why does this not result in a executable stack? And if it is not supposed to, then can someone give example of a code construct that does give an executable stack?