diff options
Diffstat (limited to 'libstdc++-v3/libsupc++')
-rw-r--r-- | libstdc++-v3/libsupc++/Makefile.am | 15 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/Makefile.in | 24 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/vtv_stubs.cc | 100 |
3 files changed, 133 insertions, 6 deletions
diff --git a/libstdc++-v3/libsupc++/Makefile.am b/libstdc++-v3/libsupc++/Makefile.am index b4e86f53144..f0ab6026ca3 100644 --- a/libstdc++-v3/libsupc++/Makefile.am +++ b/libstdc++-v3/libsupc++/Makefile.am @@ -26,6 +26,7 @@ include $(top_srcdir)/fragment.am # separately too. # 1) separate libsupc++.la toolexeclib_LTLIBRARIES = libsupc++.la + # 2) integrated libsupc++convenience.la that is to be a part of libstdc++.a noinst_LTLIBRARIES = libsupc++convenience.la @@ -96,8 +97,13 @@ sources = \ vmi_class_type_info.cc \ vterminate.cc -libsupc___la_SOURCES = $(sources) $(c_sources) -libsupc__convenience_la_SOURCES = $(sources) $(c_sources) +if ENABLE_VTABLE_VERIFY + vtv_sources = \ + vtv_stubs.cc +endif + +libsupc___la_SOURCES = $(sources) $(c_sources) $(vtv_sources) +libsupc__convenience_la_SOURCES = $(sources) $(c_sources) $(vtv_sources) cp-demangle.c: rm -f $@ @@ -282,3 +288,8 @@ uninstall-bitsHEADERS: q=`echo $$p | sed -e 's,.*/,,'`; \ rm -f $(DESTDIR)$(bitsdir)/$$q; \ done + + +# By adding these files here, automake will remove them for 'make clean' +CLEANFILES = stamp-* + diff --git a/libstdc++-v3/libsupc++/Makefile.in b/libstdc++-v3/libsupc++/Makefile.in index 0f2c1ee2637..88b237e1275 100644 --- a/libstdc++-v3/libsupc++/Makefile.in +++ b/libstdc++-v3/libsupc++/Makefile.in @@ -105,10 +105,13 @@ am__objects_1 = array_type_info.lo atexit_arm.lo atexit_thread.lo \ pointer_type_info.lo pure.lo si_class_type_info.lo tinfo.lo \ tinfo2.lo vec.lo vmi_class_type_info.lo vterminate.lo @GLIBCXX_HOSTED_TRUE@am__objects_2 = cp-demangle.lo -am_libsupc___la_OBJECTS = $(am__objects_1) $(am__objects_2) +@ENABLE_VTABLE_VERIFY_TRUE@am__objects_3 = vtv_stubs.lo +am_libsupc___la_OBJECTS = $(am__objects_1) $(am__objects_2) \ + $(am__objects_3) libsupc___la_OBJECTS = $(am_libsupc___la_OBJECTS) libsupc__convenience_la_LIBADD = -am_libsupc__convenience_la_OBJECTS = $(am__objects_1) $(am__objects_2) +am_libsupc__convenience_la_OBJECTS = $(am__objects_1) $(am__objects_2) \ + $(am__objects_3) libsupc__convenience_la_OBJECTS = \ $(am_libsupc__convenience_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) @@ -235,6 +238,9 @@ SYMVER_FILE = @SYMVER_FILE@ TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ +VTV_CXXFLAGS = @VTV_CXXFLAGS@ +VTV_CXXLINKFLAGS = @VTV_CXXLINKFLAGS@ +VTV_PCH_CXXFLAGS = @VTV_PCH_CXXFLAGS@ WARN_FLAGS = @WARN_FLAGS@ WERROR = @WERROR@ XMLLINT = @XMLLINT@ @@ -331,6 +337,8 @@ toolexecdir = $(glibcxx_toolexecdir) toolexeclibdir = $(glibcxx_toolexeclibdir) @ENABLE_WERROR_FALSE@WERROR_FLAG = @ENABLE_WERROR_TRUE@WERROR_FLAG = $(WERROR) +@ENABLE_EXTERN_TEMPLATE_FALSE@XTEMPLATE_FLAGS = +@ENABLE_EXTERN_TEMPLATE_TRUE@XTEMPLATE_FLAGS = -fno-implicit-templates # These bits are all figured out from configure. Look in acinclude.m4 # or configure.ac to see how they are set. See GLIBCXX_EXPORT_FLAGS. @@ -348,6 +356,7 @@ AM_CPPFLAGS = $(GLIBCXX_INCLUDES) # separately too. # 1) separate libsupc++.la toolexeclib_LTLIBRARIES = libsupc++.la + # 2) integrated libsupc++convenience.la that is to be a part of libstdc++.a noinst_LTLIBRARIES = libsupc++convenience.la std_HEADERS = \ @@ -414,8 +423,11 @@ sources = \ vmi_class_type_info.cc \ vterminate.cc -libsupc___la_SOURCES = $(sources) $(c_sources) -libsupc__convenience_la_SOURCES = $(sources) $(c_sources) +@ENABLE_VTABLE_VERIFY_TRUE@vtv_sources = \ +@ENABLE_VTABLE_VERIFY_TRUE@ vtv_stubs.cc + +libsupc___la_SOURCES = $(sources) $(c_sources) $(vtv_sources) +libsupc__convenience_la_SOURCES = $(sources) $(c_sources) $(vtv_sources) # AM_CXXFLAGS needs to be in each subdirectory so that it can be # modified in a per-library or per-sub-library way. Need to manually @@ -499,6 +511,9 @@ CXXLINK = \ # prepending each of $(*_HEADERS) with VPATH below. stddir = $(gxx_include_dir) bitsdir = $(gxx_include_dir)/bits + +# By adding these files here, automake will remove them for 'make clean' +CLEANFILES = stamp-* all: all-am .SUFFIXES: @@ -683,6 +698,7 @@ install-strip: mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) diff --git a/libstdc++-v3/libsupc++/vtv_stubs.cc b/libstdc++-v3/libsupc++/vtv_stubs.cc new file mode 100644 index 00000000000..a41d943f31f --- /dev/null +++ b/libstdc++-v3/libsupc++/vtv_stubs.cc @@ -0,0 +1,100 @@ +// Copyright (C) 2012-2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option) +// any later version. + +// This library 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. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// <http://www.gnu.org/licenses/>. + +/* This is part of the vtable verification runtime library. For more + information about this feature, see the comments in libvtv/vtv_rts.cc. */ + +/* The functions in this file are used to create the libvtv_stubs + library, as part of the vtable verification feature. When building + a binary without vtable verification, and linking it with a + (possibly pre-built third-party) library that was built with + verification, it is possible that vtable verification will fail due + to incomplete data (rather than due to corrupt vtable pointers). In + this case we need to give programmers a way of turning off the + vtable verification in their libraries. They can do so by linking + with the libvtv_stubs library, which (as you can see) will replace + the real verification functions with a set of functions that do + nothing (so no more verification failures/aborts). */ + +#include <cstddef> + +// Declare as weak for libsupc++, strong definitions are in libvtv. +#if __GXX_WEAK__ +extern "C" +void +__VLTChangePermission(int) __attribute__((weak)); + +void +__VLTRegisterSet(void**, const void*, std::size_t, std::size_t, + void**) __attribute__((weak)); + +void +__VLTRegisterPair(void**, const void*, std::size_t, + const void*) __attribute__((weak)); + +const void* +__VLTVerifyVtablePointer(void**, const void*) __attribute__((weak)); + +void +__VLTRegisterSetDebug(void**, const void*, std::size_t, std::size_t, + void**) __attribute__((weak)); + +void +__VLTRegisterPairDebug(void**, const void*, std::size_t, const void*, + const char*, const char*) __attribute__((weak)); + +const void* +__VLTVerifyVtablePointerDebug(void**, const void*, const char*, + const char*) __attribute__((weak)); +#endif + +// Stub definitions. +extern "C" +void +__VLTChangePermission(int) +{ } + +void +__VLTRegisterSet(void**, const void*, std::size_t, std::size_t, void**) +{ } + +void +__VLTRegisterPair(void**, const void*, std::size_t, const void*) +{ } + +const void* +__VLTVerifyVtablePointer(void**, const void* vtable_ptr) +{ return vtable_ptr; } + +void +__VLTRegisterSetDebug(void**, const void*, std::size_t, std::size_t, void**) +{ } + +void +__VLTRegisterPairDebug(void**, const void*, std::size_t, const void*, + const char*, const char*) +{ } + +const void* +__VLTVerifyVtablePointerDebug(void**, const void* vtable_ptr, const char*, + const char*) +{ return vtable_ptr; } |