http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46695
Summary: [4.6 regression] failure to build X from darwin to cris-elf with lto enabled Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other AssignedTo: unassig...@gcc.gnu.org ReportedBy: ia...@gcc.gnu.org with host = i686-darwin9 target = cris-elf [current trunk = 167198] configure: Configured with: ../combined-trunk/configure --prefix=/GCC/cross --with-libelf=/GCC/libelf/ --target=cris-elf --disable-nls --enable-version-specific-runtime-libs --build=i686-apple-darwin9 --host=i686-apple-darwin9 --enable-sim --enable-languages=c,c++,fortran,lto,objc,obj-c++ --with-gmp=/GCC/multiprec-math/x86 --with-mpfr=/GCC/multiprec-math/x86 --with-mpc=/GCC/multiprec-math/x86 CC=/GCC/current/bin/gcc-4.6trunk CXX=/GCC/current/bin/g++-4.6trunk fails: /bin/sh ./libtool --tag=CC --mode=compile /GCC/current/bin/gcc-4.6trunk -DHAVE_CONFIG_H -I. -I../../combined-trunk/lto-plugin -I../../combined-trunk/lto-plugin/../include -DHAVE_CONFIG_H -Wall -Werror -g -O2 -c -o lto-plugin.lo ../../combined-trunk/lto-plugin/lto-plugin.c libtool: compile: /GCC/current/bin/gcc-4.6trunk -DHAVE_CONFIG_H -I. -I../../combined-trunk/lto-plugin -I../../combined-trunk/lto-plugin/../include -DHAVE_CONFIG_H -Wall -Werror -g -O2 -c ../../combined-trunk/lto-plugin/lto-plugin.c -fno-common -DPIC -o .libs/lto-plugin.o libtool: compile: /GCC/current/bin/gcc-4.6trunk -DHAVE_CONFIG_H -I. -I../../combined-trunk/lto-plugin -I../../combined-trunk/lto-plugin/../include -DHAVE_CONFIG_H -Wall -Werror -g -O2 -c ../../combined-trunk/lto-plugin/lto-plugin.c -o lto-plugin.o >/dev/null 2>&1 /bin/sh ./libtool --tag=CC --mode=link /GCC/current/bin/gcc-4.6trunk -Wall -Werror -g -O2 -no-undefined -bindir /GCC/cross/libexec/gcc/cris-elf/4.6.0 -o liblto_plugin.la -rpath /GCC/cross/libexec/gcc/cris-elf/4.6.0 lto-plugin.lo ../libiberty/pic/libiberty.a *** Warning: Linking the shared library liblto_plugin.la against the *** static library ../libiberty/pic/libiberty.a is not portable! libtool: link: /GCC/current/bin/gcc-4.6trunk -dynamiclib -o .libs/liblto_plugin.0.dylib .libs/lto-plugin.o ../libiberty/pic/libiberty.a -install_name /GCC/cross/libexec/gcc/cris-elf/4.6.0/liblto_plugin.0.dylib -compatibility_version 1 -current_version 1.0 -Wl,-single_module Undefined symbols: "_environ", referenced from: _environ$non_lazy_ptr in libiberty.a(pex-unix.o) _environ$non_lazy_ptr in libiberty.a(xmalloc.o) ld: symbol(s) not found collect2: ld returned 1 exit status make[2]: *** [liblto_plugin.la] Error 1 make[1]: *** [all-lto-plugin] Error 2 make: *** [all] Error 2 === This is attributed to the inclusion of liblto_plugin_la_LDFLAGS = -no-undefined -bindir $(libexecsubdir) \ $(if $(wildcard ../libiberty/pic/libiberty.a),,-Wc,../libiberty/libiberty.a) in lto-plugin/Makefile.am ==== works OK when the link is passed "-undefined dynamic_lookup" so that _environ can be resolved from crt at load time.