https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87067

            Bug ID: 87067
           Summary: [8.1, 8.2] LTO-related ICE when running armv7 binutils
                    test suite
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kelledin at gmail dot com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

I'm attempting to build gcc-8.2.0+binutils-2.31.1 native compiler for ARMv7,
and the binutils test-suite is noticing a LOT of test failures (63 to be
precise), mostly due to gcc ICEing during the link phase, i.e.:

gcc  -B/usr/src/binutils-build/ld/tmpdir/ld/
-I/usr/src/binutils-2.31.1/ld/testsuite/ld-plugin -g -O2 -march=armv7-a
-mfpu=neon   -mhard-float -c -g -O2 -march=armv7-a -mfpu=neon -flto
-fuse-linker-plugin -c /usr/src/binutils-2.31.1/ld/testsuite/ld-plugin/lto-1a.c
-o tmpdir/lto-1a.o
gcc  -B/usr/src/binutils-build/ld/tmpdir/ld/
-I/usr/src/binutils-2.31.1/ld/testsuite/ld-plugin -g -O2 -march=armv7-a
-mfpu=neon   -mhard-float -c -g -O2 -march=armv7-a -mfpu=neon -flto
-fuse-linker-plugin -c /usr/src/binutils-2.31.1/ld/testsuite/ld-plugin/lto-1b.c
-o tmpdir/lto-1b.o
gcc  -B/usr/src/binutils-build/ld/tmpdir/ld/  -mhard-float  -L/lib -L/usr/lib
-L/usr/local/lib -L/usr/arm-linux-gnueabihf/lib  -o tmpdir/lto-1.exe 
-L/usr/src/binutils-2.31.1/ld/testsuite/ld-plugin -O2 -flto -fuse-linker-plugin
tmpdir/lto-1a.o tmpdir/lto-1b.o
In function 'main':
lto1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
lto-wrapper: fatal error: gcc returned 1 exit status
compilation terminated.

The ICE errors seem to be related to LTO with -march optimizations: remove
either the -flto flag or the -march=armv7-a flag from the above commands, and
gcc succeeds.  Removing any other flags doesn't seem to make a difference.

(For reference, similar failures happen with gcc-8.1.0+binutils-2.30.  I had
hoped the newer toolchain versions might help, but no dice.)

The platform is a SolidRun MacchiatoBin (Marvell Armada 8040, Cortex-A72), but
running under a linux32 chroot (such that `uname -m`==armv8l) for building
32-bit software.  FWIW I saw no such failures when bringing up a native AArch64
compiler (gcc 8.1.0+binutils 2.30).  I can accept this is possibly a binutils
bug rather than a gcc bug--but even in that case, gcc should handle it a little
more gracefully than an ICE.

"gcc -v" says:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/arm-linux-gnueabihf/8.2.0/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../gcc-8.2.0/configure --prefix=/usr --libdir=/usr/lib
--enable-threads=posix --enable-__cxa_atexit --enable-languages=c,c++
--enable-install-libiberty --enable-multiarch --enable-multilib --enable-shared
--enable-static --disable-bootstrap --with-system-zlib --with-float=hard
--with-fpu=neon --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
--build=arm-linux-gnueabihf
Thread model: posix
gcc version 8.2.0 (GCC) 

I'm trying to build binutils with:
../binutils-2.31.1/configure --prefix=/usr
--libdir=/usr/lib/arm-linux-gnueabihf
--with-lib-path=/lib:/usr/lib:/usr/local/lib --enable-shared --enable-gold=yes
--enable-plugins --enable-threads --disable-werror --with-system-zlib
--host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
--build=arm-linux-gnueabihf 

I can post the ld.log if anyone wants it, but it's 111K even when compressed. 
I figured it might be nicer to post specific failure reports.

Reply via email to