[llvm-commits] [compiler-rt] r157250 - /compiler-rt/trunk/lib/asan/asan_linux.cc

Kostya Serebryany kcc at google.com
Tue May 22 06:31:35 PDT 2012


Author: kcc
Date: Tue May 22 08:31:35 2012
New Revision: 157250

URL: http://llvm.org/viewvc/llvm-project?rev=157250&view=rev
Log:
[asan] nuke some old unused code

Modified:
    compiler-rt/trunk/lib/asan/asan_linux.cc

Modified: compiler-rt/trunk/lib/asan/asan_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_linux.cc?rev=157250&r1=157249&r2=157250&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_linux.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_linux.cc Tue May 22 08:31:35 2012
@@ -216,8 +216,6 @@
   return true;
 }
 
-#if 1
-
 // Gets the object name and the offset by walking AsanProcMaps.
 bool AsanProcMaps::GetObjectNameAndOffset(uintptr_t addr, uintptr_t *offset,
                                           char filename[],
@@ -225,55 +223,6 @@
   return IterateForObjectNameAndOffset(addr, offset, filename, filename_size);
 }
 
-#else
-// dl_iterate_phdr machinery is not working well for us.
-// We either need to fix it or get rid of it.
-struct DlIterateData {
-  int count;
-  uintptr_t addr;
-  uintptr_t offset;
-  char *filename;
-  size_t filename_size;
-};
-
-static int dl_iterate_phdr_callback(struct dl_phdr_info *info,
-                                    size_t size, void *raw_data) {
-  DlIterateData *data = (DlIterateData*)raw_data;
-  int count = data->count++;
-  if (info->dlpi_addr > data->addr)
-    return 0;
-  if (count == 0) {
-    // The first item (the main executable) does not have a so name,
-    // but we can just read it from /proc/self/exe.
-    size_t path_len = readlink("/proc/self/exe",
-                               data->filename, data->filename_size - 1);
-    data->filename[path_len] = 0;
-  } else {
-    CHECK(info->dlpi_name);
-    REAL(strncpy)(data->filename, info->dlpi_name, data->filename_size);
-  }
-  data->offset = data->addr - info->dlpi_addr;
-  return 1;
-}
-
-// Gets the object name and the offset using dl_iterate_phdr.
-bool AsanProcMaps::GetObjectNameAndOffset(uintptr_t addr, uintptr_t *offset,
-                                          char filename[],
-                                          size_t filename_size) {
-  DlIterateData data;
-  data.count = 0;
-  data.addr = addr;
-  data.filename = filename;
-  data.filename_size = filename_size;
-  if (dl_iterate_phdr(dl_iterate_phdr_callback, &data)) {
-    *offset = data.offset;
-    return true;
-  }
-  return false;
-}
-
-#endif  // __arm__
-
 void AsanThread::SetThreadStackTopAndBottom() {
   if (tid() == 0) {
     // This is the main thread. Libpthread may not be initialized yet.





More information about the llvm-commits mailing list