From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19810 invoked by alias); 20 Sep 2012 20:28:36 -0000 Received: (qmail 19737 invoked by uid 48); 20 Sep 2012 20:28:08 -0000 From: "baker at usgs dot gov" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/54630] [4.8 Regression] GCC 4.8 --enable-languages=c build fails: Undefined symbols: ___cxa_guard_acquire and ___cxa_guard_release Date: Thu, 20 Sep 2012 20:28:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Keywords: X-Bugzilla-Severity: blocker X-Bugzilla-Who: baker at usgs dot gov X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.0 X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-09/txt/msg01620.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54630 --- Comment #2 from Larry Baker 2012-09-20 20:28:08 UTC --- This bug also occurs when --enable-languages=c,c++. I am building a cross compiler for ColdFire uClinux, TARGET=m68k-uclinux. On Mac OS X HOST=BUILD=x86_64-apple-darwin10.8.0, there are no errors. On Linux i386 HOST=BUILD=i686-pc-linux-gnu, I get the undefined references to __cxa_guard_acquire and __cxa_guard_release. The bug is due to the link step for cc1, lto1 (maybe more) using gcc; it should be using g++ (see below). I don't know which Makefile(s) to fix. It also looks like the command emitted depends on the HOST or BUILD platform. CentOS Linux has such an old gcc, it does not recognize -static-libstdc++ # cat /etc/redhat-release CentOS release 6.3 (Final) # gcc -v Using built-in specs. Target: i686-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch=i686 --build=i686-redhat-linux Thread model: posix gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) >>From the build directory # pwd /tmp/freescale-coldfile-xgcc/cross-gcc-4.8.0-experimental/gcc This is the (first) make command that fails (I did a make -j4, so the link of lto1 also failed) # gcc -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -W -Wall -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common -DHAVE_CONFIG_H -o cc1 c/c-lang.o c-family/stub-objc.o attribs.o c/c-errors.o c/c-decl.o c/c-typeck.o c/c-convert.o c/c-aux-info.o c/c-objc-common.o c/c-parser.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o tree-mudflap.o default-c.o \ > cc1-checksum.o libbackend.a main.o tree-browser.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -static-libgcc -static-libstdc++ -lm -lmpc -lmpfr -lgmp -rdynamic -ldl -static-libgcc -static-libstdc++ -lm -L../zlib -lz gcc: unrecognized option '-static-libstdc++' gcc: unrecognized option '-static-libstdc++' libbackend.a(tree-ssa-coalesce.o): In function `coalesce_ssa_name()': /tmp/freescale-coldfile-xgcc/cross-gcc-4.8.0-experimental/../gcc-4.8.0-experimental/gcc/tree-ssa-coalesce.c:1294: undefined reference to `__cxa_guard_acquire' /tmp/freescale-coldfile-xgcc/cross-gcc-4.8.0-experimental/../gcc-4.8.0-experimental/gcc/tree-ssa-coalesce.c:1294: undefined reference to `__cxa_guard_release' collect2: ld returned 1 exit status Using g++ instead of gcc cures the problem # g++ -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -W -Wall -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common -DHAVE_CONFIG_H -o cc1 c/c-lang.o c-family/stub-objc.o attribs.o c/c-errors.o c/c-decl.o c/c-typeck.o c/c-convert.o c/c-aux-info.o c/c-objc-common.o c/c-parser.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o tree-mudflap.o default-c.o cc1-checksum.o libbackend.a main.o tree-browser.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -static-libgcc -static-libstdc++ -lm -lmpc -lmpfr -lgmp -rdynamic -ldl -static-libgcc -static-libstdc++ -lm -L../zlib -lz g++: unrecognized option '-static-libstdc++' g++: unrecognized option '-static-libstdc++'