jsnyder / avr32-toolchain

Makefile & supporting patches/scripts to build an AVR32 toolchain.
29 stars 30 forks source link

Add a patch which disabled typeid-based getters in shared_ptr. #17

Closed denravonska closed 11 years ago

denravonska commented 11 years ago

This enables the use of -fno-rtti to decrease the binary footprint. See original bug report at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42019.

kblomqvist commented 11 years ago

Interesting. I'm wondering if it would be possible to update Atmel patches to work with GCC 4.5.x?

denravonska commented 11 years ago

I started doing exactly that but so much have changed build system wise between 4.4 and 4.5. I assumed that patch migration would be a nightmare so I left it all to Atmel :)

kblomqvist commented 11 years ago

I'm afraid that we won't see any progress from Atmel's side, at least not in the near future :(

jsnyder commented 11 years ago

My time is a bit short lately to do this sort of testing and it looks like you had to modify this patch a bit to fit the toolchain version. I assume you've checked that it gives the desired fix?

denravonska commented 11 years ago

It does, yes. I was just lazy with this patch and only picked out the relevant parts. It compiles with and without -fno-rtti now and my unit tests pass. I don't have anything I can try on the actual hardware yet but it shouldn't be a difference.

kblomqvist commented 11 years ago

I was looking into this more detailed. Seems so that I have used -fno-rtti without having any errors from the compiler. So do you see an error with -fno-rtti or does it silently fail? Or do I have to use shared_ptr in my code to see the problem?

denravonska commented 11 years ago

That's correct, including the file is enough to trigger the error. When building the test case in the original bug report I get this error message:

Sally:temp marco$ avr32-gcc -fno-rtti shared.cpp 
In file included from /Users/marco/temp/avr32-toolchain/lib/gcc/avr32/4.4.3/include/c++/tr1/memory:60,
                 from shared.cpp:1:
/Users/marco/temp/avr32-toolchain/lib/gcc/avr32/4.4.3/include/c++/tr1/shared_ptr.h: In member function 'virtual void* std::tr1::_Sp_counted_base_impl<_Ptr, _Deleter, _Lp>::_M_get_deleter(const std::type_info&)':
/Users/marco/temp/avr32-toolchain/lib/gcc/avr32/4.4.3/include/c++/tr1/shared_ptr.h:79: error: cannot use typeid with -fno-rtti
/Users/marco/temp/avr32-toolchain/lib/gcc/avr32/4.4.3/include/c++/tr1/shared_ptr.h: In function '_Del* std::tr1::get_deleter(const std::tr1::__shared_ptr<_Tp1, _Lp>&)':
/Users/marco/temp/avr32-toolchain/lib/gcc/avr32/4.4.3/include/c++/tr1/shared_ptr.h:642: error: cannot use typeid with -fno-rtti