This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: linker question: rtti/exception functions


Hi,

...
> > What I don't understand is the reason for this reference to __builtin_delete.
> > What puzzles me is that an empty destructor invokes (or at least somehow
> > references) a memory management function. I do not use new() or delete()
> > in my test example; I simply declared a object in global scope.
> 
> It's because the compiler needs to provide for the ability to delete an
> object which was created using operator new.  Gcc handles this by passing a
> hidden argument to the destructor which says whether or not ::operator
> delete() needs to be called to free memory at the end of the destructor.
> 
> Creating objects on the heap is so fundamental to C++ that there is no
> compiler option to defeat this code (that I know of).  The only way to avoid
> it is to declare all destructors inline, so that the call to ::operator
> delete() can be optimized out.
> 
> If that's not acceptable, you could just stub out the offending functions:
> 
>   void operator delete(void*) { } 
> 
>   void operator delete[](void*) { }

I will have to define these functions anyway, so this will solve the
problem. Thanks for the explanation.

> 
> If you look at the resulting assembler code, you'll find that these
> functions are actually called __builtin_delete and __builtin_vec_delete at
> the assembler level.
> 

I see. That's the reason why I could not find these functions literally
in the gcc sources. Thanks again.


Best Regards
D.Ruppert
RTS GmbH
Schwieberdingen/Germany
ru@swb.siemens.de


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]