Re: Strange __cxa_pure_virtual problem

cetoni GmbH - Uwe Kindler <[email protected]>
Newsgroups gmane.os.ecos.devel
Message-ID <[email protected]>
Hi Bart,

I compiled an eCos library from default template with arm-eabi toolchain 
from eCos homepage. These are teh compiler switches:

-Wall -Wpointer-arith -Wstrict-prototypes -Wundef -Woverloaded-virtual 
-Wno-write-strings  -mno-thumb-interwork -mcpu=arm7tdmi -g2 -O0 
-ffunction-sections -fdata-sections -fno-rtti -fno-exceptions

I used a makfile from examples directory to build my application and 
link againts the library.

If I compile the following main file __cxa_guard_release() is not pulled in:

class Simple
{
private:
     int m_i;
public:
     Simple(int i)
         : m_i(i) {}
};

static Simple simple(1);

int main(int argc, char *argv[])
{
     return 0;
}


If I compile the following main file __cxa_guard_release() is pulled in:

class Simple
{
private:
     int m_i;
public:
     Simple(int i)
         : m_i(i) {}
};


int main(int argc, char *argv[])
{
     static Simple simple(1);
     return 0;
}

I found a message from a mailing list with a similar problem:

http://lists.apple.com/archives/darwin-drivers/2005/May/msg00061.html

The message states:

....
Evidently the compiler generates these as a by-product of the class 
instantiation. By moving the class instantiation out of the function, 
into global space, the symbols were not generated.
...

So this seems like a compiler issue for me. You can easily confirm this 
behaviour by building my simple application. It is important to link 
against a debug build of the library (-g2 -O0) to reproduce this behaviour.

Can anyone confirm that compiler behaviour of the arm-eabi toolchain?
Sergei, can you reproduce this. Can you reproduce this with any other 
toolchain (x86)?

Regards, Uwe
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.