Hi Jacek,

On Mon, Dec 03, 2007 at 06:57:35PM +0100, Jacek M. Holeczek wrote:
> > 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").

Just removing the RTTI code didn't help.  I needed to remove the RTTI
code and compile with -fno-rtti.

I used this sample program to test it:

============================================
class foo {
    virtual void bar() { }
};
int main() {
    //foo *x = new foo;
    foo y;
    return 0;
}
============================================

Just the existence of a virtual method was enough to pull in all the
exception handling code unless I also specify -fno-rtti.

I also needed to implement some C++ stubs - if anyone is curious,
they're at the very bottom of the page at:

http://handhelds.org/cgi-bin/cvsweb.cgi/~checkout~/haret/src/wince/libcfunc.cpp

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

Thanks.

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

I meant using gcc instead of g++ for c++ code - gcc will work, it just
wont pull in libsupc++.a/libstdc++.a by default.  If one goes through
the trouble of compiling with -fno-exceptions then they probably don't
want libsupc++.a to be pulled in.  (If libsupc++.a is pulled in, then
they get the 40K and -fno-exceptions doesn't improve exe size.)  So,
they're probably better off using the gcc frontend instead of the g++
frontend even for c++ code.

-Kevin

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