http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58592

suihong.liang at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
            Version|4.7.3                       |4.8.1
         Resolution|WONTFIX                     |---

--- Comment #3 from suihong.liang at gmail dot com ---
Looks like 4.8.1 has the same issue of linking error when "-flto
-fwhole-program" is used. Detailed output is below. And The source files are
from the attachment.

root@sinit:linkerror/lib# make clean
rm -f *.o *.so
root@sinit:/media/sf_symbolic/self/linkerror/lib# make
/usr/local/bin/g++ -flto -fwhole-program -Wall -Werror -pedantic -Wextra
-Weffc++ -Waddress -Warray-bounds -Wno-builtin-macro-redefined -Wc++0x-compat
-Wundef -std=c++0x -c -fPIC A.cpp
/usr/local/bin/g++ -flto -fwhole-program -Wall -Werror -pedantic -Wextra
-Weffc++ -Waddress -Warray-bounds -Wno-builtin-macro-redefined -Wc++0x-compat
-Wundef -std=c++0x -shared -o libself.so A.o 

root@sinit:linkerror/lib# cd ../app

root@sinit:linkerror/app# make clean; make
rm -f *.o a.out
/usr/local/bin/g++ -flto -fwhole-program -Wall -Werror -Wextra -pedantic
-Weffc++ -Waddress -Warray-bounds -Wno-builtin-macro-redefined -Wc++0x-compat
-Wundef -std=c++0x -c main.cpp
/usr/local/bin/g++ -flto -fwhole-program -Wall -Werror -Wextra -pedantic
-Weffc++ -Waddress -Warray-bounds -Wno-builtin-macro-redefined -Wc++0x-compat
-Wundef -std=c++0x -o a.out main.o -L../lib -lself
/tmp/cchAPumN.ltrans0.ltrans.o: In function `main':
cchAPumN.ltrans0.o:(.text+0x1c): undefined reference to `A::A()'
cchAPumN.ltrans0.o:(.text+0x31): undefined reference to `A::~A()'
collect2: error: ld returned 1 exit status
make: *** [all] Error 1


root@sinit# /usr/local/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/usr/local/bin/g++
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-linux-gnu/4.8.1/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../configure --disable-multilib --enable-languages=c,c++
--enable-shared --enable-linker-build-id --without-included-gettext
--enable-threads=posix --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin
--with-system-zlib --with-cloog --enable-cloog-backend=ppl
--disable-cloog-version-check --disable-ppl-version-check --disable-werror
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.1 (GCC) 

# uname -r
3.8.0-31-generic

Reply via email to