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_wrappers.h" | 5 #include "crazy_linker_wrappers.h" |
6 | 6 |
7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
8 #include <link.h> | 8 #include <link.h> |
9 | 9 |
10 #include "crazy_linker_debug.h" | 10 #include "crazy_linker_debug.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // library, so don't try to handle it with the crazy linker. | 75 // library, so don't try to handle it with the crazy linker. |
76 if (path) { | 76 if (path) { |
77 LibraryList* lib_list = Globals::GetLibraries(); | 77 LibraryList* lib_list = Globals::GetLibraries(); |
78 Error error; | 78 Error error; |
79 LibraryView* wrap = lib_list->LoadLibrary(path, | 79 LibraryView* wrap = lib_list->LoadLibrary(path, |
80 mode, | 80 mode, |
81 0U /* load_address */, | 81 0U /* load_address */, |
82 0U /* file_offset */, | 82 0U /* file_offset */, |
83 Globals::GetSearchPaths(), | 83 Globals::GetSearchPaths(), |
84 false, | 84 false, |
| 85 false, |
85 &error); | 86 &error); |
86 if (wrap) | 87 if (wrap) |
87 return wrap; | 88 return wrap; |
88 } | 89 } |
89 | 90 |
90 // Try to load the executable with the system dlopen() instead. | 91 // Try to load the executable with the system dlopen() instead. |
91 ::dlerror(); | 92 ::dlerror(); |
92 void* system_lib = ::dlopen(path, mode); | 93 void* system_lib = ::dlopen(path, mode); |
93 if (system_lib == NULL) { | 94 if (system_lib == NULL) { |
94 SaveSystemError(); | 95 SaveSystemError(); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 }; | 270 }; |
270 static const size_t kCount = sizeof(kSymbols) / sizeof(kSymbols[0]); | 271 static const size_t kCount = sizeof(kSymbols) / sizeof(kSymbols[0]); |
271 for (size_t n = 0; n < kCount; ++n) { | 272 for (size_t n = 0; n < kCount; ++n) { |
272 if (!strcmp(kSymbols[n].name, name)) | 273 if (!strcmp(kSymbols[n].name, name)) |
273 return kSymbols[n].address; | 274 return kSymbols[n].address; |
274 } | 275 } |
275 return NULL; | 276 return NULL; |
276 } | 277 } |
277 | 278 |
278 } // namespace crazy | 279 } // namespace crazy |
OLD | NEW |