This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


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: C++ pure virtual base class memory consumption


On 08/22/2012 08:28 AM, Sebastian Huber wrote:
> On 08/21/2012 08:39 PM, fueb wrote:
>>
>>
>> Sebastian Huber-4 wrote:
>>>
>>> Are you sure this code is from Newlib and not GCC?
>>>
>>
>> I think the code is being inserted by GCC and in turn many things from
>> newlib get linked in.
>> ../arm-none-eabi/lib/thumb2\libstdc++.a(pure.o)
>> ../arm-none-eabi/lib/thumb2\libstdc++.a(eh_terminate.o)
>> ../arm-none-eabi/lib/thumb2\libstdc++.a(eh_call.o)
>> ../arm-none-eabi/lib/thumb2\libstdc++.a(eh_exception.o)
>>
>> and may other things I cannot post here since the mapfile is quite large.
> 
> The libstdc++ is not from newlib.  It is provided by GCC.  You should produce two map files, with and without the pure virtual function.  Compare the two map files and look at the additional modules.  It is very likely the unwinder and the exception handling support code.

Back when I was doing embedded stuff eons ago, I used to trim all that by
providing my own lean implementation of __cxa_pure_virtual (and others I
don't recall right now -- look at the map file for hints), the hook libstdc++ calls
when a pure virtual is called.  The default one pulls in a lot of that stuff you
don't want.  Doing a web search on that function name finds other people doing
the same.  E.g.,

 http://f.osdev.org/viewtopic.php?f=1&t=10798

-- 
Pedro Alves


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