RE: [arm-gnu] Tons of seemly extraneous code linked in c++ program
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [arm-gnu] Tons of seemly extraneous code linked in c++ program
- To: " <arm-gnu@xxxxxxxxxxxxxxxx>" <arm-gnu@xxxxxxxxxxxxxxxx>, Gene Smith <gds@xxxxxxxxxxxxx>
- Subject: RE: [arm-gnu] Tons of seemly extraneous code linked in c++ program
- From: freddie_chopin@xxxxx
- Date: Wed, 25 May 2011 08:11:27 +0200
W dniu 2011-05-25 07:54:42 użytkownik Gene Smith <gds@xxxxxxxxxxxxx> napisał:
> I am trying to build some 3rd party c++ code and when I do I end up with
> a huge .text section containing what almost looks like *all* the stdc
> library functions such as read(), write(), variation on sprintf and
> malloc/free, multiply, divide, what looks like floating point functions,
> plus *lots* of others. However, the c++ code does not seem to explicitly
> use or call any of these library functions. (Actually, c++ code does do
> a memcpy and makes use of setjmp/longjmp but I don't think these would
> cause what I see.)
>
> The code is about 120k bytes and 90%+ of it is library code being pulled
> in for unknown reasons.
>
> Also, to successfully link, the program required adding a syscalls.c
> stub file for other low level calls, e.g., _sbrk, none of which appear
> to be used by the c++ program.
>
> The code does make use of static class initialization constructors and
> there was an issue that caused malloc to be linked in and called by the
> _atexit() on object destruction but I think a change was made some time
> back to define malloc in newlib as "weak" so it would not be pulled in
> unless it was already used for other purposes. I think I have enabled
> this with -fno-threadsafe-statics and/or -fno-use-cxa-atexit compiler
> flags, but I still see malloc / free (plus many others) being pulled in.
>
> Any idea what I am doing wrong to cause this? It is hard to tell looking
> at the objdump output as to where these many library functions are being
> called by the c++ code.
>
> The processor is cortex-m3 / stm32 and I am still using g++ version 2010.09.
Seems to me like the "exceptions problem" http://www.codesourcery.com/archives/arm-gnu/msg02941.html
Cheers!