This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: gcc-4.1.1: default enabled stack-protector does not work
- From: Alvaro Vega Garcia <avg07 at tid dot es>
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 09 Jan 2007 12:14:00 +0100
- Subject: Re: gcc-4.1.1: default enabled stack-protector does not work
- References: <20070108220115.ae8f03fb.cdp_xe@gmx.net>
Hi,
On Mon, 2007-01-08 at 22:01 +0100, Steffen Wendzel wrote:
> Hi,
>
> I compiled my gcc-4.1.1 with
>
> ./configure --prefix=/usr --enable-stack-protector-all \
> --enable-shared --enable-threads=poxis --enable-__cxa_atexit \
> --disable-checking --with-gnu-ld --verbose --target=i486-hardened-linux
> --host=i486-hardened-linux --enable-libstdcpp
>
> My gcc -v sais:
> Using built-in specs.
> Target: i486-hardenedlinux
> Configured wit: ../gcc-4.1.1/configure --prefix=/usr --enable-stack-protector-all
> --enable-shared --enable-threads=poxis --enable-__cxa_atexit --disable-checking
> --with-gnu-ld --verbose --target=i486-hardened-linux --host=i486-hardened-linux
> --enable-libstdcpp
> Thread model: posix
> gcc version 4.1.1
>
> My problem is, that my gcc does not enable -fstack-protector-all by default (but
> I used --enable-stack-protector-all):
>
> $ cat conftest.c
> #include <stdio.h>
> int main() {
> printf("%i\n", __SSP_ALL__);
> return 0;
> }
> $ gcc -o conftest conftest.c
> conftest.c: In function 'main':
> conftest.c:3: error: '__SSP_ALL__' undeclared (first use in this function)
> ...
> $ gcc -o conftest -fstack-protector-all conftest.c
> $ ./conftest
> 2
>
> I don't understand why I need to enable -fstack-protector-all by hand.
>
AFAIK turn on -fstack-protector by default is a specific patch named
gcc-ssp-default applied by default to Ubuntu. ( see:
https://wiki.ubuntu.com/GccSsp )
Also Debian distributes gcc source package (like gcc-4.1-source.deb)
with gcc-ssp-on patch, but it isn't applied by default to binary
package.
But in the oficial gcc distribution --enable-stack-protector-all I think
that it hasn't any effect.
Regards,
Álvaro
> regards
> --Steffen
>