[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/12762] New: lto produces multiple definition errors for virtual
From: |
vanboxem.ruben at gmail dot com |
Subject: |
[Bug ld/12762] New: lto produces multiple definition errors for virtual function |
Date: |
Sun, 15 May 2011 15:24:20 +0000 |
http://sourceware.org/bugzilla/show_bug.cgi?id=12762
Summary: lto produces multiple definition errors for virtual
function
Product: binutils
Version: 2.22 (HEAD)
Status: NEW
Severity: normal
Priority: P2
Component: ld
AssignedTo: address@hidden
ReportedBy: address@hidden
I don't know if this is a GCC or ld bug, but as the error happens in the link
stage, I'm posting it here.
To reproduce:
class.h
-------
class A
{
public:
virtual ~A() {}
};
class B : public A
{
public:
~B() {}
};
class.cpp
---------
#include "class.h" // just make sure there's more than one object file
main.cpp
#include "class.h"
int main()
{
B b;
return 0;
}
Compile with "g++ -flto" from the 4.6 branch and link with "g++ -flto" which
invokes ld and collect2. Produced errors:
release/class.o (symbol from plugin):(.text+0x0): multiple definition of
`typeinfo for A'
release/main.o (symbol from plugin):(.text+0x0): first defined here
release/class.o (symbol from plugin):(.text+0x0): multiple definition of
`typeinfo name for A'
release/main.o (symbol from plugin):(.text+0x0): first defined here
release/class.o (symbol from plugin):(.text+0x0): multiple definition of
`typeinfo for B'
release/main.o (symbol from plugin):(.text+0x0): first defined here
release/class.o (symbol from plugin):(.text+0x0): multiple definition of
`typeinfo name for B'
release/main.o (symbol from plugin):(.text+0x0): first defined here
collect2: ld returned 1 exit status
Please note that compiling Qmake (when configuring Qt) or a larger C++ project
with -flto produces multiple definitions of stuff like std::allocator operator
new and other standard C++ stuff.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
- [Bug ld/12762] New: lto produces multiple definition errors for virtual function,
vanboxem.ruben at gmail dot com <=
- [Bug ld/12762] lto produces multiple definition errors for virtual function, vanboxem.ruben at gmail dot com, 2011/05/15
- [Bug ld/12762] lto produces multiple definition errors for virtual function, amodra at gmail dot com, 2011/05/15
- [Bug ld/12762] lto produces multiple definition errors for virtual function, vanboxem.ruben at gmail dot com, 2011/05/15
- [Bug ld/12762] lto produces multiple definition errors for virtual function, vanboxem.ruben at gmail dot com, 2011/05/15
- [Bug ld/12762] lto produces multiple definition errors for virtual function, amodra at gmail dot com, 2011/05/15
- [Bug ld/12762] lto produces multiple definition errors for virtual function, vanboxem.ruben at gmail dot com, 2011/05/16
- [Bug ld/12762] lto produces multiple definition errors for all symbols (including CRT) in C++, vanboxem.ruben at gmail dot com, 2011/05/17
- [Bug ld/12762] lto produces multiple definition errors for all symbols (including CRT) in C++, vanboxem.ruben at gmail dot com, 2011/05/17