This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/52747] No warning from toolchain with nested function and --noexecstack


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]