This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/52747] No warning from toolchain with nested function and --noexecstack
- From: "noloader at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 28 Mar 2012 14:33:38 +0000
- Subject: [Bug c/52747] No warning from toolchain with nested function and --noexecstack
- Auto-submitted: auto-generated
- References: <bug-52747-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52747
--- Comment #3 from Jeffrey Walton <noloader at gmail dot com> 2012-03-28 14:33:38 UTC ---
Ah, OK. -Wtrampolines works. But I'm not seeing a warning about the loss of
no-exec stacks:
int main(int argc, char* argv[])
{
(void)argc;
(void)argv;
void foo()
{
printf("main: %p\n", &main);
printf("argv: %p\n", argv);
printf("foo: %p\n", &foo);
}
foo();
return 0;
}
$ gcc -Wall -Wextra -fPIE -Wtrampolines -Wl,-z,relro -Wl,-z,now
-Wl,-z,noexecstack -Wl,-z,noexecheap warn-test.c -o warn-test.exe
warn-test.c: In function âmainâ:
warn-test.c:10:8: warning: trampoline generated for nested function âfooâ
[-Wtrampolines]
/usr/bin/ld: warning: -z noexecheap ignored.
$ ./warn-test.exe
main: 0x4005c7
argv: 0x7fff65a9a138
foo: 0x7fff65a9a028