diff options
author | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-02-28 21:58:24 +0000 |
---|---|---|
committer | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-02-28 21:58:24 +0000 |
commit | 82da59c616d91ae6c8cba72b74d38ac3eefb0af5 (patch) | |
tree | 758d98e071ebf53438273bab0cdc776460d7db3a /nuttx/libxx | |
parent | d83d1596b0e069eb66977a0b4fcdfa0b176dfb15 (diff) | |
download | px4-firmware-82da59c616d91ae6c8cba72b74d38ac3eefb0af5.tar.gz px4-firmware-82da59c616d91ae6c8cba72b74d38ac3eefb0af5.tar.bz2 px4-firmware-82da59c616d91ae6c8cba72b74d38ac3eefb0af5.zip |
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/Makefile | 4 | ||||
-rw-r--r--[-rwxr-xr-x] | nuttx/libxx/README.txt | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | nuttx/libxx/libxx_cxapurevirtual.cxx | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | nuttx/libxx/libxx_delete.cxx | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | nuttx/libxx/libxx_deletea.cxx | 0 | ||||
-rw-r--r-- | nuttx/libxx/libxx_eabi_atexit.cxx | 83 | ||||
-rw-r--r--[-rwxr-xr-x] | nuttx/libxx/libxx_new.cxx | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | nuttx/libxx/libxx_newa.cxx | 0 |
8 files changed, 85 insertions, 2 deletions
diff --git a/nuttx/libxx/Makefile b/nuttx/libxx/Makefile index 0326e64e4..f34a52600 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 7b292bff5..7b292bff5 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 e8912558a..e8912558a 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 223a7bea9..223a7bea9 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 3c519bd2c..3c519bd2c 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 000000000..aa0ff6956 --- /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 8ec725ca8..8ec725ca8 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 855160c41..855160c41 100755..100644 --- a/nuttx/libxx/libxx_newa.cxx +++ b/nuttx/libxx/libxx_newa.cxx |