summaryrefslogtreecommitdiffstats
path: root/nuttx/libxx
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-02-28 21:58:24 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-02-28 21:58:24 +0000
commit7b2d6f83b69892f68b4e9fe3102b686169c86e2c (patch)
tree758d98e071ebf53438273bab0cdc776460d7db3a /nuttx/libxx
parentb048945590f3b7e34c54dad97e64808f4283cd60 (diff)
Add support for C++ static constructors (at least to a few platforms)
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4438 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/libxx')
-rw-r--r--[-rwxr-xr-x]nuttx/libxx/Makefile4
-rw-r--r--[-rwxr-xr-x]nuttx/libxx/README.txt0
-rw-r--r--[-rwxr-xr-x]nuttx/libxx/libxx_cxapurevirtual.cxx0
-rw-r--r--[-rwxr-xr-x]nuttx/libxx/libxx_delete.cxx0
-rw-r--r--[-rwxr-xr-x]nuttx/libxx/libxx_deletea.cxx0
-rw-r--r--nuttx/libxx/libxx_eabi_atexit.cxx83
-rw-r--r--[-rwxr-xr-x]nuttx/libxx/libxx_new.cxx0
-rw-r--r--[-rwxr-xr-x]nuttx/libxx/libxx_newa.cxx0
8 files changed, 85 insertions, 2 deletions
diff --git a/nuttx/libxx/Makefile b/nuttx/libxx/Makefile
index 0326e64e45..f34a526000 100755..100644
--- a/nuttx/libxx/Makefile
+++ b/nuttx/libxx/Makefile
@@ -39,8 +39,8 @@ ASRCS =
AOBJS = $(ASRCS:.S=$(OBJEXT))
CSRCS =
COBJS = $(CSRCS:.c=$(OBJEXT))
-CXXSRCS = libxx_new.cxx libxx_newa.cxx libxx_delete.cxx \
- libxx_deletea.cxx libxx_cxapurevirtual.cxx
+CXXSRCS = libxx_cxapurevirtual.cxx libxx_delete.cxx libxx_deletea.cxx \
+ libxx_eabi_atexit.cxx libxx_new.cxx libxx_newa.cxx
CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
diff --git a/nuttx/libxx/README.txt b/nuttx/libxx/README.txt
index 7b292bff52..7b292bff52 100755..100644
--- a/nuttx/libxx/README.txt
+++ b/nuttx/libxx/README.txt
diff --git a/nuttx/libxx/libxx_cxapurevirtual.cxx b/nuttx/libxx/libxx_cxapurevirtual.cxx
index e8912558a5..e8912558a5 100755..100644
--- a/nuttx/libxx/libxx_cxapurevirtual.cxx
+++ b/nuttx/libxx/libxx_cxapurevirtual.cxx
diff --git a/nuttx/libxx/libxx_delete.cxx b/nuttx/libxx/libxx_delete.cxx
index 223a7bea90..223a7bea90 100755..100644
--- a/nuttx/libxx/libxx_delete.cxx
+++ b/nuttx/libxx/libxx_delete.cxx
diff --git a/nuttx/libxx/libxx_deletea.cxx b/nuttx/libxx/libxx_deletea.cxx
index 3c519bd2ce..3c519bd2ce 100755..100644
--- a/nuttx/libxx/libxx_deletea.cxx
+++ b/nuttx/libxx/libxx_deletea.cxx
diff --git a/nuttx/libxx/libxx_eabi_atexit.cxx b/nuttx/libxx/libxx_eabi_atexit.cxx
new file mode 100644
index 0000000000..aa0ff6956c
--- /dev/null
+++ b/nuttx/libxx/libxx_eabi_atexit.cxx
@@ -0,0 +1,83 @@
+//***************************************************************************
+// libxx/libxx_eabi_atexit.cxx
+//
+// Copyright (C) 2012 Gregory Nutt. All rights reserved.
+// Author: Gregory Nutt <gnutt@nuttx.org>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in
+// the documentation and/or other materials provided with the
+// distribution.
+// 3. Neither the name NuttX nor the names of its contributors may be
+// used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//***************************************************************************
+
+//***************************************************************************
+// Included Files
+//***************************************************************************
+
+#include <nuttx/config.h>
+#include <cstdlib>
+
+//***************************************************************************
+// Definitions
+//***************************************************************************
+
+//***************************************************************************
+// Private Data
+//***************************************************************************
+
+extern "C"
+{
+ //*************************************************************************
+ // Public Data
+ //*************************************************************************
+
+ void *__dso_handle = NULL;
+
+ //*************************************************************************
+ // Public Functions
+ //*************************************************************************
+
+ //*************************************************************************
+ // Name: __aeabi_atexit
+ //
+ // Description:
+ // Registers static object destructors. Normally atexit(f) should call
+ // __aeabi_atexit (NULL, f, NULL). But in the usage model here, static
+ // constructors are initialized at power up and are never destroyed
+ // because they have global scope and must persist for as long as the
+ // embedded device is powered on.
+ //
+ // Reference:
+ // http://infocenter.arm.com/help/topic/com.arm.doc.ihi0041c/IHI0041C_cppabi.pdf
+ //
+ //*************************************************************************
+
+ int __aeabi_atexit(void* object, void (*destroyer)(void*), void *dso_handle)
+ {
+ //return __cxa_atexit(destroyer, object, dso_handle); // 0 ? OK; non-0 ? failed }
+ return 0;
+ }
+}
diff --git a/nuttx/libxx/libxx_new.cxx b/nuttx/libxx/libxx_new.cxx
index 8ec725ca8b..8ec725ca8b 100755..100644
--- a/nuttx/libxx/libxx_new.cxx
+++ b/nuttx/libxx/libxx_new.cxx
diff --git a/nuttx/libxx/libxx_newa.cxx b/nuttx/libxx/libxx_newa.cxx
index 855160c412..855160c412 100755..100644
--- a/nuttx/libxx/libxx_newa.cxx
+++ b/nuttx/libxx/libxx_newa.cxx