Bug 52971 - gcc ICE with an sh64 cross-compilation
Summary: gcc ICE with an sh64 cross-compilation
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2012-04-13 10:18 UTC by dhowells@redhat.com
Modified: 2012-06-01 13:31 UTC (History)
1 user (show)

See Also:
Host:
Target: sh64-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
ICE producer (192 bytes, text/x-csrc)
2012-04-13 10:18 UTC, dhowells@redhat.com
Details

Note You need to log in before you can comment on or make changes to this bug.
Description dhowells@redhat.com 2012-04-13 10:18:05 UTC
Created attachment 27149 [details]
ICE producer

I have built a cross-compiler toolchain for sh64 that can also compile for 32-bit SH.  All the 32-bit Linux kernel SH defconfigs that I've fed it have worked, but the primary 64-bit SH defconfig fails with a gcc SEGV/ICE on at least one of the files.

I've distilled the C code that produced the ICE down to a few lines (see attachment).  This is compiled with:

sh64-linux-gnu-gcc -m5-32media-nofpu -ml -Wa,-isa=shmedia -O2 -c ice.c
ice.c: In function ‘part_pack_uuid’:
ice.c:8:3: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla/> for instructions.

The gcc build was configured with:

AR_FOR_TARGET=/usr/bin/sh64-linux-gnu-ar \
AS_FOR_TARGET=/usr/bin/sh64-linux-gnu-as \
DLLTOOL_FOR_TARGET=/usr/bin/sh64-linux-gnu-dlltool \
LD_FOR_TARGET=/usr/bin/sh64-linux-gnu-ld \
NM_FOR_TARGET=/usr/bin/sh64-linux-gnu-nm \
OBJDUMP_FOR_TARGET=/usr/bin/sh64-linux-gnu-objdump \
RANLIB_FOR_TARGET=/usr/bin/sh64-linux-gnu-ranlib \
STRIP_FOR_TARGET=/usr/bin/sh64-linux-gnu-strip \
WINDRES_FOR_TARGET=/usr/bin/sh64-linux-gnu-windres \
WINDMC_FOR_TARGET=/usr/bin/sh64-linux-gnu-windmc \
LDFLAGS='-Wl,-z,relro ' \
../gcc-4.7.0-RC-20120302/configure --disable-dependency-tracking --disable-silent-rules --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --target=sh64-linux --enable-targets=all --program-prefix=sh64-linux-gnu- --enable-languages=c --without-headers --enable-sjlj-exceptions --with-system-libunwind --disable-nls --disable-threads --disable-shared --disable-libmudflap --disable-libssp --disable-libgomp --disable-libquadmath --disable-gold --disable-decimal-float --enable-checking= --enable-gnu-unique-object --enable-linker-build-id --disable-plugin --enable-nls --with-system-zlib --with-bugurl=http://bugzilla.redhat.com/bugzilla/ --enable-obsolete --with-multilib-list=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single,m5-32media,m5-32media-nofpu,m5-compact,m5-compact-nofpu,m5-64media,m5-64media-nofpu

From gcc-4.7.0-RC-20120302.tar.bz2 downloaded from the gcc website.

The binutils used was binutils-2.22.52.0.1.tar.bz2 with the patches from the Fedora rawhide binutils srpm applied.  This was configured thusly:

LDFLAGS='-Wl,-z,relro ' \
../binutils-2.22.52.0.1/configure --disable-dependency-tracking --disable-silent-rules --enable-checking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --target=sh64-elf --program-prefix=sh64-linux-gnu- --disable-shared --enable-64-bit-bfd --enable-targets=sh64-linux,sh-elf,sh-linux,sh4-linux --with-bugurl=http://bugzilla.redhat.com/bugzilla/

And a symlink emplaced at /usr/sh64-linux to point to the /usr/sh64-elf/ directory  so that the cross-compiler could find it.

For reference, the cross-gcc and cross-binutils are built as RPMs for Fedora using spec files or SRPMs similar to those that can be found in http://people.redhat.com/~dhowells/cross/
Comment 2 dhowells@redhat.com 2012-06-01 13:31:06 UTC
Those fix it for me.