Such as:
// x.c #include <stdio.h>
int main(void) { char x[] = "abc"; printf("%s\n", x); return 0; }
and using GCC compile it:
➜ gcc x.c -v
...... /usr/libexec/gcc/x86_64-redhat-linux/5.1.1/cc1 -quiet -v x.c -quiet -dumpbase x.c -mtune=generic -march=x86-64 -auxbase x -version -o /tmp/ccqowh4f.s
......
as you see, GCC not enabled the -fstack-protector by default. And in Ubuntu:
➜ gcc x.c -v
/usr/lib/gcc/x86_64-linux-gnu/4.6/cc1 -quiet -v -imultilib . -imultiarch x86_64-linux-gnu x.c -quiet -dumpbase x.c -mtune=generic -march=x86-64 -auxbase x -version -fstack-protector -o /tmp/cc0aswkw.s
the enabled the -fstack-protector by default.
why?
On Mon, 2015-06-29 at 16:50 +0800, 乱雪 wrote:
Such as:
// x.c #include <stdio.h>
int main(void) { char x[] = "abc"; printf("%s\n", x); return 0; }
and using GCC compile it:
➜ gcc x.c -v
...... /usr/libexec/gcc/x86_64-redhat-linux/5.1.1/cc1 -quiet -v x.c -quiet -dumpbase x.c -mtune=generic -march=x86-64 -auxbase x -version -o /tmp/ccqowh4f.s ......
as you see, GCC not enabled the -fstack-protector by default. And in Ubuntu:
➜ gcc x.c -v
/usr/lib/gcc/x86_64-linux-gnu/4.6/cc1 -quiet -v -imultilib . -imultiarch x86_64-linux-gnu x.c -quiet -dumpbase x.c -mtune=generic -march=x86-64 -auxbase x -version -fstack-protector -o /tmp/cc0aswkw.s
the enabled the -fstack-protector by default.
why?
It's enabled by default if you build within RPM and have the redhat-rpm -config package installed.
In general, GCC doesn't provide many flags automatically; it expects you to select them where appropriate. *Fedora* on the other hand has some requirements on how things must be built in order to be included in the distribution, so the RPM builds add extra flags.
desktop@lists.fedoraproject.org