$ cat xx.c #include <stdio.h> int main(int argc, char **argv) { printf("Hallo\n"); return 0; } $ gcc -O2 -o xx xx.c $ readelf -a xx|grep STACK GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x4 $ gcc -flto -O2 -o xx xx.c $ readelf -a xx|grep STACK GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RWE 0x4 -flto should not create executable stacks.
Works for me ... please provide preprocessed source.
Created attachment 24738 [details] xx.c gcc -O2 -flto -o xx xx.c readelf -a xx|grep GNU_STACK should NOT show "RWE" but only "RW"
Works for me.
I can reproduce it at least on {x86_64,ppc}-linux with the linker plugin from > ld --version GNU ld (GNU Binutils; openSUSE Factory) 2.21.1 and the GCC 4.6.1 release. It works without -fuse-linker-plugin, so I suspect a GNU ld bug. It works with gold. Dave?
It is a linker bug: http://www.sourceware.org/bugzilla/show_bug.cgi?id=12982