2014-12-20 François Dumont <fdumont@gcc.gnu.org>
[official-gcc.git] / libstdc++-v3 / libsupc++ / vtv_stubs.cc
blobca0fee12d6a33c16c24ba4842cc4d757effc3b1d
1 // Copyright (C) 2012-2014 Free Software Foundation, Inc.
2 //
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
7 // any later version.
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // Under Section 7 of GPL version 3, you are granted additional
15 // permissions described in the GCC Runtime Library Exception, version
16 // 3.1, as published by the Free Software Foundation.
18 // You should have received a copy of the GNU General Public License and
19 // a copy of the GCC Runtime Library Exception along with this program;
20 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
21 // <http://www.gnu.org/licenses/>.
23 /* This is part of the vtable verification runtime library. For more
24 information about this feature, see the comments in libvtv/vtv_rts.cc. */
26 /* The functions in this file are used to create the libvtv_stubs
27 library, as part of the vtable verification feature. When building
28 a binary without vtable verification, and linking it with a
29 (possibly pre-built third-party) library that was built with
30 verification, it is possible that vtable verification will fail due
31 to incomplete data (rather than due to corrupt vtable pointers). In
32 this case we need to give programmers a way of turning off the
33 vtable verification in their libraries. They can do so by linking
34 with the libvtv_stubs library, which (as you can see) will replace
35 the real verification functions with a set of functions that do
36 nothing (so no more verification failures/aborts). */
38 #include <cstddef>
40 // Declare as weak for libsupc++, strong definitions are in libvtv.
41 #if __GXX_WEAK__
42 extern "C"
43 void
44 __VLTChangePermission(int) __attribute__((weak));
46 void
47 __VLTRegisterSet(void**, const void*, std::size_t, std::size_t,
48 void**) __attribute__((weak));
50 void
51 __VLTRegisterPair(void**, const void*, std::size_t,
52 const void*) __attribute__((weak));
54 const void*
55 __VLTVerifyVtablePointer(void**, const void*) __attribute__((weak));
57 void
58 __VLTRegisterSetDebug(void**, const void*, std::size_t, std::size_t,
59 void**) __attribute__((weak));
61 void
62 __VLTRegisterPairDebug(void**, const void*, std::size_t, const void*,
63 const char*, const char*) __attribute__((weak));
65 const void*
66 __VLTVerifyVtablePointerDebug(void**, const void*, const char*,
67 const char*) __attribute__((weak));
68 #endif
70 // Stub definitions.
71 extern "C"
72 void
73 __VLTChangePermission(int)
74 { }
76 void
77 __VLTRegisterSet(void**, const void*, std::size_t, std::size_t, void**)
78 { }
80 void
81 __VLTRegisterPair(void**, const void*, std::size_t, const void*)
82 { }
84 const void*
85 __VLTVerifyVtablePointer(void**, const void* vtable_ptr)
86 { return vtable_ptr; }
88 void
89 __VLTRegisterSetDebug(void**, const void*, std::size_t, std::size_t, void**)
90 { }
92 void
93 __VLTRegisterPairDebug(void**, const void*, std::size_t, const void*,
94 const char*, const char*)
95 { }
97 const void*
98 __VLTVerifyVtablePointerDebug(void**, const void* vtable_ptr, const char*,
99 const char*)
100 { return vtable_ptr; }