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 // This is the Android-specific Chromium linker, a tiny shared library | 5 // This is the Android-specific Chromium linker, a tiny shared library |
6 // implementing a custom dynamic linker that can be used to load the | 6 // implementing a custom dynamic linker that can be used to load the |
7 // real Chromium libraries (e.g. libcontentshell.so). | 7 // real Chromium libraries (e.g. libcontentshell.so). |
8 | 8 |
9 // The main point of this linker is to be able to share the RELRO | 9 // The main point of this linker is to be able to share the RELRO |
10 // section of libcontentshell.so (or equivalent) between the browser and | 10 // section of libcontentshell.so (or equivalent) between the browser and |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 library_name, | 260 library_name, |
261 crazy_context_get_error(context)); | 261 crazy_context_get_error(context)); |
262 return false; | 262 return false; |
263 } | 263 } |
264 | 264 |
265 // Release library object to keep it alive after the function returns. | 265 // Release library object to keep it alive after the function returns. |
266 library.Release(); | 266 library.Release(); |
267 | 267 |
268 s_lib_info_fields.SetLoadInfo( | 268 s_lib_info_fields.SetLoadInfo( |
269 env, lib_info_obj, info.load_address, info.load_size); | 269 env, lib_info_obj, info.load_address, info.load_size); |
270 LOG_INFO("%s: Success loading library %s", __FUNCTION__, lib_basename); | 270 LOG_INFO("%s: Success loading library %s", __FUNCTION__, library_name); |
271 return true; | 271 return true; |
272 } | 272 } |
273 | 273 |
274 // Used for opening the library in a regular file. | 274 // Used for opening the library in a regular file. |
275 class FileLibraryOpener { | 275 class FileLibraryOpener { |
276 public: | 276 public: |
277 bool Open( | 277 bool Open( |
278 crazy_library_t** library, | 278 crazy_library_t** library, |
279 const char* library_name, | 279 const char* library_name, |
280 crazy_context_t* context) const; | 280 crazy_context_t* context) const; |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 crazy_context_t* context = GetCrazyContext(); | 658 crazy_context_t* context = GetCrazyContext(); |
659 crazy_context_set_java_vm(context, vm, JNI_VERSION_1_4); | 659 crazy_context_set_java_vm(context, vm, JNI_VERSION_1_4); |
660 | 660 |
661 // Register the function that the crazy linker can call to post code | 661 // Register the function that the crazy linker can call to post code |
662 // for later execution. | 662 // for later execution. |
663 crazy_context_set_callback_poster(context, &PostForLaterExecution, NULL); | 663 crazy_context_set_callback_poster(context, &PostForLaterExecution, NULL); |
664 | 664 |
665 LOG_INFO("%s: Done", __FUNCTION__); | 665 LOG_INFO("%s: Done", __FUNCTION__); |
666 return JNI_VERSION_1_4; | 666 return JNI_VERSION_1_4; |
667 } | 667 } |
OLD | NEW |