Add ksrt_gcce.lib with ucppini.cpp and ucppfini.cpp, as new fix for bug 3359 GCC_SURGE
authorWilliam Roberts <williamr@symbian.org>
Thu, 29 Jul 2010 23:52:13 +0100
branchGCC_SURGE
changeset 237 2604c9de91e0
parent 236 7dc50dc94301
child 238 959c796a6191
Add ksrt_gcce.lib with ucppini.cpp and ucppfini.cpp, as new fix for bug 3359 Remove the older fix which added ksrt4_0.lib as a static library in lots of places
kernel/eka/compsupp/gcce/bld.inf
kernel/eka/compsupp/gcce/dllexp.cpp
kernel/eka/compsupp/gcce/ksrt_gcce.mmp
kernel/eka/compsupp/gcce/ucppfini.cpp
kernel/eka/compsupp/gcce/ucppinit.cpp
kernel/eka/compsupp/gcce/usrt_gcce.mmp
kernel/eka/drivers/debug/group/rm_debug_kerneldriver.mmh
kerneltest/e32test/group/d_ldd.mmp
kerneltest/e32test/group/d_ldd2.mmp
kerneltest/e32test/group/d_ldd2_ram.mmp
kerneltest/e32test/group/d_ldd_ram.mmp
kerneltest/e32test/group/d_lddns.mmp
kerneltest/e32test/group/rescontrol_extended_psl.mmp
kerneltest/e32test/group/rescontrol_psl.mmp
kerneltest/e32test/hcr/d_hcrsim_client.mmp
kerneltest/e32test/hcr/d_hcrsim_own.mmp
kerneltest/e32test/hcr/d_hcrut.mmp
--- a/kernel/eka/compsupp/gcce/bld.inf	Tue Jul 27 07:53:26 2010 +0100
+++ b/kernel/eka/compsupp/gcce/bld.inf	Thu Jul 29 23:52:13 2010 +0100
@@ -18,7 +18,6 @@
 
 ARMV5
 
-
 PRJ_EXPORTS
 
 // Workaround for GCCE builds
@@ -29,5 +28,5 @@
 
 PRJ_MMPFILES
 
-// none - (yet)
-
+ksrt_gcce
+// usrt_gcce   // not yet working
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/compsupp/gcce/dllexp.cpp	Thu Jul 29 23:52:13 2010 +0100
@@ -0,0 +1,21 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is part of usrt.lib and ksrt.lib.
+// 
+//
+
+
+extern "C" void __DLL_Export_Table__() { }  // This function (and the whole file)
+                                            // can be removed when we drop support
+                                            // for ABIV1.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/compsupp/gcce/ksrt_gcce.mmp	Thu Jul 29 23:52:13 2010 +0100
@@ -0,0 +1,31 @@
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//	Mike Kinghan, mikek@symbian.org. for Symbian Foundation
+//
+// Description:
+//
+
+target			ksrt_gcce.lib
+
+targettype      klib
+
+always_build_as_arm
+SMPSAFE
+
+macro           _NO_FP
+
+source          ucppinit.cpp
+source			ucppfini.cpp
+source          dllexp.cpp
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/compsupp/gcce/ucppfini.cpp	Thu Jul 29 23:52:13 2010 +0100
@@ -0,0 +1,87 @@
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// This file is now part of ksrt.lib, to allow for writeable static data in kernel-side executables
+// 
+//
+
+
+extern "C" {
+
+typedef void (DTOR)(void *);
+
+struct dtd 
+{ 
+    void * obj;
+    DTOR * dtor; 
+};
+
+
+#define MAX_DTOR_RECORDS 256
+dtd dtor_rec[MAX_DTOR_RECORDS];
+
+typedef dtd** dso_handle;
+dtd * __dso_handle = &dtor_rec[MAX_DTOR_RECORDS];
+
+
+// This is called by compiler generated code to record needed destructions of
+// dynamically initialized (ctor) top level (BSS) data. 
+// I guess this is more efficient for the compiler than __cxa_atexit, since 
+// it takes the object that needs dtoring as its first arg, which means its in
+// the right register when the ctor returns.
+void __aeabi_atexit(void *aObject, void (*aDtor)(void *), dso_handle aHandle)
+    {
+    dtd * drec = *aHandle;
+    drec--;
+
+    if (drec < &dtor_rec[0])
+        return; // Need to decide what to do here
+
+    drec->dtor = aDtor;
+    drec->obj  = aObject;
+
+    *aHandle = drec;
+    }
+
+int __cxa_atexit( void (*aDtor)(void *), void *aObject, dso_handle aHandle )
+    {
+    __aeabi_atexit(aObject, aDtor, aHandle);
+
+    // This is what the C++ GABI spec says to do!!
+    if (*aHandle < &dtor_rec[0]) 
+        return -1;
+
+    return 0;
+    }
+
+void __cxa_finalize(dso_handle d)
+    {
+    dtd * drec = * d;
+    dtd * lim  = &dtor_rec[MAX_DTOR_RECORDS];
+    
+    while (drec < lim) 
+        {
+        drec->dtor(drec->obj);
+        drec++;
+        }
+
+    *d = drec;
+    }
+
+void run_static_dtors()
+    {
+    __cxa_finalize(&__dso_handle);
+    }
+
+
+} // extern "C"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/compsupp/gcce/ucppinit.cpp	Thu Jul 29 23:52:13 2010 +0100
@@ -0,0 +1,52 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+// Mike Kinghan, mikek@symbian.org, for Symbian Foundation.
+//
+// Description:
+// This file is part of usrt.lib and ksrt.lib.
+// 
+//
+
+
+extern "C" __NAKED__ void __cpp_initialize__aeabi_()
+    {
+    asm(".code 32");
+	asm(".weak SHT$$INIT_ARRAY$$Base");
+	asm(".weak SHT$$INIT_ARRAY$$Limit");
+	asm(".global _ZSt7nothrow");     
+	asm("STMFD    r13!,{r3-r5,r14}");
+	asm("LDR      r4,base");
+	asm("LDR      r5,limit");
+	asm("CMP      r4,r5");
+    // Exit if the array is empty.
+    asm("LDMEQFD  r13!,{r3-r5,pc}");
+	asm("loop:");
+    asm("LDR      r0,[r4,#0]");
+    asm("ADD      r0,r0,r4");
+#ifdef __MARM_ARMV4__
+    asm("ADR      r14,ret");
+    asm("MOV      pc,r0");
+#else
+    asm("BLX      r0");
+#endif
+	asm("ret:");
+    asm("ADD      r4,r4,#4");
+    asm("CMP      r4,r5");
+    asm("BNE      loop");
+    asm("LDMFD    r13!,{r3-r5,pc}");
+	asm("base:");
+    asm(".word SHT$$INIT_ARRAY$$Base");
+	asm("limit:");
+    asm(".word SHT$$INIT_ARRAY$$Limit");
+	asm("_ZSt7nothrow:");
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/compsupp/gcce/usrt_gcce.mmp	Thu Jul 29 23:52:13 2010 +0100
@@ -0,0 +1,31 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "ARM EABI LICENCE.txt"
+// which accompanies this distribution, and is available
+// in kernel/eka/compsupp.
+//
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// user-side runtime support library
+// 
+//
+
+target          usrt_gcce.lib
+targettype      lib
+
+always_build_as_arm
+
+source          ucppfini.cpp
+source          ucppinit.cpp 
+source          dllexp.cpp
+source          ../symaehabi/callfirstprocessfn.cpp
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+SMPSAFE
--- a/kernel/eka/drivers/debug/group/rm_debug_kerneldriver.mmh	Tue Jul 27 07:53:26 2010 +0100
+++ b/kernel/eka/drivers/debug/group/rm_debug_kerneldriver.mmh	Thu Jul 29 23:52:13 2010 +0100
@@ -52,9 +52,4 @@
 
 capability			all
 
-#ifdef GCCE
-staticlibrary usrt4_0.lib
-library drtaeabi.dso
-#endif
-
 SMPSAFE
--- a/kerneltest/e32test/group/d_ldd.mmp	Tue Jul 27 07:53:26 2010 +0100
+++ b/kerneltest/e32test/group/d_ldd.mmp	Thu Jul 29 23:52:13 2010 +0100
@@ -29,10 +29,5 @@
 UID		0x100000af
 VENDORID 0x70000001
 
-#ifdef GCCE
-staticlibrary usrt4_0.lib
-library drtaeabi.dso
-#endif
-
 capability		all
 SMPSAFE
--- a/kerneltest/e32test/group/d_ldd2.mmp	Tue Jul 27 07:53:26 2010 +0100
+++ b/kerneltest/e32test/group/d_ldd2.mmp	Thu Jul 29 23:52:13 2010 +0100
@@ -26,10 +26,5 @@
 
 EPOCALLOWDLLDATA
 
-#ifdef GCCE
-staticlibrary usrt4_0.lib
-library drtaeabi.dso
-#endif
-
 capability		all
 SMPSAFE
--- a/kerneltest/e32test/group/d_ldd2_ram.mmp	Tue Jul 27 07:53:26 2010 +0100
+++ b/kerneltest/e32test/group/d_ldd2_ram.mmp	Thu Jul 29 23:52:13 2010 +0100
@@ -29,10 +29,5 @@
 romtarget
 ramtarget +
 
-#ifdef GCCE
-staticlibrary usrt4_0.lib
-library drtaeabi.dso
-#endif
-
 capability		all
 SMPSAFE
--- a/kerneltest/e32test/group/d_ldd_ram.mmp	Tue Jul 27 07:53:26 2010 +0100
+++ b/kerneltest/e32test/group/d_ldd_ram.mmp	Thu Jul 29 23:52:13 2010 +0100
@@ -31,10 +31,5 @@
 romtarget
 RAMTARGET +
 
-#ifdef GCCE
-staticlibrary usrt4_0.lib
-library drtaeabi.dso
-#endif
-
 capability		all
 SMPSAFE
--- a/kerneltest/e32test/group/d_lddns.mmp	Tue Jul 27 07:53:26 2010 +0100
+++ b/kerneltest/e32test/group/d_lddns.mmp	Thu Jul 29 23:52:13 2010 +0100
@@ -30,10 +30,5 @@
 VENDORID 0x70000001
 RAMTARGET D_LDDNS_ram.LDD
 
-#ifdef GCCE
-staticlibrary usrt4_0.lib
-library drtaeabi.dso
-#endif
-
 capability		all
 SMPSAFE
--- a/kerneltest/e32test/group/rescontrol_extended_psl.mmp	Tue Jul 27 07:53:26 2010 +0100
+++ b/kerneltest/e32test/group/rescontrol_extended_psl.mmp	Thu Jul 29 23:52:13 2010 +0100
@@ -46,11 +46,6 @@
 uid			0x100039d0 0x10285812
 capability 	all
 
-#ifdef GCCE
-staticlibrary usrt4_0.lib
-library drtaeabi.dso
-#endif
-
 start wins
 win32_headers
 end
--- a/kerneltest/e32test/group/rescontrol_psl.mmp	Tue Jul 27 07:53:26 2010 +0100
+++ b/kerneltest/e32test/group/rescontrol_psl.mmp	Thu Jul 29 23:52:13 2010 +0100
@@ -43,11 +43,6 @@
 uid			0x100039d0 0x10285812
 capability 	all
 
-#ifdef GCCE
-staticlibrary usrt4_0.lib
-library drtaeabi.dso
-#endif
-
 start wins
 win32_headers
 end
--- a/kerneltest/e32test/hcr/d_hcrsim_client.mmp	Tue Jul 27 07:53:26 2010 +0100
+++ b/kerneltest/e32test/hcr/d_hcrsim_client.mmp	Thu Jul 29 23:52:13 2010 +0100
@@ -33,11 +33,6 @@
 epocallowdlldata
 smpsafe
 
-#ifdef GCCE
-staticlibrary usrt4_0.lib
-library drtaeabi.dso
-#endif
-
 start wins
 win32_headers
 end
--- a/kerneltest/e32test/hcr/d_hcrsim_own.mmp	Tue Jul 27 07:53:26 2010 +0100
+++ b/kerneltest/e32test/hcr/d_hcrsim_own.mmp	Thu Jul 29 23:52:13 2010 +0100
@@ -32,11 +32,6 @@
 epocallowdlldata
 smpsafe
 
-#ifdef GCCE
-staticlibrary usrt4_0.lib
-library drtaeabi.dso
-#endif
-
 start wins
 win32_headers
 end
--- a/kerneltest/e32test/hcr/d_hcrut.mmp	Tue Jul 27 07:53:26 2010 +0100
+++ b/kerneltest/e32test/hcr/d_hcrut.mmp	Thu Jul 29 23:52:13 2010 +0100
@@ -38,11 +38,6 @@
 epocallowdlldata
 smpsafe
 
-#ifdef GCCE
-staticlibrary usrt4_0.lib
-library drtaeabi.dso
-#endif
-
 start wins
 win32_headers
 end