bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/2478] New: undefined reference vtable if symbol is in archive


From: binutils dot scyt at spamgourmet dot com
Subject: [Bug ld/2478] New: undefined reference vtable if symbol is in archive
Date: 23 Mar 2006 15:07:17 -0000

Linking fails with
b.o:b.cpp:(.text$_ZN4TestC1Ev[Test::Test()]+0x8): undefined reference to `vtable
for Test'
if object file is stored in an archive but succeeds if not.

Reproducible with this testcase:
### a.h ###
class Test
{
public:
        virtual void do_something();
};
### a.cpp ###
#include "a.h"

void Test::do_something()
{
}
### b.cpp ###
#include "a.h"
int main( int argc, char** argv )
{
        Test test;
        
        return 0;
}
### build object files "a.o" "b.o" and put "a.o" in archive "a.a"
g++ -c -o a.o a.cpp && g++.exe -c -o b.o b.cpp && ar -q a.a a.o
### linking with object files succeeds
g++ -o c a.o b.o
### linking with archive file fails
g++ -o c a.a b.o


nm shows for the archive a.a and for the object a.o the same symbols. So it
should succeed.

-- 
           Summary: undefined reference vtable if symbol is in archive
           Product: binutils
           Version: 2.16
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: binutils dot scyt at spamgourmet dot com
                CC: bug-binutils at gnu dot org
 GCC build triplet: i686-pc-cygwin
  GCC host triplet: i686-pc-cygwin
GCC target triplet: i686-pc-cygwin


http://sourceware.org/bugzilla/show_bug.cgi?id=2478

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]