This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: Factor __aeabi_atexit into its own object file
- From: Mark Mitchell <mark at codesourcery dot com>
- To: libstdc++ at gcc dot gnu dot org
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 3 May 2007 20:50:10 -0700
- Subject: PATCH: Factor __aeabi_atexit into its own object file
- Reply-to: mark at codesourcery dot com
This patch moves __aeabi_atexit (a variant of __cxa_atexit required by
the ARM EABI) into its own object file. At present, it was mixed in
with vec.o which contains vector construction/destruction routines.
As a result, an application with a global object with a destructor
(which therefore uses __aeabie_atexit) pulled in these vector
routines, and all the EH support that comes with that.
I also added an exception specification for __cxa_atexit in <cxxabi.h>
so that the compiler can tell that __aeabi_atexit does not need unwind
information. (We should have exception specifications for more
declarations in <cxxabi.h>, but I didn't want to try to do all of that
in this patch.)
This seems near-obvious, but I'll give the libstdc++ maintainers a few
days to tell me if I'm being an idiot. I've tested this patch against
a 4.2-based compiler for ARM EABI, and against x86_64-linux-gnu; on
the latter, the patch is nearly a no-op, since __aeabi_atexit is of
course not defined.
Thanks,
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713
2007-05-02 Mark Mitchell <mark@codesourcery.com>
* libsupc++/atexit_arm.cc: New file.
* libsupc++/vec.cc (__aeabi_atexit): Remove.
* libsupc++/cxxabi.h (__cxa_atexit): Add exception specification.
* libsupc++/Makefile.am: Add atexit_arm.cc.
* libsupc++/Makefile.in: Regenerated.
Index: libstdc++-v3/libsupc++/atexit_arm.cc
===================================================================
--- libstdc++-v3/libsupc++/atexit_arm.cc (revision 0)
+++ libstdc++-v3/libsupc++/atexit_arm.cc (revision 0)
@@ -0,0 +1,44 @@
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of GCC.
+//
+// GCC is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// GCC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with GCC; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cxxabi.h>
+
+#if defined(__arm__) && defined(__ARM_EABI__)
+
+namespace __aeabiv1
+{
+ extern "C" int
+ __aeabi_atexit (void *object,
+ void (*destructor) (void *),
+ void *dso_handle) throw ()
+ {
+ return abi::__cxa_atexit(destructor, object, dso_handle);
+ }
+} // namespace __aeabiv1
+
+#endif // defined(__arm__) && defined(__ARM_EABI__)
Index: libstdc++-v3/libsupc++/vec.cc
===================================================================
--- libstdc++-v3/libsupc++/vec.cc (revision 170155)
+++ libstdc++-v3/libsupc++/vec.cc (working copy)
@@ -499,14 +499,6 @@ namespace __aeabiv1
2 * sizeof (std::size_t),
/*destructor=*/NULL, dealloc);
}
-
- extern "C" int
- __aeabi_atexit (void *object,
- void (*destructor) (void *),
- void *dso_handle)
- {
- return abi::__cxa_atexit(destructor, object, dso_handle);
- }
} // namespace __aeabiv1
#endif // defined(__arm__) && defined(__ARM_EABI__)
Index: libstdc++-v3/libsupc++/cxxabi.h
===================================================================
--- libstdc++-v3/libsupc++/cxxabi.h (revision 170155)
+++ libstdc++-v3/libsupc++/cxxabi.h (working copy)
@@ -136,7 +136,7 @@ namespace __cxxabiv1
// DSO destruction.
int
- __cxa_atexit(void (*)(void*), void*, void*);
+ __cxa_atexit(void (*)(void*), void*, void*) throw ();
int
__cxa_finalize(void*);
Index: libstdc++-v3/libsupc++/Makefile.am
===================================================================
--- libstdc++-v3/libsupc++/Makefile.am (revision 170155)
+++ libstdc++-v3/libsupc++/Makefile.am (working copy)
@@ -47,6 +47,7 @@ endif
sources = \
array_type_info.cc \
+ atexit_arm.cc \
bad_cast.cc \
bad_typeid.cc \
class_type_info.cc \