summaryrefslogtreecommitdiffstats
path: root/compiler-rt
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2013-12-25 12:11:06 +0000
committerAlexey Samsonov <samsonov@google.com>2013-12-25 12:11:06 +0000
commit782ad0eb718072b657fc49af0ff914c3a91971e3 (patch)
treea6918c246550178401aa7df9eefefb9cbc9ee514 /compiler-rt
parent371e3638337096968a63c9eb1e76302975916cf9 (diff)
downloadbcm5719-llvm-782ad0eb718072b657fc49af0ff914c3a91971e3.tar.gz
bcm5719-llvm-782ad0eb718072b657fc49af0ff914c3a91971e3.zip
[Sanitizer] Remove now unused symbolization functionality from MemoryMappingLayout
llvm-svn: 198014
Diffstat (limited to 'compiler-rt')
-rw-r--r--compiler-rt/lib/sanitizer_common/CMakeLists.txt1
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h27
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_procmaps_linux.cc27
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_procmaps_mac.cc8
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_procmaps_posix.cc52
-rwxr-xr-xcompiler-rt/lib/tsan/go/buildgo.sh2
6 files changed, 15 insertions, 102 deletions
diff --git a/compiler-rt/lib/sanitizer_common/CMakeLists.txt b/compiler-rt/lib/sanitizer_common/CMakeLists.txt
index 05631dc680e..a2a1e1f1a0a 100644
--- a/compiler-rt/lib/sanitizer_common/CMakeLists.txt
+++ b/compiler-rt/lib/sanitizer_common/CMakeLists.txt
@@ -16,7 +16,6 @@ set(SANITIZER_SOURCES
sanitizer_printf.cc
sanitizer_procmaps_linux.cc
sanitizer_procmaps_mac.cc
- sanitizer_procmaps_posix.cc
sanitizer_stackdepot.cc
sanitizer_stacktrace.cc
sanitizer_suppressions.cc
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h b/compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h
index 73abc5aa937..4d1c11f9abe 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h
@@ -20,20 +20,6 @@
namespace __sanitizer {
-#if SANITIZER_WINDOWS
-class MemoryMappingLayout {
- public:
- explicit MemoryMappingLayout(bool cache_enabled) {
- (void)cache_enabled;
- }
- bool GetObjectNameAndOffset(uptr addr, uptr *offset,
- char filename[], uptr filename_size,
- uptr *protection) {
- UNIMPLEMENTED();
- }
-};
-
-#else // SANITIZER_WINDOWS
#if SANITIZER_LINUX
struct ProcSelfMapsBuff {
char *data;
@@ -49,11 +35,6 @@ class MemoryMappingLayout {
bool Next(uptr *start, uptr *end, uptr *offset,
char filename[], uptr filename_size, uptr *protection);
void Reset();
- // Gets the object file name and the offset in that object for a given
- // address 'addr'. Returns true on success.
- bool GetObjectNameAndOffset(uptr addr, uptr *offset,
- char filename[], uptr filename_size,
- uptr *protection);
// In some cases, e.g. when running under a sandbox on Linux, ASan is unable
// to obtain the memory mappings. It should fall back to pre-cached data
// instead of aborting.
@@ -71,12 +52,6 @@ class MemoryMappingLayout {
private:
void LoadFromCache();
- // Default implementation of GetObjectNameAndOffset.
- // Quite slow, because it iterates through the whole process map for each
- // lookup.
- bool IterateForObjectNameAndOffset(uptr addr, uptr *offset,
- char filename[], uptr filename_size,
- uptr *protection);
// FIXME: Hide implementation details for different platforms in
// platform-specific files.
@@ -111,8 +86,6 @@ void GetMemoryProfile(fill_profile_f cb, uptr *stats, uptr stats_size);
// Returns code range for the specified module.
bool GetCodeRangeForFile(const char *module, uptr *start, uptr *end);
-#endif // SANITIZER_WINDOWS
-
} // namespace __sanitizer
#endif // SANITIZER_PROCMAPS_H
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_linux.cc b/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_linux.cc
index 6079edb257c..343dc7e615d 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_linux.cc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_linux.cc
@@ -191,24 +191,15 @@ bool MemoryMappingLayout::Next(uptr *start, uptr *end, uptr *offset,
return true;
}
-// Gets the object name and the offset by walking MemoryMappingLayout.
-bool MemoryMappingLayout::GetObjectNameAndOffset(uptr addr, uptr *offset,
- char filename[],
- uptr filename_size,
- uptr *protection) {
- return IterateForObjectNameAndOffset(addr, offset, filename, filename_size,
- protection);
-}
-
uptr MemoryMappingLayout::DumpListOfModules(LoadedModule *modules,
uptr max_modules,
string_predicate_t filter) {
Reset();
- uptr cur_beg, cur_end;
+ uptr cur_beg, cur_end, cur_offset;
InternalScopedBuffer<char> module_name(kMaxPathLength);
uptr n_modules = 0;
for (uptr i = 0; n_modules < max_modules &&
- Next(&cur_beg, &cur_end, 0, module_name.data(),
+ Next(&cur_beg, &cur_end, &cur_offset, module_name.data(),
module_name.size(), 0);
i++) {
const char *cur_name = module_name.data();
@@ -217,7 +208,19 @@ uptr MemoryMappingLayout::DumpListOfModules(LoadedModule *modules,
if (filter && !filter(cur_name))
continue;
void *mem = &modules[n_modules];
- LoadedModule *cur_module = new(mem) LoadedModule(cur_name, cur_beg);
+ // Don't subtract 'cur_beg' from the first entry:
+ // * If a binary is compiled w/o -pie, then the first entry in
+ // process maps is likely the binary itself (all dynamic libs
+ // are mapped higher in address space). For such a binary,
+ // instruction offset in binary coincides with the actual
+ // instruction address in virtual memory (as code section
+ // is mapped to a fixed memory range).
+ // * If a binary is compiled with -pie, all the modules are
+ // mapped high at address space (in particular, higher than
+ // shadow memory of the tool), so the module can't be the
+ // first entry.
+ uptr base_address = (i ? cur_beg : 0) - cur_offset;
+ LoadedModule *cur_module = new(mem) LoadedModule(cur_name, base_address);
cur_module->addAddressRange(cur_beg, cur_end);
n_modules++;
}
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_mac.cc b/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_mac.cc
index a9edf756357..1eb02abc4a5 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_mac.cc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_mac.cc
@@ -153,14 +153,6 @@ bool MemoryMappingLayout::Next(uptr *start, uptr *end, uptr *offset,
return false;
}
-bool MemoryMappingLayout::GetObjectNameAndOffset(uptr addr, uptr *offset,
- char filename[],
- uptr filename_size,
- uptr *protection) {
- return IterateForObjectNameAndOffset(addr, offset, filename, filename_size,
- protection);
-}
-
uptr MemoryMappingLayout::DumpListOfModules(LoadedModule *modules,
uptr max_modules,
string_predicate_t filter) {
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_posix.cc b/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_posix.cc
deleted file mode 100644
index b19d14a1e93..00000000000
--- a/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_posix.cc
+++ /dev/null
@@ -1,52 +0,0 @@
-//===-- sanitizer_procmaps_posix.cc ---------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Information about the process mappings.
-//===----------------------------------------------------------------------===//
-
-#include "sanitizer_platform.h"
-#if SANITIZER_POSIX
-#include "sanitizer_common.h"
-#include "sanitizer_procmaps.h"
-
-namespace __sanitizer {
-
-bool MemoryMappingLayout::IterateForObjectNameAndOffset(uptr addr, uptr *offset,
- char filename[],
- uptr filename_size,
- uptr *protection) {
- Reset();
- uptr start, end, file_offset;
- for (int i = 0; Next(&start, &end, &file_offset, filename, filename_size,
- protection);
- i++) {
- if (addr >= start && addr < end) {
- // Don't subtract 'start' for the first entry:
- // * If a binary is compiled w/o -pie, then the first entry in
- // process maps is likely the binary itself (all dynamic libs
- // are mapped higher in address space). For such a binary,
- // instruction offset in binary coincides with the actual
- // instruction address in virtual memory (as code section
- // is mapped to a fixed memory range).
- // * If a binary is compiled with -pie, all the modules are
- // mapped high at address space (in particular, higher than
- // shadow memory of the tool), so the module can't be the
- // first entry.
- *offset = (addr - (i ? start : 0)) + file_offset;
- return true;
- }
- }
- if (filename_size)
- filename[0] = '\0';
- return false;
-}
-
-} // namespace __sanitizer
-
-#endif // SANITIZER_POSIX
diff --git a/compiler-rt/lib/tsan/go/buildgo.sh b/compiler-rt/lib/tsan/go/buildgo.sh
index e8b90b70af9..715fd79af3e 100755
--- a/compiler-rt/lib/tsan/go/buildgo.sh
+++ b/compiler-rt/lib/tsan/go/buildgo.sh
@@ -33,7 +33,6 @@ if [ "`uname -a | grep Linux`" != "" ]; then
../../sanitizer_common/sanitizer_posix.cc
../../sanitizer_common/sanitizer_posix_libcdep.cc
../../sanitizer_common/sanitizer_procmaps_linux.cc
- ../../sanitizer_common/sanitizer_procmaps_posix.cc
../../sanitizer_common/sanitizer_linux.cc
../../sanitizer_common/sanitizer_linux_libcdep.cc
../../sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
@@ -48,7 +47,6 @@ elif [ "`uname -a | grep Darwin`" != "" ]; then
../../sanitizer_common/sanitizer_posix.cc
../../sanitizer_common/sanitizer_posix_libcdep.cc
../../sanitizer_common/sanitizer_procmaps_mac.cc
- ../../sanitizer_common/sanitizer_procmaps_posix.cc
"
elif [ "`uname -a | grep MINGW`" != "" ]; then
SUFFIX="windows_amd64"
OpenPOWER on IntegriCloud