summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Kosnik <bkoz@redhat.com>2013-07-30 22:13:46 -0700
committerBenjamin Kosnik <bkoz@redhat.com>2013-07-30 22:13:46 -0700
commit930691bd7df307eff3af44854aafbe36b6bde8ff (patch)
tree6c554bf3780825f65ff50388753903c41cb8bb70
parent9ccdf91eb2b0bf09807c95ac920465f466aea09b (diff)
downloadgcc-930691bd7df307eff3af44854aafbe36b6bde8ff.tar.gz
2013-07-30 Benjamin Kosnik <bkoz@redhat.com>
* vtv_init.cc: Remove.
-rw-r--r--libvtv/ChangeLog2
-rw-r--r--libvtv/vtv_init.cc92
2 files changed, 2 insertions, 92 deletions
diff --git a/libvtv/ChangeLog b/libvtv/ChangeLog
index 222fb2ed2fe..f08027e8d00 100644
--- a/libvtv/ChangeLog
+++ b/libvtv/ChangeLog
@@ -2,6 +2,8 @@
* scripts/run-testsuite.sh (CXX): From VTV_CXXLINKFLAGS.
+ * vtv_init.cc: Remove.
+
2013-07-30 Caroline Tice <cmtice@google.com>
Benjamin Kosnik <bkoz@redhat.com>
diff --git a/libvtv/vtv_init.cc b/libvtv/vtv_init.cc
deleted file mode 100644
index f47fa34d251..00000000000
--- a/libvtv/vtv_init.cc
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Copyright (C) 2012-2013
- Free Software Foundation
-
- 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 3, 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.
-
- 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 file contains all the definitions that go into the libvtv_init
- library, which is part of the vtable verification feature. This
- library should contain exactly two functions (__VLTunprotect and
- __VLTprotect) and one global variable definition
- (__vtv_defined_in_vtv_init_lib). Any program that was compiled
- with the option "-fvtable-verify=std" MUST also be linked with
- libvtv_init, because the two functions defined here are used by the
- vtable verification code. The reason they are in a separate
- library rather than in libstdc++ with all the rest of the vtable
- verification runtime code is as follows. Each .o file that was
- compiled with vtable verification will contain calls into the
- runtime (made from constructor initialization functions) to build
- the data structures needed for verification. At all times except
- when they are being constructed, these data structures need to be
- in protected memory, so that attackers cannot corrupt them.
- __VLTunprotect sets the memory containing these data structures to
- be writable, for updates. __VLTprotect makes the memory read-only,
- for all other times. This memory protection and unprotection is
- done via calls to mprotect, which are costly. So instead of
- calling __VLTunprotect and __VLTprotect once per object file we
- want to call them once per executable. Therefore instead of
- putting calls to them directly into each object file, we put the
- calls to them only in __VLTRegisterPair, in the libstdc++ library.
- We give __VLTunprotect an initialization priority to make it run
- before all of our data structure construction functions, and we
- give __VLTprotect an initialization priority to make it run after
- all of our data structure constructiion functions. We put them
- into a separate library and link that library with the
- "--whole-archive" linker option, to make sure that both functions get
- linked in (since the actual calls to them are in the libstdc++
- runtime). We can't put them into libstdc++ because linking
- libstdc++ with "--whole-archive" is probably not a good idea.
-
- The __vtv_defined_in_vtv_lib variable is referenced, but not
- defined, in the constructor initialization functions where we have
- the calls to build our data structures. The purpose of this
- variable is to cause a linker error to occur if the programmer
- compiled with -fvtable-verify=std and did not link with the vtv_int
- library (better a link-time error than a run-time error). */
-
-#ifndef __cplusplus
-#error "This file must be compiled with a C++ compiler"
-#endif
-
-#include "../include/vtv-change-permission.h"
-#include "vtv_rts.h"
-
-/* Define this dummy symbol to detect at link time the cases where
- user is compiling with -fvtable-verify=std and not linking with the
- vtv_init library. Note that the visibility needs to be hidden. Each
- object module is supposed to link with the vtv_init library and we
- don't want this definition to come from a different library */
-unsigned int
-__vtv_defined_in_vtv_init_lib __attribute__ ((visibility ("hidden"))) = 0;
-
-
-__attribute__ ((constructor(98))) void
-__VLTunprotect (void)
-{
- __VLTChangePermission (__VLTP_READ_WRITE);
-}
-
-__attribute__ ((constructor(100))) void
-__VLTprotect (void)
-{
- __VLTChangePermission (__VLTP_READ_ONLY);
-}