Bug 35965 - [4.3 only] -fstack-protector produces segfaulting binaries on arm/armel
[4.3 only] -fstack-protector produces segfaulting binaries on arm/armel
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: target
4.3.1
: P3 normal
: 4.4.0
Assigned To: jules
:
: 36480 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-04-17 11:43 UTC by Riku Voipio
Modified: 2010-03-15 14:53 UTC (History)
6 users (show)

See Also:
Host: arm-linux-gnueabi
Target: arm-linux-gnueabi
Build: arm-linux-gnueabi
Known to work:
Known to fail:
Last reconfirmed: 2008-06-26 10:10:47


Attachments
working arm assembly produced from hello world (881 bytes, application/octet-stream)
2008-04-17 11:48 UTC, Riku Voipio
Details
segfaulting arm assemble of hello world (1.11 KB, application/octet-stream)
2008-04-17 11:49 UTC, Riku Voipio
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Riku Voipio 2008-04-17 11:43:43 UTC
-snip-
#include <stdio.h>

main()
{
        printf ("Hello World!\n");
}
-snip-
$ gcc -save-temps -fstack-protector -fPIE hello.c -o hello
$ ./hello
$ Hello World!
$ gcc -save-temps -fstack-protector-all -fPIE helloall.c -o helloall
$ ./helloall
$ Segmentation fault

helloall.s segfaults, hello.s runs fine. if -fstack-protector isn't to
be supported on arm, it gcc should ignore the option like done on
mips/mipsel.

Package source: gcc-4.3
GCC version: 4.3.1
Base Debian version: 4.3
Configured with: -v
         --with-pkgversion='Debian 4.3.0-3'
         --with-bugurl='file:///usr/share/doc/gcc-4.3/README.Bugs'
         --enable-languages=c,c++,fortran,obj-c++
         --prefix=/usr
         --enable-shared
         --with-system-zlib
         --libexecdir=/usr/lib
         --without-included-gettext
         --enable-threads=posix
         --enable-nls
         --with-gxx-include-dir=/usr/include/c++/4.3
         --program-suffix=-4.3
         --enable-clocale=gnu
         --enable-libstdcxx-debug
         --enable-libffi
         --enable-mpfr
         --disable-libssp
         --disable-sjlj-exceptions
         --enable-checking=release
         --build=arm-linux-gnueabi
         --host=arm-linux-gnueabi
         --target=arm-linux-gnueabi
Target: arm-linux-gnueabi
Configured with: ../src/configure linux gnueabi
Thread model: posix
gcc version 4.3.1 20080401 (prerelease) (Debian 4.3.0-3)
Comment 1 Riku Voipio 2008-04-17 11:48:27 UTC
Created attachment 15489 [details]
working arm assembly produced from hello world
Comment 2 Riku Voipio 2008-04-17 11:49:01 UTC
Created attachment 15490 [details]
segfaulting arm assemble of hello world
Comment 3 Riku Voipio 2008-04-23 13:49:11 UTC
This is also reproducible with codesourcery 2008q1

Using built-in specs.
Target: arm-none-linux-gnueabi
Configured with: /scratch/sandra/lite/src/gcc-4.2/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-threads --disable-libmudflap --disable-libssp --disable-libgomp --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --enable-shared --enable-symvers=gnu --enable-__cxa_atexit --with-pkgversion=Sourcery G++ Lite 2008q1-126 --with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls --prefix=/opt/codesourcery --with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc --with-build-sysroot=/scratch/sandra/lite/linux/install/arm-none-linux-gnueabi/libc --enable-poison-system-directories --with-build-time-tools=/scratch/sandra/lite/linux/install/arm-none-linux-gnueabi/bin --with-build-time-tools=/scratch/sandra/lite/linux/install/arm-none-linux-gnueabi/bin
Thread model: posix
gcc version 4.2.3 (Sourcery G++ Lite 2008q1-126)
Comment 4 jules 2008-06-26 10:10:47 UTC
I've posted a candidate fix:

http://gcc.gnu.org/ml/gcc-patches/2008-06/msg01641.html
Comment 5 Doug Kwan 2009-02-12 09:15:32 UTC
*** Bug 36480 has been marked as a duplicate of this bug. ***
Comment 6 dougkwan 2009-02-25 07:18:17 UTC
Subject: Bug 35965

Author: dougkwan
Date: Wed Feb 25 07:18:01 2009
New Revision: 144424

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=144424
Log:
2009-02-24  Julian Brown  <julian@codesourcery.com>

	PR target/35965
	* config/arm/arm.c (require_pic_register): Only set
	cfun->machine->pic_reg once per function.

	Patch commited by Doug Kwan <dougkwan@google.com>


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/arm/arm.c

Comment 7 Doug Kwan 2009-02-25 07:26:04 UTC
This is fixed in trunk and will be picked up by 4.4.  However, this is broken at least in 4.3.1 and probably in all 4.3 releases.
Comment 8 Ramana Radhakrishnan 2010-01-07 23:07:21 UTC
From comment #7 this appears to be only a problem with the 4.3 branch. 
Comment 9 Richard Biener 2010-03-15 14:53:53 UTC
Not a regression.  Fixed for 4.4.0.