* Windows DEP problem with nested functions
@ 2008-05-07 10:06 Nicholas Sherlock
2008-05-08 6:59 ` Ian Lance Taylor
0 siblings, 1 reply; 2+ messages in thread
From: Nicholas Sherlock @ 2008-05-07 10:06 UTC (permalink / raw)
To: gcc-help
Hi all,
I'm using GCC 3.4.4 on Cygwin on Windows XP. The following program:
#include <pthread.h>
int main() {
pthread_t thread;
void * task(void * arg) {
return NULL;
}
pthread_create(&thread, NULL, task, NULL);
pthread_join(thread, NULL);
return 0;
}
only runs if DEP (Prevention of code execution on data pages) is turned
off in Windows settings. I get a segfault if DEP is turned on. Is this a
GCC problem, or a Cygwin problem?
Cheers,
Nicholas Sherlock
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Windows DEP problem with nested functions
2008-05-07 10:06 Windows DEP problem with nested functions Nicholas Sherlock
@ 2008-05-08 6:59 ` Ian Lance Taylor
0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2008-05-08 6:59 UTC (permalink / raw)
To: Nicholas Sherlock; +Cc: gcc-help
Nicholas Sherlock <n.sherlock@gmail.com> writes:
> I'm using GCC 3.4.4 on Cygwin on Windows XP. The following program:
>
> #include <pthread.h>
>
> int main() {
> pthread_t thread;
>
> void * task(void * arg) {
> return NULL;
> }
>
> pthread_create(&thread, NULL, task, NULL);
> pthread_join(thread, NULL);
>
> return 0;
> }
>
> only runs if DEP (Prevention of code execution on data pages) is
> turned off in Windows settings. I get a segfault if DEP is turned
> on. Is this a GCC problem, or a Cygwin problem?
On targets which require extra effort to enable stack execution, gcc
is supposed to enable it when it builds a trampoline for a nested
function. So in that sense it is a gcc problem.
I think this problem is fixed in the mainline gcc sources. At least,
I see support for calling VirtualProtect on a trampoline.
Ian
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-05-08 0:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-07 10:06 Windows DEP problem with nested functions Nicholas Sherlock
2008-05-08 6:59 ` Ian Lance Taylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).