This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
How to disable c++ exceptions, -fno-exceptions has no effect?
- From: "Rasmus Stougaard" <stou dot nospam at gmail dot com>
- To: ecos-discuss at ecos dot sourceware dot org
- Date: Tue, 5 Feb 2008 14:11:29 +0100
- Subject: [ECOS] How to disable c++ exceptions, -fno-exceptions has no effect?
Hi,
How do I avoid including the code for c++ exceptions in my ecos application?
My target is at91sam7s256.
I am compiling with
arm-elf-g++ -c -o SolarController.o
-I/home/stou/ecos_workspace/myproject/ecos/install/include
-DGCONF_TARGET_ECOS_ARM7 -Wall -g -Os -DGCONF_USE_PEG
-mcpu=arm7tdmi -Wall -Wpointer-arith -Winline -Wundef
-Woverloaded-virtual -ffunction-sections -fdata-sections -fno-rtti
-fno-exceptions
And linking with:
arm-elf-gcc -o t80_main.elf -nostartfiles -Wall
-Wl,--Map,"mapfile.tmp" -mcpu=arm7tdmi -Wl,--gc-sections -Wl,-static
-Wl,-n -g -nostdlib
-L/home/stou/ecos_workspace/myproject/ecos/install/lib -Ttarget.ld
-fno-exceptions
However my code crashes like this:
[snip]
terminate called after throwing an instance of 'St9bad_alloc'
what(): St9bad_alloc
[/snip]
>From which I conclude that the exceptions are included although I do
not use them explicitly in my code, from what I could figure out it is
thrown by the new_handler in libsupc++.a.
This is part of my mapfile:
[snip]
stou@stou-Xubuntu:arm7_peg$ grep eh_ mapfile.tmp
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_alloc.o)
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_personality.o)
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_terminate.o)
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_personality.o)
(_ZN10__cxxabiv111__terminateEPFvvE)
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_throw.o)
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_unex_handler.o)
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_terminate.o)
(_ZN10__cxxabiv120__unexpected_handlerE)
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_catch.o)
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_personality.o)
(__cxa_begin_catch)
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_exception.o)
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_globals.o)
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_personality.o)
(__cxa_get_globals_fast)
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_term_handler.o)
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_terminate.o)
(_ZN10__cxxabiv119__terminate_handlerE)
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_term_handler.o)
(_ZN9__gnu_cxx27__verbose_terminate_handlerEv)
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_type.o)
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_personality.o)
(abort)
.text 0x0012e3d8 0x354
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_alloc.o)
.text 0x0012e72c 0xb78
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_personality.o)
.text 0x0012f2a4 0xf4
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_terminate.o)
.text 0x0012f398 0x148
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_throw.o)
.text 0x00130390 0x1e8
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_catch.o)
.text 0x00130578 0xbc
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_exception.o)
.text 0x00130634 0x3c8
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_globals.o)
.text 0x00135388 0x20
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_type.o)
0x0013f4d4 0x14
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_exception.o)
0x0013f4e8 0x8
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_exception.o)
0x0013f4f0 0x10
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_exception.o)
0x0013f500 0x14
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_exception.o)
0x0013f514 0xc
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_exception.o)
0x0013f520 0x14
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_exception.o)
0x0013f55c 0x20
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_alloc.o)
0x0013f57c 0x20
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_personality.o)
0x0013f59c 0x10
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_terminate.o)
0x0013f5ac 0x10
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_catch.o)
0x0013f5bc 0x20
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_globals.o)
.eh_frame 0x0013f5f0 0x8
*(.eh_frame)
.data 0x002008a0 0x4
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_alloc.o)
.data 0x002008a4 0x4
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_unex_handler.o)
.data 0x002008a8 0x8
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_globals.o)
.data 0x002008b0 0x4
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_term_handler.o)
.bss 0x00203d64 0x401c
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_alloc.o)
.bss 0x00207d84 0x20
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_globals.o)
.comment 0x00001780 0x20
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_alloc.o)
.comment 0x000017a0 0x20
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_personality.o)
.comment 0x000017c0 0x20
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_terminate.o)
.comment 0x000017e0 0x20
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_throw.o)
.comment 0x00001800 0x20
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_unex_handler.o)
.comment 0x00001860 0x20
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_catch.o)
.comment 0x00001880 0x20
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_exception.o)
.comment 0x000018a0 0x20
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_globals.o)
.comment 0x000018c0 0x20
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_term_handler.o)
.comment 0x00001920 0x20
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_type.o)
stou@stou-Xubuntu:arm7_peg$
[/snip]
What is the purpose of
.bss 0x00203d64 0x401c
/opt/ecos/ecospro/ecos/gnutools/arm-elf/bin/../lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(eh_alloc.o)
Since my total meory size is 64k, thus 16k is a substantial amount of
the total memory budget, and how do I get rid of the exception
handling altogether?
I need the dynamic memory handling (new + delete).
Regards
Rasmus Stougaard
SW Developer, Allsun a/s
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss