From c4f6640537ff392ad466a83796e68fb79b512bee Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Mon, 25 Nov 2002 23:17:31 +0000 Subject: [PATCH] Makefile.am (sources): Add guard.cc. * libsupc++/Makefile.am (sources): Add guard.cc. * libsupc++/Makefile.in: Regenerated. * libsupc++/cxxabi.h (__cxa_guard_acquire): New function. (__cxa_guard_release): Likewise. (__cxa_guard_abort): Likewise. * libsupc++/guard.cc: New file. From-SVN: r59475 --- libstdc++-v3/ChangeLog | 9 ++++++ libstdc++-v3/libsupc++/Makefile.am | 1 + libstdc++-v3/libsupc++/Makefile.in | 11 ++++--- libstdc++-v3/libsupc++/cxxabi.h | 14 ++++++++ libstdc++-v3/libsupc++/guard.cc | 51 ++++++++++++++++++++++++++++++ 5 files changed, 81 insertions(+), 5 deletions(-) create mode 100644 libstdc++-v3/libsupc++/guard.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index f060b28be54f..0aeaf55dfe89 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2002-11-25 Mark Mitchell + + * libsupc++/Makefile.am (sources): Add guard.cc. + * libsupc++/Makefile.in: Regenerated. + * libsupc++/cxxabi.h (__cxa_guard_acquire): New function. + (__cxa_guard_release): Likewise. + (__cxa_guard_abort): Likewise. + * libsupc++/guard.cc: New file. + 2002-11-25 Wolfgang Bangerth * include/std/std_complex.h diff --git a/libstdc++-v3/libsupc++/Makefile.am b/libstdc++-v3/libsupc++/Makefile.am index 451dbc3183b7..160e79f714eb 100644 --- a/libstdc++-v3/libsupc++/Makefile.am +++ b/libstdc++-v3/libsupc++/Makefile.am @@ -84,6 +84,7 @@ sources = \ eh_terminate.cc \ eh_throw.cc \ eh_type.cc \ + guard.cc \ new_handler.cc \ new_op.cc \ new_opnt.cc \ diff --git a/libstdc++-v3/libsupc++/Makefile.in b/libstdc++-v3/libsupc++/Makefile.in index 144b50948419..b517b458dd8d 100644 --- a/libstdc++-v3/libsupc++/Makefile.in +++ b/libstdc++-v3/libsupc++/Makefile.in @@ -193,6 +193,7 @@ sources = \ eh_terminate.cc \ eh_throw.cc \ eh_type.cc \ + guard.cc \ new_handler.cc \ new_op.cc \ new_opnt.cc \ @@ -289,15 +290,15 @@ libsupc__convenience_la_LIBADD = libsupc__convenience_la_OBJECTS = del_op.lo del_opnt.lo del_opv.lo \ del_opvnt.lo eh_alloc.lo eh_aux_runtime.lo eh_catch.lo eh_exception.lo \ eh_globals.lo eh_personality.lo eh_terminate.lo eh_throw.lo eh_type.lo \ -new_handler.lo new_op.lo new_opnt.lo new_opv.lo new_opvnt.lo pure.lo \ -tinfo.lo tinfo2.lo vec.lo cxa_demangle.lo dyn-string.lo +guard.lo new_handler.lo new_op.lo new_opnt.lo new_opv.lo new_opvnt.lo \ +pure.lo tinfo.lo tinfo2.lo vec.lo cxa_demangle.lo dyn-string.lo libsupc___la_LDFLAGS = libsupc___la_LIBADD = libsupc___la_OBJECTS = del_op.lo del_opnt.lo del_opv.lo del_opvnt.lo \ eh_alloc.lo eh_aux_runtime.lo eh_catch.lo eh_exception.lo eh_globals.lo \ -eh_personality.lo eh_terminate.lo eh_throw.lo eh_type.lo new_handler.lo \ -new_op.lo new_opnt.lo new_opv.lo new_opvnt.lo pure.lo tinfo.lo \ -tinfo2.lo vec.lo cxa_demangle.lo dyn-string.lo +eh_personality.lo eh_terminate.lo eh_throw.lo eh_type.lo guard.lo \ +new_handler.lo new_op.lo new_opnt.lo new_opv.lo new_opvnt.lo pure.lo \ +tinfo.lo tinfo2.lo vec.lo cxa_demangle.lo dyn-string.lo CXXFLAGS = @CXXFLAGS@ CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) diff --git a/libstdc++-v3/libsupc++/cxxabi.h b/libstdc++-v3/libsupc++/cxxabi.h index 371b77ef2b87..3132187761c2 100644 --- a/libstdc++-v3/libsupc++/cxxabi.h +++ b/libstdc++-v3/libsupc++/cxxabi.h @@ -500,6 +500,20 @@ void __cxa_vec_delete3 (void *__array_address, __SIZE_TYPE__ __padding_size, void (*__destructor) (void *), void (*__dealloc) (void *, __SIZE_TYPE__)); + +/* guard variables */ + +/* The ABI requires a 64-bit type. */ +__extension__ typedef int __guard __attribute__((mode (__DI__))); + +extern "C" +int __cxa_guard_acquire (__guard *); + +extern "C" +void __cxa_guard_release (__guard *); + +extern "C" +void __cxa_guard_abort (__guard *); /* demangling routines */ diff --git a/libstdc++-v3/libsupc++/guard.cc b/libstdc++-v3/libsupc++/guard.cc new file mode 100644 index 000000000000..b93cffd2e208 --- /dev/null +++ b/libstdc++-v3/libsupc++/guard.cc @@ -0,0 +1,51 @@ +// Copyright (C) 2002 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, 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, 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. + +// Written by Mark Mitchell, CodeSourcery LLC, + +#include + +namespace __cxxabiv1 +{ + extern "C" + int __cxa_guard_acquire (__guard *g) + { + return !*(char *)(g); + } + + extern "C" + void __cxa_guard_release (__guard *g) + { + *(char *)g = 1; + } + + extern "C" + void __cxa_guard_abort (__guard *) + { + } +}