public inbox for ecos-devel@sourceware.org
 help / color / mirror / Atom feed
* Re: Strange __cxa_pure_virtual problem
@ 2009-08-12  9:10 cetoni GmbH - Uwe Kindler
  0 siblings, 0 replies; 20+ messages in thread
From: cetoni GmbH - Uwe Kindler @ 2009-08-12  9:10 UTC (permalink / raw)
  To: ecos-devel

Hi Jonathan,

here you can download the linker mapping file ecos.map (zipped) that I 
picked  from folder build/infra/current after build process stopped with 
the __cxa_pure_virtual error.

http://www.cetoni.de/ecos_map.zip

Regards, Uwe

^ permalink raw reply	[flat|nested] 20+ messages in thread
* Re: Strange __cxa_pure_virtual problem
@ 2009-08-19 14:35 cetoni GmbH - Uwe Kindler
  2009-08-19 16:05 ` John Dallaway
  2009-08-21 14:55 ` Bart Veer
  0 siblings, 2 replies; 20+ messages in thread
From: cetoni GmbH - Uwe Kindler @ 2009-08-19 14:35 UTC (permalink / raw)
  To: ecos-devel; +Cc: Bart Veer, Sergei Gavrikov

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

^ permalink raw reply	[flat|nested] 20+ messages in thread
* Re: Strange __cxa_pure_virtual problem
@ 2009-08-12 17:49 Uwe Kindler
  2009-08-12 19:07 ` Bart Veer
  0 siblings, 1 reply; 20+ messages in thread
From: Uwe Kindler @ 2009-08-12 17:49 UTC (permalink / raw)
  To: ecos-devel; +Cc: jifl

Hello Jonathan,

thank you for your detailed description - it helped me to find the 
cause. In ustlecos.cpp there is a function:

void diag_print_exception(const exception& ex)
{
         static string exstr(64);
...

if I remove the static from the string declaration the 
__cxa_pure_virtual problem is gone.


Regards, Uwe

^ permalink raw reply	[flat|nested] 20+ messages in thread
[parent not found: <4A827EDC.3030004@cetoni.de>]
* Re: Strange __cxa_pure_virtual problem
@ 2009-08-08  6:04 Uwe Kindler
  0 siblings, 0 replies; 20+ messages in thread
From: Uwe Kindler @ 2009-08-08  6:04 UTC (permalink / raw)
  To: ecos-devel

Hi Bart,

 > So, I think there is one solution (untested) that may work:

 > --- cdl/infra.cdl	29 Jan 2009 17:49:44 -0000	1.18
 > +++ cdl/infra.cdl	7 Aug 2009 13:30:03 -0000
 > @@ -59,7 +59,8 @@ cdl_package CYGPKG_INFRA {
 >      compile startup.cxx prestart.cxx pkgstart.cxx userstart.cxx      \
 >              dummyxxmain.cxx null.cxx simple.cxx fancy.cxx buffer.cxx \
 >              diag.cxx tcdiag.cxx memcpy.c memset.c delete.cxx eprintf.c \
 > -	    pure.cxx gccsupport.cxx
 > +            gccsupport.cxx
 > +    compile -library=libextras.a pure.cxx
 >

I've tried this patch as well with arm-eabi toolchain and it solved the 
__cxa_pure_virtual issue.

That means uSTL 1.3 package now compiles successfully in all 
configurations and with different optimisation levels.

Regards, Uwe

^ permalink raw reply	[flat|nested] 20+ messages in thread
* Re: Strange __cxa_pure_virtual problem
@ 2009-08-07 11:35 cetoni GmbH - Uwe Kindler
  2009-08-07 12:04 ` John Dallaway
  0 siblings, 1 reply; 20+ messages in thread
From: cetoni GmbH - Uwe Kindler @ 2009-08-07 11:35 UTC (permalink / raw)
  Cc: John Dallaway, ecos-devel, Sergei Gavrikov

Hi John,

thank you for the hint.

I replaced the __cxa_pure_virtual function in infra/pure.cxx by the 
following code


#include <cxxabi.h>

extern "C" void
__cxxabiv1::__cxa_pure_virtual (void)
{
     CYG_FAIL("attempt to use a virtual function before object has been 
constructed");
     for ( ; ; );
}

It did not solve the problem.

Regards, Uwe

^ permalink raw reply	[flat|nested] 20+ messages in thread
* Strange __cxa_pure_virtual problem
@ 2009-08-05 18:55 Uwe Kindler
  2009-08-07  9:35 ` John Dallaway
  0 siblings, 1 reply; 20+ messages in thread
From: Uwe Kindler @ 2009-08-05 18:55 UTC (permalink / raw)
  To: ecos-devel

Hi,

I'm currently in the process of testing uSTL library port. I tried to 
build the library without filestream support and without package file I/O.

The library build process succeeds. Bu if I start building the test 
cases then the compiler fails on building diag_sprintf1 test with the 
error message:

make[1]: Leaving directory 
`/home/Nutzer/ustl_test_08_nofio_build/infra/current'
/opt/ecos/gnutools/arm-eabi/bin/../lib/gcc/arm-eabi/4.3.2/../../../../arm-eabi/lib/nointerwork/libsupc++.a(pure.o): 
In function `__cxa_pure_virtual':
make: Leaving directory `/home/Nutzer/ustl_test_08_nofio_build'
(.text.__cxa_pure_virtual+0x14): undefined reference to `write'
collect2: ld returned 1 exit status

So the compiler/linker does not link the __cxa_pure_virtual function in 
infra/current/src/pure.cxx and instead takes the implementation from 
libsupc++.

In the libsupc++ source file pure.cc the function __cxa_pure_virtual 
writes an error string to stderr via 'write' function. Because no file 
I/O package is present, there is no write function and the reference to 
'write' is undefinded.

This error only occures for debug builds (-g2 -O0). If I build with -g 
-O2 this error does not occur. This problem does not occur, if I link my 
  main.cpp application against the library but it occures when I build 
test cases. As soon as I add the file I/O package, the tests build 
process succeeds because a 'write' function is present.

The question is, how can/should I solve this problem? Is there a way to 
force the compiler/linker to use the infra/current/src/pure.cxx 
implementation or should I provide a dummy 'write' function in uSTL 
package if file I/O package is not present?

Regards, Uwe

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2009-08-21 14:55 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-12  9:10 Strange __cxa_pure_virtual problem cetoni GmbH - Uwe Kindler
  -- strict thread matches above, loose matches on Subject: below --
2009-08-19 14:35 cetoni GmbH - Uwe Kindler
2009-08-19 16:05 ` John Dallaway
2009-08-21 14:55 ` Bart Veer
2009-08-12 17:49 Uwe Kindler
2009-08-12 19:07 ` Bart Veer
2009-08-13  8:00   ` Uwe Kindler
2009-08-19 10:37     ` Bart Veer
     [not found] <4A827EDC.3030004@cetoni.de>
2009-08-12 14:15 ` Jonathan Larmour
2009-08-08  6:04 Uwe Kindler
2009-08-07 11:35 cetoni GmbH - Uwe Kindler
2009-08-07 12:04 ` John Dallaway
2009-08-07 13:40   ` Bart Veer
2009-08-07 15:08     ` John Dallaway
2009-08-07 15:42       ` Bart Veer
2009-08-11  9:05       ` Daniel Néri
2009-08-07 16:31     ` Sergei Gavrikov
2009-08-12  1:34     ` Jonathan Larmour
2009-08-05 18:55 Uwe Kindler
2009-08-07  9:35 ` John Dallaway

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).