Hi,

I don't have the cegcc at hand now, so I can only say what I recall.

> > undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
> > undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info'
> > undefined reference to `vtable for __cxxabiv1::__class_type_info'
> > undefined reference to `__cxa_pure_virtual'

I once did a similar exercise.
It turned out that, I needed to pool out some 20 to 30 separate object
files from the libstdc++ library, in order to "resolve" all references
"manually". And, of course, the total size of those object files was about
40 kB.

> Okay, so the magic gcc flag here is: -fno-rtti

Well, the situation is more complicated here:

`-fno-rtti'
     Disable generation of information about every class with virtual
     functions for use by the C++ runtime type identification features
     (`dynamic_cast' and `typeid').  If you don't use those parts of
     the language, you can save some space by using this flag.  Note
     that exception handling uses the same information, but it will
     generate it as needed.

> Jacek, I think it would be better to reword your FAQ so that it states
> using -fno-exceptions, -fno-rtti, and using gcc instead of g++.
> Anything less and even simple c++ programs are going to end up pulling
> in all the code.  Even with these steps, it is likely stubs for new,
> delete, and __cxa_pure_virtual will be needed.

So, I think that what happens is the following ... your code uses the
"rtti", which then automatically triggers the additional code to be
linked-in (the same code which is used for the "exception handling").

Note that, for gcc the "-fno-exceptions" is the default, no need to add
this flag. Also the "-fno-rtti" seems to be C++ "specific" (well, I need
to cross-check it, of course).

I will investigate this problem a bit and if I come to any conclusions I
will modify the FAQ (I will need some time, though, don't expect it in
the nearest days).

And, of course, if your code is "pure" C, you should use gcc, that is
clear, no need to mention it explicitly, I think.

The question/answer 10 concerns g++, i.e. people who need to use/port C++
in their life (well, adding "-fno-exceptions" to the g++ compiler flags
helped in one of my cases, without the need for "-fno-rtti"; the other
case was explicitly using "exception handling", so I could not reduce its
size).

Jacek.

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to