public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "suihong.liang at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/58592] -flto -fwhole-program caused undefined reference in g++ 4.7.3
Date: Wed, 02 Oct 2013 18:22:00 -0000	[thread overview]
Message-ID: <bug-58592-4-zBCYwVvz2T@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-58592-4@http.gcc.gnu.org/bugzilla/>

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


  parent reply	other threads:[~2013-10-02 18:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-02  2:59 [Bug c++/58592] New: " suihong.liang at gmail dot com
2013-10-02  8:19 ` [Bug c++/58592] " rguenth at gcc dot gnu.org
2013-10-02 13:38 ` suihong.liang at gmail dot com
2013-10-02 18:22 ` suihong.liang at gmail dot com [this message]
2013-10-02 19:36 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-58592-4-zBCYwVvz2T@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).