OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "crazy_linker_library_list.h" | 5 #include "crazy_linker_library_list.h" |
6 | 6 |
7 #include <assert.h> | 7 #include <assert.h> |
8 #include <crazy_linker.h> | 8 #include <crazy_linker.h> |
9 #include <dlfcn.h> | 9 #include <dlfcn.h> |
10 | 10 |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 LOG(" ... %p %s\n", dependencies[n], dependencies[n]->GetName()); | 424 LOG(" ... %p %s\n", dependencies[n], dependencies[n]->GetName()); |
425 LOG(" dependencies @%p\n", &dependencies); | 425 LOG(" dependencies @%p\n", &dependencies); |
426 } | 426 } |
427 | 427 |
428 // Relocate the library. | 428 // Relocate the library. |
429 LOG("%s: Relocating %s\n", __FUNCTION__, base_name); | 429 LOG("%s: Relocating %s\n", __FUNCTION__, base_name); |
430 if (!lib->Relocate(this, &preloaded_libraries_, &dependencies, error)) | 430 if (!lib->Relocate(this, &preloaded_libraries_, &dependencies, error)) |
431 return NULL; | 431 return NULL; |
432 | 432 |
433 // Notify GDB of load. | 433 // Notify GDB of load. |
434 lib->link_map_.l_addr = lib->load_address(); | 434 lib->link_map_.l_addr = lib->load_bias(); |
435 lib->link_map_.l_name = const_cast<char*>(lib->base_name_); | 435 lib->link_map_.l_name = const_cast<char*>(lib->base_name_); |
436 lib->link_map_.l_ld = reinterpret_cast<uintptr_t>(lib->view_.dynamic()); | 436 lib->link_map_.l_ld = reinterpret_cast<uintptr_t>(lib->view_.dynamic()); |
437 Globals::GetRDebug()->AddEntry(&lib->link_map_); | 437 Globals::GetRDebug()->AddEntry(&lib->link_map_); |
438 | 438 |
439 // The library was properly loaded, add it to the list of crazy | 439 // The library was properly loaded, add it to the list of crazy |
440 // libraries. IMPORTANT: Do this _before_ calling the constructors | 440 // libraries. IMPORTANT: Do this _before_ calling the constructors |
441 // because these could call dlopen(). | 441 // because these could call dlopen(). |
442 lib->list_next_ = head_; | 442 lib->list_next_ = head_; |
443 lib->list_prev_ = NULL; | 443 lib->list_prev_ = NULL; |
444 if (head_) | 444 if (head_) |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 const char* base_name = GetBaseNamePtr(name); | 545 const char* base_name = GetBaseNamePtr(name); |
546 for (size_t n = 0; n < known_libraries_.GetCount(); ++n) { | 546 for (size_t n = 0; n < known_libraries_.GetCount(); ++n) { |
547 LibraryView* wrap = known_libraries_[n]; | 547 LibraryView* wrap = known_libraries_[n]; |
548 if (!strcmp(base_name, wrap->GetName())) | 548 if (!strcmp(base_name, wrap->GetName())) |
549 return wrap; | 549 return wrap; |
550 } | 550 } |
551 return NULL; | 551 return NULL; |
552 } | 552 } |
553 | 553 |
554 } // namespace crazy | 554 } // namespace crazy |
OLD | NEW |