https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66038
--- Comment #35 from Joshua Kinard <kumba at gentoo dot org> --- (In reply to rguent...@suse.de from comment #34) > On Thu, 14 Jan 2016, kumba at gentoo dot org wrote: > > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66038 > > > > --- Comment #33 from Joshua Kinard <kumba at gentoo dot org> --- > > The problem may be tied to a particular CFLAG on glibc-n32 MIPS. I ran our > > (Gentoo's) stage-building script, and forgot to block gcc-5.3.0 from > > building, > > and it ended up completing. Difference between that script (which builds > > inside a chroot) is I used saner CFLAGS. > > > > The CFLAGS I am using in my rootfs that fails to build gcc-5.3.0 is: > > CFLAGS="-O2 -pipe -march=r12k -mtune=r12k -mno-fix-r10000 -mabi=n32 -mplt > > -fomit-frame-pointer -fforce-addr -fivopts -fmodulo-sched -ftree-vectorize" > > LDFLAGS="-Wl,-O2 -Wl,-z,now -Wl,-z,relro" > > > > So I'll look at dropping one flag at a time, along with trimming LDFLAGS, > > and > > see if I can pin down which one causes ./genmatch --gimple to segfault > on N32. > > -fforce-addr is a no-op and -fivopts is enabled at -O2 by default, so > you can omit those without testing. It looks like it's my LDFLAGS, specifically with -Wl,-z,now. I let the build proceed after removing LDFLAGS from my environment, and once it built genmatch and ran it w/o a SIGSEGV, I interrupted the build, copied the linking command for genmatch, and then tested with both -Wl,-z,now and -Wl,-z,relro, and the relro version runs fine. # mips64-unknown-linux-gnu-g++ -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -DGENERATOR_FILE -static-libstdc++ -static-libgcc -Wl,-z,now -o build/genmatchZ3 build/genmatch.o ../build-mips64-unknown-linux-gnu/libcpp/libcpp.a build/errors.o build/vec.o build/hash-table.o ../build-mips64-unknown-linux-gnu/libiberty/libiberty.a # build/genmatchZ3 --gimple Segmentation fault # mips64-unknown-linux-gnu-g++ -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -DGENERATOR_FILE -static-libstdc++ -static-libgcc -Wl,-z,relro -o build/genmatchZ4 build/genmatch.o ../build-mips64-unknown-linux-gnu/libcpp/libcpp.a build/errors.o build/vec.o build/hash-table.o ../build-mips64-unknown-linux-gnu/libiberty/libiberty.a # build/genmatchZ4 --gimple (null):0:0 error: --gimple: No such file or directory Currently using binutils-2.25.1. Can provide strace runs if needed.