http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59183
Bug ID: 59183 Summary: configure of pdsh successfuly checks for function shl_load when lto is enabled Product: gcc Version: 4.8.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: steffen at hauihau dot de Created attachment 31243 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31243&action=edit Output directories with -save-temps of both gcc runs with disabled and enabled lto Hi all, I was running into an issue when I tried to compile pdsh 2.26 (a parallel shell, see https://computing.llnl.gov/linux/pdsh.html). When lto is enabled, configure successfully checks for function shl_load, but fails when lto is disabled. With enabled lto: gcc -o shl_load_test -march=native -O2 -pipe -ggdb -floop-interchange -floop-strip-mine -floop-block -ftree-loop-distribution -fira-loop-pressure -ftree-vectorize -ftree-loop-linear -flto=5 -fuse-linker-plugin -Wl,-O1 -Wl,--as-needed -march=native -O2 -pipe -ggdb -floop-interchange -floop-strip-mine -floop-block -ftree-loop-distribution -fira-loop-pressure -ftree-vectorize -ftree-loop-linear -flto=5 -fuse-linker-plugin -Wl,-znow -Wl,--sort-common -Wl,--hash-style=gnu -Wl,--enable-new-dtags -save-temps shl_load_test.c gcc: warning: -pipe ignored because -save-temps specified gcc: warning: -pipe ignored because -save-temps specified [Leaving LTRANS /tmp/ccSSsJJ4.args] [Leaving LTRANS shl_load_test.ltrans.out] gcc: warning: -pipe ignored because -save-temps specified [Leaving LTRANS /tmp/cc259S6e.mk] [Leaving LTRANS shl_load_test.ltrans0.o] With disabled lto: gcc -o shl_load_test -march=native -O2 -pipe -ggdb -floop-interchange -floop-strip-mine -floop-block -ftree-loop-distribution -fira-loop-pressure -ftree-vectorize -ftree-loop-linear -Wl,-O1 -Wl,--as-needed -march=native -O2 -pipe -ggdb -floop-interchange -floop-strip-mine -floop-block -ftree-loop-distribution -fira-loop-pressure -ftree-vectorize -ftree-loop-linear -Wl,-znow -Wl,--sort-common -Wl,--hash-style=gnu -Wl,--enable-new-dtags -save-temps shl_load_test.c gcc: warning: -pipe ignored because -save-temps specified shl_load_test.o:shl_load_test.c:function f: error: undefined reference to 'shl_load' shl_load_test.c:69: error: undefined reference to 'shl_load' collect2: error: ld returned 1 exit status The latter one is the desired result, as this function is not present on my system. I have this issue also with another package (libsidplay) where configure checks successfully for strnicmp and stricmp, which are both not present. Disabled lto here does also prevent configure from successfully checking for these two functions. I've compared the piece of code, which configure uses to check for these functions and it is identical to the code that the configure from pdsh uses to check for shl_load (replace shl_load with strnicmp/stricmp). Here is the output of gcc -v: COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.2/gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.8.2/lto-wrapper Ziel: x86_64-pc-linux-gnu Konfiguriert mit: /home/misc/gentoo/tmp/portage/sys-devel/gcc-4.8.2/work/gcc-4.8.2/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.2 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.2 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.2/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.2/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --with-cloog --disable-isl-version-check --enable-lto --enable-nls --without-included-gettext --with-system-zlib --enable-obsolete --disable-werror --enable-secureplt --enable-multilib --with-multilib-list=m32,m64 --enable-libmudflap --disable-libssp --enable-libgomp --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.8.2/python --enable-checking=release --disable-libgcj --enable-libstdcxx-time --enable-languages=c,c++,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-targets=all --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.8.2 p1.0, pie-0.5.8' Thread-Modell: posix gcc-Version 4.8.2 (Gentoo 4.8.2 p1.0, pie-0.5.8) Please let me know wether you need more input/files from me.