Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: third_party/tcmalloc/chromium/src/base/vdso_support.cc

Issue 9323026: [NOT TO COMMIT!] r109: Diff of the current tcmalloc from the original google-perftools r109. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2008, Google Inc. 1 // Copyright (c) 2008, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 22 matching lines...) Expand all
33 // Allow dynamic symbol lookup in the kernel VDSO page. 33 // Allow dynamic symbol lookup in the kernel VDSO page.
34 // 34 //
35 // VDSOSupport -- a class representing kernel VDSO (if present). 35 // VDSOSupport -- a class representing kernel VDSO (if present).
36 // 36 //
37 37
38 #include "base/vdso_support.h" 38 #include "base/vdso_support.h"
39 39
40 #ifdef HAVE_VDSO_SUPPORT // defined in vdso_support.h 40 #ifdef HAVE_VDSO_SUPPORT // defined in vdso_support.h
41 41
42 #include <fcntl.h> 42 #include <fcntl.h>
43 #include <stddef.h> // for ptrdiff_t 43 #include <stddef.h> // for std::ptrdiff_t
44 44
45 #include "base/atomicops.h" // for MemoryBarrier 45 #include "base/atomicops.h" // for MemoryBarrier
46 #include "base/logging.h"
46 #include "base/linux_syscall_support.h" 47 #include "base/linux_syscall_support.h"
47 #include "base/logging.h"
48 #include "base/dynamic_annotations.h" 48 #include "base/dynamic_annotations.h"
49 #include "base/basictypes.h" // for COMPILE_ASSERT 49 #include "base/basictypes.h" // for COMPILE_ASSERT
50 50
51 using base::subtle::MemoryBarrier; 51 using base::subtle::MemoryBarrier;
52 52
53 #ifndef AT_SYSINFO_EHDR 53 #ifndef AT_SYSINFO_EHDR
54 #define AT_SYSINFO_EHDR 33 54 #define AT_SYSINFO_EHDR 33
55 #endif 55 #endif
56 56
57 // From binutils/include/elf/common.h (this doesn't appear to be documented 57 // From binutils/include/elf/common.h (this doesn't appear to be documented
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 break; 259 break;
260 } 260 }
261 } 261 }
262 if (link_base_ == ~0L || !dynamic_program_header) { 262 if (link_base_ == ~0L || !dynamic_program_header) {
263 RAW_DCHECK(~0L != link_base_, "no PT_LOADs in VDSO"); 263 RAW_DCHECK(~0L != link_base_, "no PT_LOADs in VDSO");
264 RAW_DCHECK(dynamic_program_header, "no PT_DYNAMIC in VDSO"); 264 RAW_DCHECK(dynamic_program_header, "no PT_DYNAMIC in VDSO");
265 // Mark this image as not present. Can not recur infinitely. 265 // Mark this image as not present. Can not recur infinitely.
266 Init(0); 266 Init(0);
267 return; 267 return;
268 } 268 }
269 ptrdiff_t relocation = 269 std::ptrdiff_t relocation =
270 base_as_char - reinterpret_cast<const char *>(link_base_); 270 base_as_char - reinterpret_cast<const char *>(link_base_);
271 ElfW(Dyn) *dynamic_entry = 271 ElfW(Dyn) *dynamic_entry =
272 reinterpret_cast<ElfW(Dyn) *>(dynamic_program_header->p_vaddr + 272 reinterpret_cast<ElfW(Dyn) *>(dynamic_program_header->p_vaddr +
273 relocation); 273 relocation);
274 for (; dynamic_entry->d_tag != DT_NULL; ++dynamic_entry) { 274 for (; dynamic_entry->d_tag != DT_NULL; ++dynamic_entry) {
275 ElfW(Xword) value = dynamic_entry->d_un.d_val; 275 ElfW(Xword) value = dynamic_entry->d_un.d_val;
276 if (fake_vdso) { 276 if (fake_vdso) {
277 // A complication: in the real VDSO, dynamic entries are not relocated 277 // A complication: in the real VDSO, dynamic entries are not relocated
278 // (it wasn't loaded by a dynamic loader). But when testing with a 278 // (it wasn't loaded by a dynamic loader). But when testing with a
279 // "fake" dlopen()ed vdso library, the loader relocates some (but 279 // "fake" dlopen()ed vdso library, the loader relocates some (but
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 // ensure it here, with a global constructor of our own. This 554 // ensure it here, with a global constructor of our own. This
555 // is an allowed exception to the normal rule against non-trivial 555 // is an allowed exception to the normal rule against non-trivial
556 // global constructors. 556 // global constructors.
557 static class VDSOInitHelper { 557 static class VDSOInitHelper {
558 public: 558 public:
559 VDSOInitHelper() { VDSOSupport::Init(); } 559 VDSOInitHelper() { VDSOSupport::Init(); }
560 } vdso_init_helper; 560 } vdso_init_helper;
561 } 561 }
562 562
563 #endif // HAVE_VDSO_SUPPORT 563 #endif // HAVE_VDSO_SUPPORT
OLDNEW
« no previous file with comments | « third_party/tcmalloc/chromium/src/base/sysinfo.cc ('k') | third_party/tcmalloc/chromium/src/central_freelist.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698