Interim solution for bug 3117 and 2979. GCC_SURGE
authorMike Kinghan <mikek@symbian.org>
Tue, 13 Jul 2010 14:42:36 +0100
branchGCC_SURGE
changeset 203 71dce6d9df02
parent 197 adb088c9cfcf
child 205 0b74fa7370f0
Interim solution for bug 3117 and 2979.
kernel/eka/common/arm/cmem.cia
kernel/eka/common/arm/gccehlp.cpp
--- a/kernel/eka/common/arm/cmem.cia	Wed Jul 07 22:00:46 2010 +0100
+++ b/kernel/eka/common/arm/cmem.cia	Tue Jul 13 14:42:36 2010 +0100
@@ -183,6 +183,45 @@
 
     }
 
+#ifdef __EABI__
+//mikek N.B. These __aeabi_mem functions are also defined in rvct/compsupp/aeabimem.cpp
+// and should be implemented in the compsupp library, not here, when we build one for gcce.  
+
+#define EXPORT_EABI_MEMSET_VENEER(name) \
+extern "C" EXPORT_C __NAKED__ TAny* (name)(TAny* /*aTrg*/, unsigned int /*aLength*/, TInt /*aValue*/ ) \
+{ \
+    asm("   and      r2, r2, #255"); \
+	asm("	b		 fill		 "); \
+}
+
+EXPORT_EABI_MEMSET_VENEER(__aeabi_memset8)
+EXPORT_EABI_MEMSET_VENEER(__aeabi_memset4)
+EXPORT_EABI_MEMSET_VENEER(__aeabi_memset)
+
+#define EXPORT_EABI_MEMCLR_ALIAS(alias) \
+extern "C" EXPORT_C __NAKED__ TAny* (alias)(TAny* /*aTrg*/, unsigned int /*aLength*/ ) \
+{ \
+	asm("   b  memclr  "); \
+}
+
+EXPORT_EABI_MEMCLR_ALIAS(__aeabi_memclr8)
+EXPORT_EABI_MEMCLR_ALIAS(__aeabi_memclr4)
+EXPORT_EABI_MEMCLR_ALIAS(__aeabi_memclr)
+
+#define EXPORT_EABI_MEMMOVE_ALIAS(alias,func) \
+extern "C" EXPORT_C __NAKED__ TAny* (alias)(TAny* /*aTrg*/, const TAny* /*aSrc*/, unsigned int /*aLength*/) \
+{ \
+	asm("   b " #func ); \
+}
+
+EXPORT_EABI_MEMMOVE_ALIAS(__aeabi_memcpy8,memcpy)
+EXPORT_EABI_MEMMOVE_ALIAS(__aeabi_memcpy4,memcpy)
+EXPORT_EABI_MEMMOVE_ALIAS(__aeabi_memcpy,memcpy)
+EXPORT_EABI_MEMMOVE_ALIAS(__aeabi_memmove8,memmove)
+EXPORT_EABI_MEMMOVE_ALIAS(__aeabi_memmove4,memmove)
+EXPORT_EABI_MEMMOVE_ALIAS(__aeabi_memmove,memmove)
+#endif // __EABI__
+
 #endif  // USE_REPLACEMENT_MEMSET
 
 #ifndef USE_REPLACEMENT_MEMCPY
--- a/kernel/eka/common/arm/gccehlp.cpp	Wed Jul 07 22:00:46 2010 +0100
+++ b/kernel/eka/common/arm/gccehlp.cpp	Tue Jul 13 14:42:36 2010 +0100
@@ -59,6 +59,63 @@
 
 void __cxa_end_cleanup() {}
 
+EXPORT_C void __cxa_guard_abort() {}
+
+EXPORT_C void __cxa_guard_acquire() {}
+
+EXPORT_C void __cxa_guard_release() {}
+
 #endif
 }
 
+//
+// The global new operator.
+//
+#include <kernel/kernel.h>
+
+EXPORT_C TAny* operator new[](TUint aSize, const std::nothrow_t&) __NO_THROW
+	{
+	return Kern::Alloc(aSize);
+	}
+
+EXPORT_C TAny* operator new(TUint aSize, const std::nothrow_t&) __NO_THROW
+	{
+	return Kern::Alloc(aSize);
+	}
+
+
+
+__NAKED__ void __rt_exporter_dummy(void)
+	{
+// Ensure that "vtable for __cxxabiv1::__si_class_type_info" is available from ekern.exe
+// ** This is almost certainly just creating an instance of the symbol, without supplying the 
+// ** required functionality!
+
+#define COMM_SYMBOL(x)  asm(".comm " x ",4")
+
+COMM_SYMBOL("_ZTVN10__cxxabiv117__class_type_infoE");     // vtable for __cxxabiv1::__class_type_info
+COMM_SYMBOL("_ZTVN10__cxxabiv120__si_class_type_infoE");  // vtable for __cxxabiv1::__si_class_type_info
+COMM_SYMBOL("_ZTVN10__cxxabiv121__vmi_class_type_infoE"); // vtable for __cxxabiv1::__vmi_class_type_info
+
+// Implementations exist as globals in libgcc.a, we just need to pull them in
+#define IMPORT_GLOBAL(x)  asm(".global " x );
+
+IMPORT_GLOBAL("__aeabi_lasr");
+IMPORT_GLOBAL("__aeabi_lcmp");
+IMPORT_GLOBAL("__aeabi_llsl");
+IMPORT_GLOBAL("__aeabi_llsr");
+IMPORT_GLOBAL("__aeabi_lmul");
+IMPORT_GLOBAL("__aeabi_ulcmp");
+
+// Implementations exist as "hidden" in libgcc.a, so we need to pull them in and reveal them
+// ** This version will completely fail to do that, but creates junk to be exported
+#define IMPORT_HIDDEN(x)  asm(".comm " x ",4");
+
+// unaligned-funcs.c
+IMPORT_HIDDEN("__aeabi_uread4");
+IMPORT_HIDDEN("__aeabi_uread8");
+IMPORT_HIDDEN("__aeabi_uwrite4");
+IMPORT_HIDDEN("__aeabi_uwrite8");
+
+	}
+