This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/52747] New: 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 02:18:14 +0000
- Subject: [Bug c/52747] New: No warning from toolchain with nested function and --noexecstack
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52747
Bug #: 52747
Summary: No warning from toolchain with nested function and
--noexecstack
Classification: Unclassified
Product: gcc
Version: 4.6.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: noloader@gmail.com
According to GCC docs, nested functions and no-exec stacks are mutually
exclusive. Using both does not generate a warning.
$ gcc --version
gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ uname -a
Linux ubuntu-11-x64 3.0.0-16-generic #29-Ubuntu SMP Tue Feb 14 12:48:51 UTC
2012 x86_64 x86_64 x86_64 GNU/Linux
$ cat warn-test.c
// gcc -fPIE -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wl,-z,noexecheap
warn-test.c -o warn-test.exe
#include <stdio.h>
int main(int argc, char* argv[])
{
void foo()
{
printf("%d\n", argc);
if(argv)
printf("%p\n", argv);
}
foo();
return 0;
}
$ gcc -fPIE -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wl,-z,noexecheap
warn-test.c -o warn-test.exe
/usr/bin/ld: warning: -z noexecheap ignored.
$ ./warn-test.exe