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 #ifndef CRAZY_LINKER_H | 5 #ifndef CRAZY_LINKER_H |
6 #define CRAZY_LINKER_H | 6 #define CRAZY_LINKER_H |
7 | 7 |
8 // This is the crazy linker, a custom dynamic linker that can be used | 8 // This is the crazy linker, a custom dynamic linker that can be used |
9 // by NDK applications to load shared libraries (not executables) with | 9 // by NDK applications to load shared libraries (not executables) with |
10 // a twist. | 10 // a twist. |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 // Note that this works even if the memory is inside a system library that | 328 // Note that this works even if the memory is inside a system library that |
329 // was not previously opened with crazy_library_open(). | 329 // was not previously opened with crazy_library_open(). |
330 // |address| is the memory address. | 330 // |address| is the memory address. |
331 // On success, returns CRAZY_STATUS_SUCCESS and sets |*library|. | 331 // On success, returns CRAZY_STATUS_SUCCESS and sets |*library|. |
332 // The caller muyst call crazy_library_close() once it's done with the | 332 // The caller muyst call crazy_library_close() once it's done with the |
333 // library. | 333 // library. |
334 crazy_status_t crazy_library_find_from_address( | 334 crazy_status_t crazy_library_find_from_address( |
335 void* address, | 335 void* address, |
336 crazy_library_t** library) _CRAZY_PUBLIC; | 336 crazy_library_t** library) _CRAZY_PUBLIC; |
337 | 337 |
| 338 // Return the full filename of |lib_name| in the zip file |
| 339 // (lib/<abi>/crazy.<lib_name>). The result is returned in |
| 340 // |buffer[0..buffer_size - 1]|. If |buffer_size| is too small, |
| 341 // CRAZY_STATUS_FAILURE is returned. |
| 342 crazy_status_t crazy_library_filename_in_zip_file(const char* lib_name, |
| 343 char* buffer, |
| 344 size_t buffer_size) |
| 345 _CRAZY_PUBLIC; |
| 346 |
338 // Check whether |lib_name| is page aligned in |zipfile_name|. | 347 // Check whether |lib_name| is page aligned in |zipfile_name|. |
339 crazy_status_t crazy_linker_check_library_aligned_in_zip_file( | 348 crazy_status_t crazy_linker_check_library_aligned_in_zip_file( |
340 const char* zipfile_name, | 349 const char* zipfile_name, |
341 const char* lib_name) _CRAZY_PUBLIC; | 350 const char* lib_name) _CRAZY_PUBLIC; |
342 | 351 |
343 // Close a library. This decrements its reference count. If it reaches | 352 // Close a library. This decrements its reference count. If it reaches |
344 // zero, the library be unloaded from the process. | 353 // zero, the library be unloaded from the process. |
345 void crazy_library_close(crazy_library_t* library) _CRAZY_PUBLIC; | 354 void crazy_library_close(crazy_library_t* library) _CRAZY_PUBLIC; |
346 | 355 |
347 // Close a library, with associated context to support delayed operations. | 356 // Close a library, with associated context to support delayed operations. |
348 void crazy_library_close_with_context(crazy_library_t* library, | 357 void crazy_library_close_with_context(crazy_library_t* library, |
349 crazy_context_t* context) _CRAZY_PUBLIC; | 358 crazy_context_t* context) _CRAZY_PUBLIC; |
350 | 359 |
351 #ifdef __cplusplus | 360 #ifdef __cplusplus |
352 } /* extern "C" */ | 361 } /* extern "C" */ |
353 #endif | 362 #endif |
354 | 363 |
355 #endif /* CRAZY_LINKER_H */ | 364 #endif /* CRAZY_LINKER_H */ |
OLD | NEW |