OLD | NEW |
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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 break; | 254 break; |
255 } | 255 } |
256 } | 256 } |
257 if (link_base_ == ~0L || !dynamic_program_header) { | 257 if (link_base_ == ~0L || !dynamic_program_header) { |
258 RAW_DCHECK(~0L != link_base_, "no PT_LOADs in VDSO"); | 258 RAW_DCHECK(~0L != link_base_, "no PT_LOADs in VDSO"); |
259 RAW_DCHECK(dynamic_program_header, "no PT_DYNAMIC in VDSO"); | 259 RAW_DCHECK(dynamic_program_header, "no PT_DYNAMIC in VDSO"); |
260 // Mark this image as not present. Can not recur infinitely. | 260 // Mark this image as not present. Can not recur infinitely. |
261 Init(0); | 261 Init(0); |
262 return; | 262 return; |
263 } | 263 } |
264 ptrdiff_t relocation = | 264 std::ptrdiff_t relocation = |
265 base_as_char - reinterpret_cast<const char *>(link_base_); | 265 base_as_char - reinterpret_cast<const char *>(link_base_); |
266 ElfW(Dyn) *dynamic_entry = | 266 ElfW(Dyn) *dynamic_entry = |
267 reinterpret_cast<ElfW(Dyn) *>(dynamic_program_header->p_vaddr + | 267 reinterpret_cast<ElfW(Dyn) *>(dynamic_program_header->p_vaddr + |
268 relocation); | 268 relocation); |
269 bool fake_vdso = false; // Assume we are dealing with the real VDSO. | 269 bool fake_vdso = false; // Assume we are dealing with the real VDSO. |
270 for (ElfW(Dyn) *de = dynamic_entry; de->d_tag != DT_NULL; ++de) { | 270 for (ElfW(Dyn) *de = dynamic_entry; de->d_tag != DT_NULL; ++de) { |
271 ElfW(Sxword) tag = de->d_tag; | 271 ElfW(Sxword) tag = de->d_tag; |
272 if (tag == DT_PLTGOT || tag == DT_RELA || tag == DT_JMPREL || | 272 if (tag == DT_PLTGOT || tag == DT_RELA || tag == DT_JMPREL || |
273 tag == DT_NEEDED || tag == DT_RPATH || tag == DT_VERNEED || | 273 tag == DT_NEEDED || tag == DT_RPATH || tag == DT_VERNEED || |
274 tag == DT_INIT || tag == DT_FINI) { | 274 tag == DT_INIT || tag == DT_FINI) { |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 // ensure it here, with a global constructor of our own. This | 560 // ensure it here, with a global constructor of our own. This |
561 // is an allowed exception to the normal rule against non-trivial | 561 // is an allowed exception to the normal rule against non-trivial |
562 // global constructors. | 562 // global constructors. |
563 static class VDSOInitHelper { | 563 static class VDSOInitHelper { |
564 public: | 564 public: |
565 VDSOInitHelper() { VDSOSupport::Init(); } | 565 VDSOInitHelper() { VDSOSupport::Init(); } |
566 } vdso_init_helper; | 566 } vdso_init_helper; |
567 } | 567 } |
568 | 568 |
569 #endif // HAVE_VDSO_SUPPORT | 569 #endif // HAVE_VDSO_SUPPORT |
OLD | NEW |